function Mar21()
w = randn(1); x = randn(1); y = randn(1); z = randn(1);
% If [c s;-s c]'*[w x ; y z] is symmetric then its (1,2) and (2,1) entries
% have the same value. I.e., cx-sz = sw+cy , i.e., s(w+z) + c(y-x) = 0,
% i.e., the second component of [c s; -s c]'*[w+z;y-x] = 0.
[c,s] = Givens(w+z,y-x);
clc
format long
S = [c s;-s c]'*[w x; y z]

function [c,s] = Givens(a,b)
% function [c,s] = Givens(a,b)
% Givens rotation computation
% Determines cosine-sine pair (c,s) so that [c s;-s c]'*[a;b] = [r;0]
if b==0
    c = 1; s = 0;
else
    if abs(b)>abs(a)
        tau = -a/b; s = 1/sqrt(1+tau^2); c = s*tau;
    else
        tau = -b/a; c = 1/sqrt(1+tau^2); s = c*tau;
    end
end