A=[2 3 4 5;1 2 1 2;1 3 -2 2; 2 -3 4 5]
b=[2;3;4;1]
(A\b)'
b'

C=[A,b]

C(1,:)=C(1,:)/C(1,1)

C(2,:)=C(2,:)-C(2,1)*C(1,:)
C(3,:)=C(3,:)-C(3,1)*C(1,:)
C(4,:)=C(4,:)-C(4,1)*C(1,:)

tmp=C(2,:)
C(2,:)=C(4,:)
C(4,:)=tmp

C(2,:)=C(2,:)/C(2,2)

C(3,:)=C(3,:)-C(3,2)*C(2,:)
C(4,:)=C(4,:)-C(4,2)*C(2,:)


C(3,:)=C(3,:)/C(3,3)

C(4,:)=C(4,:)-C(4,3)*C(3,:)

C(4,:)=C(4,:)/C(4,4)

for j=3:-1:1
for i=j:-1:1
	C(i,:)=C(i,:)-C(i,j+1)*C(j+1,:)
end;
end;


