function Mar17()
m = 10;
n = 4;
A = randn(m,n);
b = randn(m,1);
[Q,R] = qr(A);
% Since Q'*A = R and R(n+1:m,:) = 0, it follows that Q(:,n+1:m)'*A 
% So the columns of 
Z = Q(:,n+1:m) 
% span the required subspace.
% The problem asks us to compute a column m-n vector a that minimizes
% norm(Za - b,2). Note that the normal equations for this LS problem
% are Z'*Za = Z'*b. Since Z'*Z = eye(m-n,m-n), it follows that 
a = Z'*b;
minDist = norm(b - Z*a)