% % Computing the age of the son. % % The age of the son today : x % The age of the mother today: y % ------------------------------ % The age of the son after 6 years: x+6 % The age of the mother after 6 years: y+6 % ---------------------------------------- % % equations: % ---------- % today: y=x+21; % after 6 years: y+6 = 5( x+6) % % simplifying the equations. % -------------------------- % % y=x+21 % y+6=5x+30 % % y=x+21 % y=5x+30-6=5x+24 % % x -y = -21 % 5x -y = -24 % c=[1 -1]; d=[5 -1]; A=[c ; d]; b=[-21 ; -24]; % inv for matrix inverse sol= inv(A)*b; % solution sol