Lecture Notes 3
Lecture Notes 3
a11 c1 a21 c2
x2 x
1 x2 x
1
a
12 a12 a
22 a22
x2 = (slope) x1 + intercept
3x1 + 2x2 = 18
−x1 + 2x2 = 2
Solution
• Let x1 be the abscissa, then x2 is solved from each equation
x2 = (−3/2)x1 + 9
x2 = (1/2)x1 + 1
D a11a22 a21a12
3 2 Non-Singular
A D 3 2 (1) 2 8
1 2
1/ 2 1 Singular
B D (1/ 2) 1 (1/ 2) 1 0
1/ 2 1
1/ 2 1
C D (1/ 2) 2 (1) 1 0 Singular
1 2
1/ 2 1 Almost
D D (1/ 2) 1 (23 / 50) 1 0.04 Singular
23 / 50 1
b1 a12 a13
Dx1 b2 a22 a23
b3 a32 a33
a11 a12 a13
D a21 a22 a23 a11 b1 a13
a31 a32 a33 Dx2 a21 b2 a23
a31 b3 a33
a11 a12 b1
Determinant of
Coefficient matrix Dx3 a21 a22 b2
a31 a32 b3
CENG 202: NUMERICAL ANALYSIS, DR. SEMIH ERHAN
Cramer Rule
• Example:
Solve the following system of linear algebraic equations
by using Cramer's Rule
3 x1 2 x2 x3 9
x1 2 x2 2 x3 5
x1 x2 4 x3 2
CENG 202: NUMERICAL ANALYSIS, DR. SEMIH ERHAN
Solution
3 2 1
2 2 1 2 1 2
D 1 2 2 3 (2) 1 3 (6) (2) (2) 1 (1) 23
1 4 1 4 1 1
1 1 4
9 2 1
2 2 5 2 5 2
Dx1 5 2 2 9 (2) 1 9 (6) (2) (16) 1 (1) 23
1 4 2 4 2 1
2 1 4
3 9 1
5 2 1 2 1 5
Dx2 1 5 2 3 9 1 3 (16) 9 (2) 1 (3) 69
2 4 1 4 1 2
1 2 4
3 2 9
2 5 1 5 1 2
Dx3 1 2 5 3 (2) 9 3 1 (2) (3) 9 (1) 0
1 2 1 2 1 1
1 1 2
CENG 202: NUMERICAL ANALYSIS, DR. SEMIH ERHAN
Solution
• Then
Dx1
23
x1 1
D 23
Dx2 69
x2 3
D 23
Dx30
x3 0
D 23
• Example
• Use the elimination of unknowns to solve following
equations.
• Solution
• Solution starts with writing coefficient matrix together with
constants
3 1 2 12 x3 2 x3 2
0 7 / 3 7 / 3 7
7 7
x2 x3 7 x2 1
0 0 1 2 3 3
3x1 x2 2 x3 12 x1 3
CENG 202: NUMERICAL ANALYSIS, DR. SEMIH ERHAN
Pitfalls of Elimination Methods
• Division by Zero: A division by zero can occur during
both the elimination and the back-substitution phases. For
example, if we use naive Gauss elimination to solve:
• Solution:
2(10) 2(10.4) 1(10.4) 1.1(10)
x1 4 x2 3
1(2) 2(1.1) 1(2) 2(1.1)
• However with the slight change of the coefficient a21 from 1.1 to 1.05,
the result is changed dramatically to
2(10) 2(10.4) 1(10.4) 1.05(10)
x1 8 x2 1
1(2) 2(1.05) 1(2) 2(1.05)
Well conditioned
• b.
ill conditioned
• c.
10 7 0 x1 7 0
3 2.099 6 x 3.901
2 x 1
5 1 5 x3 6 1
10 7 0 7
0 0.001 6 6.001
0 0 15005 15004 2500 6.001 15002.5
2.5
15004.5
10 x1 (7)(1.5) 7 x1 0.35
• Solution:
0.0003 3.0000 2.0001 Multiply 1st row by -1/0.0003
1.0000 1.0000 1.0000 then add 2nd row
x2 2 / 3
2 x1 100000 x2 100000 x1 0
1 1 2
0 0.99998 0.99996
1 1 2
0 1 1 x2 1 and x1 x2 2 x1 1
• Proof:
3 1 2
0 7 / 3 7 / 3 Then determinant is calculated
0 0 1
7
det( A) 3 (1) 7
3
Forward elimination
Unit (identity)
matrix
1 0 1 5
0 1 1 3
0 0 1 2
Identical with 1st
column of unit matrix
• Answer:
x1 3
x2 2.5
x3 7
[A] [I]
1 0 0 0.5713 0.7141 1
0 1 0 1 1 1
0 0 1 0.8571 0.5713 1
[I] [A]-1
i 1
x12 x2 2 ... xn 2
• Condition Number:
We have introduced the concept of the norm, we can use it to define:
Cond A A A1
• Here
A norm of coefficent matrix ( A)
A1 norm of inverse of coefficent matrix ( A1 )
• Note that the larger the condition number is, the greater the system’s ill
conditioning
• Solution:
• Norm of [A]:
3 3
A a
i 1 j 1
ij
2
62 (2) 2 52 (8.5)2 (1.1)2 (3.5)2 (1.6)2 (1)2 (10.3)2 16.1357
3 3
A 1
(a 1
) (0.0442)2 (0.088)2 ... (0.1332)2 0.7275
ij
2
• Condition
i 1 j 1
number for [A]
• Cond A number
Condition A A is notso
1
16.1357 0.7275accordingly
large number, 11.74 system is well-conditioned
i 1 j 1
12
(1 / 2) 2
(1 / 3) 2
... (1 / 5) 2
1.41
9 36 30
A1 36 192 180
30 180 180
n n
A 1
(a
i 1 j 1
1
ij )2 92 (36) 2 (30) 2 ... (180) 2 372.2
• Condition number
1.02 2 18.8
1.02 2 18.8
9.5 949.4
x1 1844.04
0.52