% example 4 for section 6.3: orthogonal matrix
% Projection
v1 = [3 1 1]'
v2 = [-1 2 1]'
v3 = [-1/2 -2 7/2]'
A = [v1 v2 v3]
D = A' * A
y = [6 1 -8]'
b = D^(-1) * A' * y
A * b
% Orthogonal matrix
U = A * D^(-1/2)
U' * U
U * U'
% Projection by orthonormal basis
c = U' * y
U * c