Professional Documents
Culture Documents
Rafikul Alam
Department of Mathematics
IIT Guwahati
MAx = Mb
x1 = b1 /`11
Pi−1
xi = bi − j=1 `ij xj /`jj , i = 2 : n.
Cost: n2 flops
Pn Rn
Indeed, i=1 2i = 0 2xdx+ lower order terms ' n2 .
Writing Lx = b as
x = zeros(n,1);
for j=1:n-1
x(j) =b(j)/L(j,j);
b(j+1:n) = b(j+1:n)-L(j+1:n,j)*x(j);
end
x(n) = b(n)/L(n,n);
• LU factorization: A = LU
• Row permuted LU factorization: PA = LU
• Row and column permuted LU factorization: PAQ = LU
Then
MA = U =⇒ L−1 −1 −1
n−1 Ln−2 · · · L1 A = U =⇒ A = LU,
Consequently
This shows that if akk 6= 0 then Lk can be used to create zeros in the
k-th column of A below akk .
R. Alam, IIT Guwahati (July-Nov 2023) MA423 MC
Multiplying a matrix by an elimination matrix
Let A ∈ Rn×n and Lk := I + `k ek> ∈ Rn×n . Then
a11 ··· akk ··· a1n 0
.. .. .. .. ..
. . . ··· . .
ak1 ··· akk ··· akn 0
= −
`k+1,k ak1
··· akn .
ak+1,n
··· ak+1,k ··· ak+1,n
.. .. .. .. ..
. ··· . . . .
an1 ··· ank ··· ann `nk
The outer product shows that the first k rows of A remain unchanged
when L−1 −1
k is multiplied to the left of A. Let B := Lk A. In matlab, B
can be written compactly as a rank-1 update (outer product from)
(1)
The elimination is possible only when a22 6= 0. The vector `2 can be
stored in the second column of L−1 −1
2 L1 A in place of zeros.
This gives
2 4 −2 1 0 0 2 4 −2
A = L1 L2 0 1 1 = 2 1 0 0 1 1 .
0 0 4 −1 1 1 0 0 4
[n, n] = size(A);
for k = 1:n-1
% compute multipliers for k-th step
A(k+1:n,k) = A(k+1:n,k)/A(k,k);
% update A(k+1:n,k+1:n)
j = k+1:n;
A(j,j) = A(j,j)-A(j,k)*A(k,j);
end
% strict lower triangle of A, plus I
L = eye(n,n)+ tril(A,-1);
U = triu(A); % upper triangle of A