Lecture 04
Lecture 04
A = LU,
Forward Sweep:
ℓ11 0 ··· 0 y b
1 1
.. y
ℓ21
ℓ22 ··· . 2 b2
. . =.
. ..
.
.. ..
. ··· 0
ℓn1 ··· ··· ℓ yn bn
nn
Forward and Backward Sweeps
Backward Sweep:
u11 u12 ··· u1n x y
1 1
.. x
0
u22 ··· . 2 y2
. . = .
. .. .. .. ..
. ··· . .
0 ··· 0 unn xn yn
Algorithms for Forward and Backward Sweeps
3x1 + 5x2 = 9
6x1 + 7x2 = 4
Elementary Row Operations
1 Row switching: Ri ↔ Rj
What is τ ?
1 0 v1 v
= 1
−τ 1 v2 0
More generally, which matrix to multiply on the left to create zeros below vk ?
v1 v1
.. ..
. .
vk vk
vk+1 = 0
. .
.. ..
vn 0
Gauss Transforms
Suppose v ∈ Rn with vk ̸= 0. If
vi
τ T = [0, . . . , 0, τk+1 , . . . , τn ], τi = , i = k + 1 : n,
vk
1 4 7
A = 2 5 8
3 6 10
A(k−1) = Mk−1 · · · M1 A
3 5 x1 9
=
6 7 x2 4
Idea: Keep making zeros below the main diagonal. Then matrix becomes upper
triangular, which can be solved using backward sweep.
Existence of LU factorization
A = LU,
where
L = M1−1 · · · Mn−1
−1
LU Factorization
Theorem
If A ∈ Rn×n and det(A(1 : k, 1 : k)) ̸= 0 for k = 1 : n − 1, then there exists a unit
lower trianguar L ∈ Rn×n and an upper triangular U ∈ Rn×n such that A = LU. If
this is the case and A is nonsingular, then the factorization is unique and
det(A) = u11 u22 · · · unn .
Simplify L
• We have
L = M1−1 · · · Mn−1
−1
L = M1−1 · · · Mn−1
−1
1: for k = 1 to n − 1 do
2: A(k + 1 : n, k) ← A(k + 1 : n, k)/A(k, k)
3: for i = k + 1 to n do
4: for j = k + 1 to n do
5: A(i, j) ← A(i, j) − A(i, k) · A(k, j)
6: end for
7: end for
8: end for
Vectorize j th loop.
LU Algorithm: After Vectorization of jth loop
1: for k = 1 to n − 1 do
2: A(k + 1 : n, k) ← A(k + 1 : n, k)/A(k, k)
3: for i = k + 1 to n do
4: A(i, k + 1 : n) ← A(i, k + 1 : n) − A(i, k) · A(k, k + 1 : n)
5: end for
6: end for
Eigenvalues and Eigenvectors
Av = λv
det(λI − A) = 0
Assume:
• A ∈ Rn×n
• A is semi-simple: A has n linearly independent eigenvectors, which forms
the basis of Rn
• Eigenvalues are ordered: |λ1 | ≥ |λ2 | ≥ · · · ≥ |λn |
• λ1 is called dominant eigenvalue
Power Method: If A has a dominant eigenvalue, then we can find it and an
associated eigenvector.
Power Method: Basic Idea
q, Aq, A2 q, · · ·
q = c1 v1 + c2 v2 + · · · + cn vn
|λ2 /λ1 | → 0 as j → ∞
Algorithm: Power Method
Fact
If A is non-singular, then all the eigenvalues of A are non-zeros. Show that if v is
an eigenvector of A associated with eigenvalue λ, then v is also an eigenvector
of A−1 associated with eigenvalue λ−1 .
Proof in class.
Inverse Iteration
Fact
Let ρ ∈ R. Show that v is an eigenvector of A with eigenvalue λ, then v is also an
eigenvector of A − ρI with eigenvalue λ − ρ.
Proof in class.
Shift-and-Invert Idea
1 https://en.wikipedia.org/wiki/Gershgorin_circle_theorem
Rayleigh Quotient Iteration