We revisit the previous example using algebra to express the row operations on .
A = [2 0 4 3 ; -4 5 -7 -10 ; 1 15 2 -4.5 ; -2 0 2 -13];
We use the identity and its columns heavily.
I = eye(4);
The first step is to put a zero in the (2,1) location using a multiple of row 1:
mult21 = A(2,1)/A(1,1);
L21 = I - mult21*I(:,2)*I(:,1)';
A = L21*A
A =
2.0000e+00 0 4.0000e+00 3.0000e+00 0 5.0000e+00 1.0000e+00 -4.0000e+00 1.0000e+00 1.5000e+01 2.0000e+00 -4.5000e+00 -2.0000e+00 0 2.0000e+00 -1.3000e+01
We repeat the process for the (3,1) and (4,1) entries.
mult31 = A(3,1)/A(1,1);
L31 = I - mult31*I(:,3)*I(:,1)';
A = L31*A;
mult41 = A(4,1)/A(1,1);
L41 = I - mult41*I(:,4)*I(:,1)';
A = L41*A
A =
2 0 4 3 0 5 1 -4 0 15 0 -6 0 0 6 -10
And so on, following the pattern as before.