%% Solving Linear Systems

%%
% Define a matrix
A = [1 2 5; 4 5 6; 7 8 9]

%%
% and a right-hand side (column) vector
b = [2 5 7]'

%%
% To solve $Ax=b$ for $x$ we type
x = A\b

%%
% Check the answer
A*x-b

%%
% Define another (singular) matrix
A = [1 2 3; 4 5 6; 7 8 9; 10 11 12]

%%
rank(A)

%%
% and a right-hand side (column) vector
b = [2 5 7 8]'

%%
% Now the (least-squares) solution is given by
x = A\b

%%
% Note that $x$ does *not* satisfy the linear system
A*x-b
