0% found this document useful (0 votes)
38 views24 pages

6) Linear Algebraic-Gauss Eliminaton (Compatibility Mode)

Uploaded by

Atrsaw Jejaw
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
38 views24 pages

6) Linear Algebraic-Gauss Eliminaton (Compatibility Mode)

Uploaded by

Atrsaw Jejaw
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 24

Linear Algebraic/

Gauss Elimination
By
Dr Ali Ja
Jawarneh
arneh

Dr Ali Jawarneh 1
Cramer’s Rule

Dr Ali Jawarneh 2
Dr Ali Jawarneh 3
Dr Ali Jawarneh 4
Dr Ali Jawarneh 5
Dr Ali Jawarneh 6
Example:
Use Cramer’s rule to 3x1 + 2x 2 = 18
get the solution − x1 + 2x 2 = 2

Solution:
⎡ 3 2⎤ ⎡ x1 ⎤ ⎡18⎤
⎢ − 1 2⎥ ⎢ x ⎥ = ⎢ 2 ⎥
⎣ ⎦⎣ 2 ⎦ ⎣ ⎦

18 2 3 18
2 2 36 − 4 −1 2
x1 = = =4 x2 = =3
3 2 6 − ( −2) 3 2
−1 2 −1 2

Dr Ali Jawarneh 7
0.3x1 + 0.52x 2 + x 3 = −0.01
Example:
Use Cramer’s rule to 0.5x1 + x 2 + 1.9x 3 = 0.67
get the solution
0.1x1 + 0.3x 2 + 0.5x 3 = −0.44
Solution:
⎡0.3 0.52 1 ⎤ ⎡ x1 ⎤ ⎡ − 0.01⎤
⎢0.5 1 1. 9 ⎥ ⎢ x ⎥ = ⎢ 0.67 ⎥
⎢ ⎥⎢ 2 ⎥ ⎢ ⎥
⎢⎣ 0.1 0.3 0.5⎦⎥ ⎢⎣ x 3 ⎥⎦ ⎢⎣ − 0.44⎥⎦

− 0.01 0.52 1
0.67 1 1.9
− 0.44 0.3 0.5 1 1.9 0.67 1.9 0.67 1
x1 = = −0.01 − 0.52 +1 = −14.9
0.3 0.52 1 0.3 0.5 − 0.44 0.5 − 0.44 0.3
0.5 1 1.9
0.1 0.3 0.5

Dr Ali Jawarneh 8
0.3 − 0.01 1
0.5 0.67 1.9
0.1 − 0.44 0.5
x2 = = −29.5
0.3 0.52 1
0.5 1 1.9
0.1 0.3 0.5

0.3 0.52 − 0.01


0.5 1 0.67
0.1 0.3 − 0.44
x3 = = 19.8
0.3 0.52 1
0.5 1 1.9
0.1 0.3 0.5

Dr Ali Jawarneh 9
Example:
Use Cramer’s rule to
get the tension in
each wire

Solution:

cos 25T1 − cos15T2 = 0


sin 25T1 + sin 15T2 = 300

D = 0.6428
D1 = 289.8
D 2 = 271.9 T1 = 450.8
T2 = 423

Dr Ali Jawarneh 10
Naïve Gauss Elimination
Switching to an upper
Example: triangular system
− 12x1 + x 2 − x 3 = −20
Solve this system using
G
Gauss Eli
Elimination
i i − 2x1 − 4x 2 + 2x 3 = 10
x1 + 2x 2 + 2x 3 = 25 Note: those formulas
Solution: are not unique

Pivot ⎡ − 12 1 − 1 − 20⎤ R ‐(a /a )R ⎡ − 12 1 −1 − 20 ⎤


⎢ −2 −4 2 ⎥ 2 21 11 1 ⎢ 0 − 25 / 6 13 / 6 40 / 3 ⎥
⎢ 10 ⎥ ⎢ ⎥
R3‐(a31/a
/ 11)R1 ⎢⎣ 0
⎢⎣ 1 2 2 25 ⎥⎦ 25 / 12 23 / 12 70 / 3⎥⎦

