'Solve linear systems Ax=b' 'You can use x=A\b to get one solution' A=[1,1,0;2,3,4] b=[3;-2] x=A\b 'OK if there is only one. But we want them all!' 'Example from p. 538 of textbook' 'Either use solve' [w,x,y,z]=solve( '3*x+y+7*z+2*w=13', '2*x-4*y+14*z-w=-10', '5*x+11*y-7*z+8*w=59', '2*x+5*y-4*z-3*w=39') 'or express the system as an augmented matrix (better!)' M6=[3,1,7,2,13; 2,-4,14,-1,-10; 5,11,-7,8,59; 2,5,-4,-3,39] 'and calculate the rref!' %You can do row operations 'Subtract row 4 from row 2' M6(2,:)=M6(2,:) - M6(4,:) 'Subtract row 4 from row 1, then 5 times 1 from 3' M6(1,:)=M6(1,:) - M6(4,:); %the ; % suppresses output M6(3,:)=M6(3,:) - 5*M6(1,:) 'and so on. But there is a function rref that does all this for you.' M7=rref(M6) 'We can consider the system solved here'. %One final note. As M6[i,:] is row i of M6, %so M6[:,j] is column j.