function Jan28()
Mat{1} = [1 2 ; 3 4];
Mat{2} = [3 4 ; 1 2];
Mat{3} = [1 2 ; 2 4];
Mat{4} = [0 0 ; 0 0];
for k=1:4
    clc
    A = Mat{k}
    [U,S,V] = svd2(A)
    fprintf('det(A) = %3.1f\ndet(U) = %3.1f\ndet(V) = %3.1f\n',det(A),det(U),det(V))
    pause
end

  function [U,S,V] = svd2(A)
% A is 2x2 and A = U*S*V' is its svd.
% if det(A)>=0, then U and V are rotations
% if det(A)<= then U is a reflection and V is a rotation;
[U,S,V] = svd(A);
if det(A) >=0
    if det(V)<0
        % Multiplying a column by -1 changes the sign of the det
        V(:,2) = -V(:,2);
    end
    if det(U)<0
        % Multiplying a column by -1 changes the sign of the det
        U(:,2) = -U(:,2);
    end
else
    if det(V)<0
        % Multiplying a column by -1 changes the sign of the det
        V(:,2) = -V(:,2);
    end
    if det(U)>0
        % Multiplying a column by -1 changes the sign of the det
        U(:,2) = -U(:,2);
    end
end