Professional Documents
Culture Documents
8 Systems PDF
8 Systems PDF
8 Systems PDF
able to:
Solve systems of equations using
gaussian elimination or gauss-jordan
elimination.
Solve systems of equations using gauss-
seidel or gauss-jacobi.
Solve non linear systems of equations
Naïve Gaussian
Elimination
A system of equations is a collection of two or more
equations with a same set of unknowns.
In solving a system of equations, we try to find
values for each of the unknowns that will satisfy
every equation in the system.
The equations in the system can be linear or non-
linear.
The problem can be expressed in narrative form or
the problem can be expressed in algebraic form.
Example of a narrative statement of a system of
the equations:
The air-mail rate for letters to Europe is 45
cents per half-ounce and to Africa as 65 cents
per half-ounce. If Shirley paid $18.55 to send
35 half-ounce letters abroad, how many did she
send to Africa?
Example of an algebraic statement of the same
system of the equations:
0.45 x 0.65 y 18.55
x y 35
A method to solve simultaneous linear equations of
the form [A][X]=[C]
Two steps
1. Forward Elimination
2. Back Substitution
The goal of forward elimination is to transform
the coefficient matrix into an upper triangular
matrix
25 5 1 x1 106.8
64 8 1 x 177.2
2
144 12 1 x3 279.2
25 5 1 x1 106.8
0 4.8 1.56 x 96.21
2
0 0 0.7 x3 0.735
A set of n equations and n unknowns
a11x1 a12 x2 a13 x3 ... a1n xn b1
a21x1 a22 x2 a23 x3 ... a2 n xn b2
. .
. .
. .
an1x1 an 2 x2 an3 x3 ... ann xn bn
a21
a (a11x1 a12 x2 a13 x3 ... a1n xn b1 )
11
a21 a21 a21
a21x1 a12 x2 ... a1n xn b1
a11 a11 a11
Subtract the result from Equation 2.
a21x1 a22 x2 a23 x3 ... a2 n xn b2
a21 a21 a21
− a21x1 a a12 x2 ... a a1n xn a b1
_________________________________________________
11 11 11
or a x ... a x b
'
22 2
'
2n n
'
2
Repeat this procedure for the remaining
equations to reduce the set of equations
as a11x1 a12 x2 a13 x3 ... a1n xn b1
'
a22 x2 a23
'
x3 ... a2' n xn b2'
'
a32 x2 a33
'
x3 ... a3' n xn b3'
. . .
. . .
. . .
End of Step 1
Step 2:
Repeat the same procedure for the 3rd
term of Equation 3.
a11x1 a12 x2 a13 x3 ... a1n xn b1
'
a22 x2 a23
'
x3 ... a2' n xn b2'
"
a33 x3 ... a3" n xn b3"
. .
. .
. .
n 1 n 1
ann xn bn
0 0 0 0 ann xn bn
(n1 )
(n-1 )
Back Substitution
Solve each equation starting from the last
equation
( n 1)
b
xn n
( n 1)
a nn
Back Substitution
bn( n 1)
x n ( n 1)
a nn
Forward Elimination
Back Substitution
Forward Elimination: Step 1
25 5 1 106.8
64 8 1 177.2
144 12 1 279.2
Divide Equation
.
1 by 25 and
multiply it by 144,
Subtract the result from
144 12 1 279.2
144 5.76 615.168
Equation 3
28.8
0 16.8 4.76 335.968
25 106.8
Substitute new equation for
5 1
Equation 3 0 4.8 1.56 96.208
0 16.8 4.76 335.968
Forward Elimination:
25 5 1 106.8
0 4.8 1.56 96.208
0 16.8 4.76 335.968
Solving for a3
0.7a 3 0.76
0.76
a3
0 .7
a 3 1.08571
Back Substitution
25 5 1 a1 106.8
0 4.8 1.56 a
2 96.208
0 0 0.7 a 3 0.76
Solving for a2
25a1 5a 2 a 3 106.8
106.8 5a 2 a 3
a1
25
106.8 5 19.6905 1.08571
25
0.290472
Solution:
a1 0.290472
The solution
a 19.6905
2
vector is a 3 1.08571
10 x 2 7 x 3 3
6 x1 2 x 2 3 x 3 11
5 x1 x 2 5 x 3 9
0 10 7 x1 3
6 2 3 x 2 11
5 1 5 x 3 9
Is division by zero an issue here?
12 x1 10 x2 7 x3 15
6 x1 5 x2 3 x3 14
5 x1 x2 5 x3 9
12 10 7 x1 15
6 5
3 x2 14
5 1 5 x3 9
12 x1 10 x2 7 x3 15
6 x1 5 x2 3 x3 14
24 x1 x2 5 x3 28
20 15 10 x1 45
3 2.249 7 x 1.751
2
5 1 3 x3 9
x1 1
x 1
2 Exact Solution
x3 1
Pitfall#2. Large Round-off Errors
20 15 10 x1 45
3 2.249 7 x 1.751
2
5 1 3 x3 9
Switched Rows
Forward Elimination
Same as naïve Gauss elimination
method except that we switch rows
before each of the (n-1) steps of
forward elimination.
Solve the following set of equations by
Gaussian elimination with partial pivoting
25 5 1 a1 106.8
64 8 1 a 2 177.2
144 12 1 a3 279.2
25 5 1 a1 106.8 25 5 1 106.8
64 8 1 a 177.2
2 64 8 1 177.2
144 12 1 a3 279.2 144 12 1 279.2
Forward Elimination
Back Substitution
Examine absolute values of first column,
first row and below.
Largest absolute value is 144 and exists
in row 3. Switch row 1 and row 3.
144 12 1 279.2
0 2.667 0.5556 53.10
0 2.917 0.8264 58.33
Forward Elimination:
Examine absolute values of second
column, second row and below.
Largest absolute value is 2.917 and exists
in row 3. Switch row 2 and row 3.
144 12 1 279.2 144 12 1 279.2
0 2.667 0.5556 53.10 0 2.917 0.8264 58.33
0 2.917 0.8264 58.33 0 2.667 0.5556 53.10
Forward Elimination:
144 12 1 279.2
0 2.917 0.8264 58.33
0 2.667 0.5556 53.10
.
144 12 1 279.2
0 2.917 0.8264 58.33
0 0 0.2 0.23
Back Substitution
144 12 1 279.2 144 12 1 a1 279.2
0 2.917 0.8264 58 .33 0 2 .917 0 .8264 a
2 58 .33
0 0 0.2 0.23 0 0 0 .2 a 3 0 .23
Solving for a3
0.2a 3 0.23
0.23
a3
0.2
1.15
Back Substitution
Solving for a2
2.917a 2 0.8264a 3 58.33
58.33 0.8264a 3
a2
2.917
58.33 0.8264 1.15
2.917
19.67
Back Substitution
Solving for a1
144a1 12a 2 a 3 279.2
279.2 12a 2 a 3
a1
144
279.2 12 19.67 1.15
144
0.2917
25 5 1 a1 106.8
64
8 1 a
2 177 .2
144 12 1 a 3 279.2
a1 0.2917
a 2 19.67
a 3 1.15
Example:
Use Naïve Gauss elimination to solve
20 x1 15 x 2 10 x 3 45
3 x1 2.249x 2 7 x 3 1.751
5 x1 x 2 3 x 3 9
25 5 1
64 8 1
144 12 1
After forward elimination
25 5 1 25 5 1
64 8 1 0 4.8 1.56
. 144 12 1 0 0 0.7
working downwards.
Matrices containing zeros below
each pivot are said to be in row
echelon form.
Gauss–Jordan elimination goes a
step further by placing zeros
above and below each pivot; such
matrices are said to be in reduced
row echelon form.
.
n
ci aij x j
j 1
j i
xi , i 1,2,, n.
aii
Solve for the unknowns x1
x
Assume an initial guess for [X] 2
xn -1
xn
xinew xiold
a i new
100
xi
3.6720 1.0000
a 1 x100 72.76%
3.6720
7.8510 2.0000
a 2 x100 125.47%
7.8510
155.36 5.0000
a 3 x100 103.22%
155.36
At the end of the second iteration
a1 12.056
a
2 54. 882
a 3 798.54
x1 5 x 2 3 x 3 28
3 x1 7 x 2 13 x 3 76
76 30.50000 74.9000
x3 3.0923
13
The absolute relative approximate error
0.50000 1.0000
a 1 100 100.00%
0.50000
After Iteration #1
x1 0.5000
x
2 4 . 9000
x 3 3.0923
After Iteration #2
x1 0.14679
x
2 3 . 7153
x 3 3.8118
Repeating more iterations, the following values
are obtained
Iteration a1 a2 a3
3 7 13
A 1 5 3
12 3 5
12 3 5
A 1 5 3
3 7 13
Not every system of equations can be rearranged
to have a diagonally dominant coefficient matrix.
x1 x2 x3 3
2 x1 3x2 4 x3 9
x1 7 x2 x3 9
NONLINEAR SYSTEMS
At the end of the lecture, the student
must be able to:
solve nonlinear systems of
equations using Gauss-Seidel
method.
solve nonlinear systems of
equations using Newton-Raphson
method.
Nonlinear systems can be solved using
the same strategy as the Gauss-Seidel
method.
solve each system for one of the
unknowns and update each unknown
using information from the previous
iteration.
This is called successive
substitution.
Example:
Solve the given system:
2
x xy 10
2
y 3 xy 57
Answer: x 2 xy 10
y 3 xy 2 57
xn1 10 xn yn
57 yn
yn 1
3 xn
Answer: 2
x xy 10
2
y 3 xy 57
Initial guess:
x 0 1 .5
y 0 3 .5
Nonlinear systems may also be solved
using the Newton-Raphson method for
multiple variables.
For a two-variable system, we recall
the Taylor series approximation and
Newton-Raphson equation.
Recall: (for one equation, one unknown)
Find the root of f(x)=0
The 1st order Taylor series.
f xn 1 f xn f xn x n 1 xn
ui ui
x y
Jacobian
vi vi
x y
To facilitate memorization, we use
Jacobian matrix.
vi ui
ui vi
y y Solution for the two-
xi 1 xi equation version of the N-R Method
ui vi ui vi using Cramer’s rule.
x y y x
Determinant of the Jacobian
of the system.
ui vi
vi ui
yi 1 yi x x
ui vi ui vi
x y y x
Example:
2
Solve the given system: x xy 10
2
y 3 xy 57
Answer:
Rewrite the equations:
u x , y x 2 xy 10
v x , y y 3 xy 2 57
Answer:
Evaluate the derivatives:
u x , y x xy 10
2
v x , y y 3 xy 57
2
u v
2x y 3 y2
x x
u v
x 1 6 xy
y y
Answer:
Then substitute to the formula::
Exercise:
Solve the given system:
2 2
x y 8.5
2 2
x 3 xy y 2.75 0
x0 1 and y0 1
Numerical Methods Using Matlab, 4th Edition,
2004 by John H. Mathews and Kurtis K. Fink
Holistic Numerical Methods Institute by Autar
Kaw and Jai Pau.
Numerical Methods for Engineers by Chapra
and Canale
Systems of Nonlinear equations by Power
show.com