Linear Algebraic Equations (Chapters 9,10,11,12) General form of a system of linear algebraic equations a 11 x 1 + a 12 x 2 + ··· + a 1n x n = b 1 a 21 x 1 + a 22 x 2 + ··· + a 2n x n = b 2 ··· a n1 x 1 + a n2 x 2 + ··· + a nn x n = b n which can be rewritten as a 11 a 12 ··· a 1n a 21 a 22 ··· a 2n ··· a n1 a n2 ··· a nn x 1 x 2 ··· x n = b 1 b 2 ··· b n or AX = b Example: 2x 1 + x 2 =5 x 1 +2x 2 =4 1
56
Embed
Linear Algebraic Equations (Chapters 9,10,11,12)xwu/part3.pdf · 2010-01-12 · Linear Algebraic Equations (Chapters 9,10,11,12) General form of a system of linear algebraic equations
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Linear Algebraic Equations (Chapters 9,10,11,12)
General form of a system of linear algebraic equations
a11x1 + a12x2 + · · · + a1nxn = b1
a21x1 + a22x2 + · · · + a2nxn = b2
· · ·an1x1 + an2x2 + · · · + annxn = bn
which can be rewritten as
a11 a12 · · · a1n
a21 a22 · · · a2n
· · ·an1 an2 · · · ann
x1
x2
· · ·xn
=
b1
b2
· · ·bn
orAX = b
Example:
2x1 + x2 = 5
x1 + 2x2 = 4
1
can be rewritten as [2 11 2
] [x1
x2
]=
[54
]
where A =
[2 11 2
], X =
[x1
x2
], and b =
[54
].
Outline:
• Graphical method
• Cramer’s rule
• Gauss elimination
• LU decomposition
• Cholesky decomposition
• Gauss-Seidel iteration
• Error analysis
2
1 Graphical Method
The simplest method to solve a set of two linear equations is to use the graphicalmethod. For
a11x1 + a12x2 = b1 (1)a21x1 + a22x2 = b2 (2)
From (1) we have
x2 = −a11
a12x1 +
b1
a12(3)
From (2) we have
x2 = −a21
a22x1 +
b2
a22(4)
where −a11a12
and −a21a22
are slopes of the lines and b1a12
and b2a22
are intercepts.Example:
2x1 + x2 = 5 → x2 = −2x1 + 5
x1 + 2x2 = 4 → x2 = −1
2x1 + 2
Comments:
• Not precise; and not practical for 3-dimensions and above.
3
x2
solution
x1
(2,1)
0 1 2 3 4 5
1
2
3
4
5
Figure 1: Example of using graphical method
4
2 Cramer’s Rule
AX = b.
A =
a11 a12 · · · a1n
a21 a22 · · · a2n
· · ·an1 an2 · · · ann
, d = |A| =
∣∣∣∣∣∣∣∣
a11 a12 · · · a1n
a21 a22 · · · a2n
· · ·an1 an2 · · · ann
∣∣∣∣∣∣∣∣Cramer’s rule uses the determinant to solve a set of linear equations.For 3-dimensional case:
a11 a12 a13
a21 a22 a23
a31 a32 a33
x1
x2
x3
=
b1
b2
b3
Solutions:
x1 =
∣∣∣∣∣∣
b1 a12 a13
b2 a22 a23
b3 a32 a33
∣∣∣∣∣∣∣∣∣∣∣∣
a11 a12 a13
a21 a22 a23
a31 a32 a33
∣∣∣∣∣∣
, x2 =
∣∣∣∣∣∣
a11 b1 a13
a21 b2 a23
a31 b3 a33
∣∣∣∣∣∣∣∣∣∣∣∣
a11 a12 a13
a21 a22 a23
a31 a32 a33
∣∣∣∣∣∣
, x3 =
∣∣∣∣∣∣
a11 a12 b1
a21 a22 b2
a31 a32 b3
∣∣∣∣∣∣∣∣∣∣∣∣
a11 a12 a13
a21 a22 a23
a31 a32 a33
∣∣∣∣∣∣5
2-dimensional case: [a11 a12
a21 a22
] [x1
x2
]=
[b1
b2
]
Solutions:
x1 =
∣∣∣∣b1 a12
b2 a22
∣∣∣∣∣∣∣∣a11 a12
a21 a22
∣∣∣∣, x2 =
∣∣∣∣a11 b1
a21 b2
∣∣∣∣∣∣∣∣a11 a12
a21 a22
∣∣∣∣Example:
2x1 + x2 = 5
x1 + 2x2 = 4
x1 =
∣∣∣∣5 14 2
∣∣∣∣∣∣∣∣2 11 2
∣∣∣∣=
5× 2− 1× 4
2× 2− 1× 1=
6
3= 2,
x2 =
∣∣∣∣2 51 4
∣∣∣∣∣∣∣∣2 11 2
∣∣∣∣=
2× 4− 1× 5
2× 2− 1× 1=
3
3= 1,
6
Comment: Cramer’s rule is not feasible for larger values of n because of thedifficulty in evaluating the determinants.
7
3 Gauss Elimination
Example:
a11x1 + a12x2 = b1 (5)a21x1 + a22x2 = b2 (6)
(5)×a21:a11a21x1 + a12a21x2 = b1a21 (7)
(6)×a11:a11a21x1 + a11a22x2 = b2a11 (8)
(7)-(8)(a12a21 − a11a22)x2 = b1a21 − b2a11 (9)
x2 =b1a21 − b2a11
a12a21 − a11a22(10)
Substituting back to (7),
x1 =b1a22 − b2a12
a12a21 − a11a22(11)
8
Gauss elimination steps:
• Forward elimination
– n unknowns: n− 1 rounds of eliminationThe first round is to eliminate x1 from equations (2) to (n)The second round is to eliminate x2 from equations (3) to (n). . .The (n− 1)th round is to eliminate xn−1 from equation (n)
• Back substitutionFirst find xn from the nth equationthen find xn−1 from the (n− 1)th equation. . .then find x2 from equation (2)finally find x1 from equation (1)
Forward elimination
9
Original set of equations:a11x1+ a12x2+ a13x3+ . . . + a1,n−1xn−1+ a1nxn = b1 (1)a21x1+ a22x2+ a23x3+ . . . + a2,n−1xn−1+ a2nxn = b2 (2)
x3 = 4, x2 = 2, x1 = 2.Pivoting: switching rows so that the pivot element in each round of eliminationis non-zero (maximum).Pivoting results in better results when aii ≈ 0, since it avoids division by smallnumbers during elimination.
16
4 LU Decomposition
In Gauss elimination,
• more than 90% operations are for elimination,
• both A and b are modified during the elimination process,
• to solve AX = b and AY = b′, the same elimination process has to be
repeated for A.
LU decomposition records the elimination process information, so that it can beused later.Consider AX = b. After Gauss elimination we have
7 Error Analysis for Solving a Set of Linear Equations
Consider AX = b,
• When |A| 6= 0, A is non-singular, there is a unique solution.
• When |A| = 0, A is singular, there is no solution or an infinite number ofsolutions.
• When |A| ≈ 0, the solution is sensitive to numerical errors.
“An×n is non-singular” is equivalent to
• A has an inverse. Then X = A−1b.
• |A| 6= 0
• A has full rank, or rank(A) = n.
• All n rows in A are linear independent, and all n columns in A are linearindependent.
• For any Zn×1 6= 0, AZ 6= 0.
If An×n is singular, then
• |A| = 0
36
• A does have an inverse
• rank(A) < n
• There exists Zn×1 6= 0, so that AZ = 0.
• For AX = b, either there is no solution or there is an infinite number ofsolutions.Proof: If A is singular, then there exists Zn×1 6= 0 so that AZ = 0. If thereis X1 so that AX1 = b, then A(X1 + γZ) = AX1 + γAZ = b, or X1 + γZis a solution for AX = b. Since γ can be any scaler, AX = b has an infinitenumber of solutions.
Example:
2x1 + 3x2 = 4
4x1 + 6x2 = 8
A =
[2 34 6
], |A| = 0. X1 = [2 0]
′is one solution.
Find Z so that AZ = 0. [2 34 6
] [z1
z2
]=
[00
]
then Z = [−3 2]′and X = X1 + γZ = [2− 3γ 2γ]
′.
37
Example:
2x1 + 3x2 = 4 (1)
4x1 + 6x2 = 7 (2)
|A| = 0, no solution.
Linear dependentConsider n vectors, V1, V2, . . . , Vn,
• If there exist α1, α2, . . . , αn (not all zeros), such that
α1V1 + α2V2 + . . . + αnVn = 0
then V1, V2, . . . , Vn are linear dependent. That is, at least one vector can bederived linearly from others.
• If V1, V2, . . . , Vn are linear independent and
α1V1 + α2V2 + . . . + αnVn = 0,
then α1 = α2 = . . . = αn = 0.
Example: A3×3, AZ = 0, |A| = 0. There exists Z 6= 0 so that AZ = 0.