⎡ − 12 1 −1 − 20 ⎤ ⎡ − 12 1 −1 − 20 ⎤
⎢ 0 − 25 / 6 13 / 6 40 / 3 ⎥ ⎢ 0 − 25 / 6 13 / 6 40 / 3 ⎥
⎢ ⎥ ⎢ ⎥
⎢⎣ 0 25 / 12 23 / 12 70 / 3⎥⎦ ⎢⎣ 0 0 3 30 ⎥⎦
Pivot R3‐(a32/a22)R2
Dr Ali Jawarneh 11
3x 3 = 30 ⇒ x 3 = 10
25 13 40
− x2 + x3 = ⇒ x2 = 2
6 6 3
− 12x1 + x 2 − x 3 = −20 ⇒ x1 = 1

Dr Ali Jawarneh 12
Pivoting
It is
i a technique
h i off pivoting
i i to avoid
id division
di i i b by zero or close
l to zero

Procedure:

Determine the largest


g coefficient in the column below the pivot
p element. The
rows can then be switched so that the largest element is the pivot element
(partial pivoting)

Dr Ali Jawarneh 13
Example: 8x1 + 2x 2 − 2x 3 = −2
Solve this system
y usingg Gauss Elimination :
a‐ without pivoting, b‐ with partial pivoting 10x1 + 2x 2 + 4x 3 = 4
12x1 + 2x 2 + 2x 3 = 6
Solution:
a‐ without pivoting

⎡ 8 2 − 2 − 2⎤ R ‐(a /a )R ⎡8 2 −2 −2 ⎤
Pivot ⎢10 2 4 ⎥ 2 21 11 1 ⎢0 − 1 / 2 13 / 2 13 / 2⎥
⎢ 4⎥
R3‐(a31/a11)R1
⎢ ⎥
⎣⎢12 2 2 6 ⎥⎦ ⎣⎢0 − 1 5 9 ⎥⎦

⎡8 2 −2 −2 ⎤ ⎡8 2 −2 −2 ⎤
⎢0 − 1 / 2 13 / 2 13 / 2⎥ ⎢0 − 1 / 2 13 / 2 13 / 2⎥
⎢ ⎥ R3‐(a
( 32/a
/ 22)R2 ⎢ ⎥
⎢0 − 1
Pivot ⎣ 5 9 ⎥⎦ ⎣⎢0 0 −8 − 4 ⎥⎦

x3 = 1 / 2 x 2 = −13 / 2 x1 = 3 / 2
Dr Ali Jawarneh 14
b‐ with partial pivoting
First,, we p
pivot byy switchingg rows 1 & 3
⎡12 2 2 6⎤ ⎡12 2 2 6⎤
⎢10 2 4 ⎥ R2‐(a21/a11)R1 ⎢ 0 0.33333 2.33333 − 1⎥
⎢ 4⎥ ⎢ ⎥
R3‐(a31/a
/ 11)R1
⎢⎣ 8 2 − 2 − 2⎥⎦ ⎣⎢ 0 0.66667 − 3.33333 − 6⎥⎦
2nd, we pivot by switching rows 2 & 3
⎡12 2 2 6⎤
⎡12 2 2 6⎤
⎢ 0 0.66667 − 3.33333 − 6⎥ ⎢ 0 0.66667 − 3.33333 − 6⎥
⎢ ⎥R3‐(a
(a32/a22)R2 ⎢ ⎥
⎣⎢ 0 0.33333 2.33333 − 1⎥⎦ ⎣⎢ 0 0 4 2 ⎥⎦

x3 = 1 / 2 x 2 = −13 / 2 x1 = 3 / 2

Dr Ali Jawarneh 15
Example: − 3x 2 + 7 x 3 = 2
Solve this system
y usingg Gauss Elimination :
x 1 + 2x 2 − x 3 = 3
⎡ 0 − 3 7 2⎤ 5x1 − 2x 2 = 2
Solution: ⎢1 2 − 1 3⎥
⎢ ⎥
⎢⎣5 − 2 0 2⎥⎦
First, we pivot by switching rows 1 & 3
⎡ 5 − 2 0 2⎤ ⎡5 − 2 0 2⎤ Note: you can
continue here
⎢1 2 − 1 3⎥ R2‐(a21/a11)R1 ⎢0 2.4 − 1 2.6⎥ without p
pivotingg
⎢ ⎥R ‐(a /a )R ⎢ ⎥ rows 2 &3
⎢⎣0 − 3 7 2⎥⎦ 3 31 11 1 ⎣⎢0 − 3 7 2 ⎥⎦
Second, we pivot by switching rows 2 & 3
x 3 = 0.913043
⎡5 − 2 0 2⎤ ⎡5 − 2 0 2⎤
⎢0 − 3 7 ⎥ ⎢0 − 3 7 ⎥ x 2 = 1.463768
⎢ 2 ⎥ R3‐(a32/a22)R2 2⎥
⎢ x1 = 0.985507
⎢⎣0 2.4 − 1 2.6⎥⎦
⎣⎢0 0 4.6 4.2⎥⎦ Dr Ali Jawarneh 16
Example: x1 − x 2 + x 3 = 0
Solve this system
y usingg Gauss Elimination : − x1 + x 2 − x 3 = 0
Solution: 10x 2 + 25x 3 = 90
⎡ 1 −1 1 0⎤ 20x1 + 10x 2 = 80
⎢− 1 1 − 1 0 ⎥
⎢ ⎥
⎢ 0 10 25 90⎥
⎢ ⎥
⎣ 20 10 0 80⎦
First,, we pivot
p byy switchingg rows 1,, 3 & 4
⎡ 20 10 0 80⎤ R ‐(a /a )R ⎡ 20 10 0 80 ⎤
⎢ − 1 1 − 1 0 ⎥ 2 21 11 1 ⎢0 3 / 2 − 1 4 ⎥
⎢ ⎥ R3‐(a31/a11)R1 ⎢ ⎥
⎢ 1 −1 1 0⎥ ⎢ 0 − 3 / 2 1 − 4⎥
⎢ ⎥ R4‐(a41/a11)R1 ⎢ ⎥
⎣ 0 10 25 90⎦ ⎣0 10 25 90 ⎦

Dr Ali Jawarneh 17
Example: x1 − x 2 + x 3 = 0
Solve this system
y usingg Gauss Elimination : − x1 + x 2 − x 3 = 0
Solution: 10x 2 + 25x 3 = 90
⎡ 1 −1 1 0⎤ 20x1 + 10x 2 = 80
⎢− 1 1 − 1 0 ⎥
⎢ ⎥
⎢ 0 10 25 90⎥
⎢ ⎥
⎣ 20 10 0 80⎦
First,, we pivot
p byy switchingg rows 1,, 3 & 4
⎡ 20 10 0 80⎤ R ‐(a /a )R ⎡ 20 10 0 80 ⎤
⎢ − 1 1 − 1 0 ⎥ 2 21 11 1 ⎢0 3 / 2 − 1 4 ⎥
⎢ ⎥ R3‐(a31/a11)R1 ⎢ ⎥
⎢ 1 −1 1 0⎥ ⎢ 0 − 3 / 2 1 − 4⎥
⎢ ⎥ R4‐(a41/a11)R1 ⎢ ⎥
⎣ 0 10 25 90⎦ ⎣0 10 25 90 ⎦

Dr Ali Jawarneh 18
Second, we pivot by switching rows 2 & 4
⎡ 20 10 0 80 ⎤ ⎡ 20 10 0 80 ⎤
⎢0 10 25 90 ⎥ ⎢ 0 10 25 90 ⎥
⎢ ⎥ R3‐(a
(a32/a22)R2 ⎢ ⎥
⎢ 0 − 3 / 2 1 − 4⎥ ⎢ 0 0 19 / 4 19 / 2 ⎥
⎢ ⎥ R4‐(a42/a22)R2 ⎢ ⎥
⎣0 3/ 2 −1 4 ⎦ ⎣ 0 0 − 19 / 4 − 19 / 2⎦

x3 = 2
x2 = 4

x1 = 2

Dr Ali Jawarneh 19
Example:
Solve this system
y usingg Gauss Elimination :

0.0003x − 3y = 2.0001
x+y =1

S l ti
Solution:
Sure p
pivotingg is an essential
x = 0.333
y = 0.667

Dr Ali Jawarneh 20
Gauss Jordan
Gauss-Jordan
The Gauss‐Jordan method is a variation of Gauss elimination. The major
difference is that when an unknown is eliminated in the Gauss‐jordan
method, it is eliminated from all other equations rather than just the
subsequent ones. In addition, all rows are normalized by dividing them by
their p
pivot elements. Thus,, the elimination step
p results in an identityy matrix
rather than a triangular matrix. Consequently, it is not necessary to employ
back substitution to obtain the solution.

The elimination step results in an identity


matrix rather than a triangular matrix
matrix.

Dr Ali Jawarneh 21
Example: 3x − 0.1y − 0.2z − 7.85 = 0
Solve this system
y usingg Gauss ‐Jordan :
7 y + 0.1x − 0.3z = −19.3
Solution: − 0.2y + 0.3x − 71.4 = −10z
⎡ 3 − 0.1 − 0.2 7.85 ⎤
⎢ 0 .1 7 − 0 . 3 − 19 . 3 ⎥
⎢ ⎥
⎢⎣0.3 − 0.2 10 71.4 ⎥⎦
Normalize the 1st row by dividing by the pivot element “3”
⎡ 1 − 0.0333333 − 0.066667 2.61667⎤
⎢ 0.1 7 − 0.3 − 19.3 ⎥
⎢ ⎥
⎢⎣0.3 − 0.2 10 71.4 ⎥⎦

⎡1 − 0.0333333 − 0.066667 2.61667 ⎤


R2‐(a21/a11)R1 ⎢0 ⎥
⎢ 7 .003333 − 0.293333 − 19.5617 ⎥
⎢⎣0 − 0.19000 10.02 70.615 ⎥⎦
R3‐(a31/a11)R1
Dr Ali Jawarneh 22
Normalize the 2nd row by dividing by the pivot element “7.003333”

⎡1 − 0.0333333 − 0.066667 2.61667 ⎤


⎢0 1 − 0.0418848 − 2.7932 ⎥
⎢ ⎥
⎢⎣0 − 0.19000 10.02 70.615 ⎥⎦

⎡1 − 0.0333333 − 0.066667 2.61667 ⎤


⎢0 1 − 0.0418848 − 2.7932 ⎥
⎢ ⎥
⎣⎢0 0 10.0120 70.08429⎥⎦
R3‐(a32/a22)R2

Normalize the 3rd row by dividing by the pivot element “10.012”

⎡1 − 0.0333333 − 0.066667 2.61667 ⎤ R1-(a


( 13/a33))R3
⎢0 1 − 0.0418848 − 2.7932 ⎥
⎢ ⎥ R2-(a23/a33)R3
⎢⎣0 0 1 7 ⎥⎦

Dr Ali Jawarneh 23
⎡1 − 0.0333333 0 3.083338⎤ R1-(a12/a22)R2
⎢0 1 0 − 2 .5 ⎥
⎢ ⎥
⎢⎣0 0 1 7 ⎥⎦

⎡1 0 0 3 ⎤
⎢0 1 0 − 2.5⎥
⎢ ⎥
⎢⎣0 0 1 7 ⎥⎦
x=3
x 3
y=-2.5
z=7
7
Dr Ali Jawarneh 24

You might also like