Download - LINEAR EQUATIONS SYSTEMS 2
-
8/9/2019 LINEAR EQUATIONS SYSTEMS 2
1/35
NUMERICAL METHODS
From University of Michigan , department of atmospheric,
oceanic and spaces sciences
-
8/9/2019 LINEAR EQUATIONS SYSTEMS 2
2/35
LINEAR EQUATIONS SYSTEMSSOLUTION OF LINEAR EQUATIONS SYSTEMS
DIRECT METHODS
(1)Crammers Rules
Given a system of linear equations, Cramer's Rule is a
handy way to solve for just one of the variables withouthaving to solve the whole system of equations. They don't
usually teach Cramer's Rule this way, but this is supposed
to be the point of the Rule: instead of solving the entire
system of equations, you can use Cramer's to solve for justone single variable.
(1)http://www.purplemath.com/modules/cramers.htm
-
8/9/2019 LINEAR EQUATIONS SYSTEMS 2
3/35
LINEAR EQUATIONS SYSTEMSSOLUTION OF LINEAR EQUATIONS SYSTEMS
(1)Crammers RulesExample: Use the crammers rules to solve:We have the left-hand side of the system with the variables (the
"coefficient matrix") and the right-hand side with the answer values.
Let D be the determinant of the coefficient matrix of the abovesystem, and let Dx be the determinant formed by replacing the x-
column values with the answer-column values:
2x+ y+ z = 3
x y z = 0
x+ 2y+ z = 0
System of
equations
Coefficient matrix's
determinant
Answer column Dx:coefficient
determinant with answer-column values in x-column
2 x + 1 y + 1 z = 3
1x 1y 1 z = 0
1x + 2y + 1z = 0
-
8/9/2019 LINEAR EQUATIONS SYSTEMS 2
4/35
LINEAR EQUATIONS SYSTEMSSOLUTION OF LINEAR EQUATIONS SYSTEMS
(1)Crammers RulesExample: (Cont)Similarly, Dy and Dz would then be:
Evaluating each determinant, we get:
-
8/9/2019 LINEAR EQUATIONS SYSTEMS 2
5/35
LINEAR EQUATIONS SYSTEMSSOLUTION OF LINEAR EQUATIONS SYSTEMS
(1)Crammers RulesExample: (Cont)Cramer's Rule says thatx = Dx D, y = Dy D, and z = Dz D.
That is:x = 3/3 = 1, y = 6/3 = 2, and z = 9/3 = 3
(2)For more than three equations, Cramer's rule becomes
impractical because, as the number of equations increases, thedeterminants are time consuming to evaluate by hand (or
computer). So using other more efficient alternatives.
(2)Steven c. Chapra, Numerical Methods for Engineers. Fifth Edition Chapter 9.
-
8/9/2019 LINEAR EQUATIONS SYSTEMS 2
6/35
LINEAR EQUATIONS SYSTEMSSOLUTION OF LINEAR EQUATIONS SYSTEMS
(3)Elimination of UnknownsThe elimination of unknowns by combining equations is an algebraic
approach that can be illustrated for a set of two equations:
a11 x1 + a12x2 = b1 (1)
a21 x1 + a22x2 = b2 (2)
The basic strategy is to multiply the equations by constants so that
will be eliminated when two equations are combined. The result is
a single equation that can be solved for remaining unknown. Thisvalue can be substituted into either of the original equations to
compute the other variable.
(3)Steven c. Chapra, Numerical Methods for Engineers. Fifth Edition Chapter 9.
-
8/9/2019 LINEAR EQUATIONS SYSTEMS 2
7/35
LINEAR EQUATIONS SYSTEMSSOLUTION OF LINEAR EQUATIONS SYSTEMS
(3)Elimination of UnknownsFor example, equation (1) might be multiplied by a21 and Equation
(2) by a11 to give
a21 a11 x1 + a12 a12x2 = a21 b1 (3)
a11a21 x1 + a11 a22x2 = a11 b2 (4)
Subtracting equation (3) from (4) will, therefore eliminate the X1term from the equations to yield
a22 a11 x2 - a12 a21x2 = a21 b2 - b1a21 (5)
Which can be solved for
(6)
21122211
121211
2
aaaa
babax
Equation (6) can be substituted intoeq (1) which can be solved for
21122211
212122
1
aaaa
babax
-
8/9/2019 LINEAR EQUATIONS SYSTEMS 2
8/35
LINEAR EQUATIONS SYSTEMSSOLUTION OF LINEAR EQUATIONS SYSTEMS
(3)Elimination of UnknownsExample: Use the Elimination of Unknowns to solve:
Solution. Using equations (6) and (7)
22
1823
21
21
xx
xx
4)1(2)2(3)2(2)18(2
1
x 3)1(2)2(3
18)1()2(32
x
-
8/9/2019 LINEAR EQUATIONS SYSTEMS 2
9/35
LINEAR EQUATIONS SYSTEMSSOLUTION OF LINEAR EQUATIONS SYSTEMS
(4)Gauss MethodA method to solve simultaneous linear equations of the form
[A][X]=[C]
Two steps
1. Forward Elimination2. Back Substitution
(4)http://numericalmethods.eng.usf.edu
-
8/9/2019 LINEAR EQUATIONS SYSTEMS 2
10/35
LINEAR EQUATIONS SYSTEMSSOLUTION OF LINEAR EQUATIONS SYSTEMS
(4)Gauss Method
1. Forward Elimination: The goal of forward elimination is
to transform the coefficient matrix into an upper
triangular matrix
2.279
2.177
8.106
112144
1864
1525
3
2
1
x
x
x
735.0
21.96
8.106
7.000
56.18.40
1525
3
2
1
x
x
x
-
8/9/2019 LINEAR EQUATIONS SYSTEMS 2
11/35
LINEAR EQUATIONS SYSTEMSSOLUTION OF LINEAR EQUATIONS SYSTEMS
(4)Gauss Method1. Forward Elimination: A set of n equations and n
unknowns
(1)
(2)
(n)
11313212111 ... bxaxaxaxa nn
22323222121... bxaxaxaxa nn
nnnnnnn bxaxaxaxa ...332211
. .
. .
. .
(n-1) steps of forward elimination
-
8/9/2019 LINEAR EQUATIONS SYSTEMS 2
12/35
LINEAR EQUATIONS SYSTEMSSOLUTION OF LINEAR EQUATIONS SYSTEMS
(4)Gauss Method1. Forward Elimination:
Step 1. For Equation 2, divide Equation 1 by and
multiply by .
)...(11313212111
11
21 bxaxaxaxaa
ann
1
11
21
1
11
21
212
11
21
121... b
aaxa
aaxa
aaxa
nn
-
8/9/2019 LINEAR EQUATIONS SYSTEMS 2
13/35
LINEAR EQUATIONS SYSTEMSSOLUTION OF LINEAR EQUATIONS SYSTEMS
(4)Gauss Method1. Forward Elimination:
Subtract the result from Equation 2.
1
11
21
21
11
21
2212
11
21
22 ... ba
a
bxaa
a
axaa
a
a nnn
'
2
'
22
'
22
... bxaxann
22323222121 ... bxaxaxaxa nn
_________________________________________________
or
1
11
21
1
11
21
212
11
21
121... b
aaxa
aaxa
aaxa nn
-
8/9/2019 LINEAR EQUATIONS SYSTEMS 2
14/35
LINEAR EQUATIONS SYSTEMSSOLUTION OF LINEAR EQUATIONS SYSTEMS
(4)Gauss Method1. Forward Elimination:
Repeat this procedure for the remaining equations to
reduce the set of equations as
11313212111 ... bxaxaxaxa nn '
2
'
23
'
232
'
22 ... bxaxaxa nn '
3
'
33
'
332
'
32 ... bxaxaxa nn
''
3
'
32
'
2 ... nnnnnn bxaxaxa
End of Step 1
. . .
. . .
. . .
-
8/9/2019 LINEAR EQUATIONS SYSTEMS 2
15/35
LINEAR EQUATIONS SYSTEMSSOLUTION OF LINEAR EQUATIONS SYSTEMS
(4)Gauss Method1. Forward Elimination:
Step 2. Repeat the same procedure for the 3rd term of
Equation 3.
11313212111 ... bxaxaxaxa nn '
2
'
23
'
232
'
22... bxaxaxa nn
"
3
"
33
"
33...
bxaxa nn
""
3
"
3 ... nnnnn bxaxa
. .
. .
. .
End of Step 2
Q O S S S S
-
8/9/2019 LINEAR EQUATIONS SYSTEMS 2
16/35
LINEAR EQUATIONS SYSTEMSSOLUTION OF LINEAR EQUATIONS SYSTEMS
(4)Gauss Method1. Forward Elimination:
At the end of (n-1) Forward Elimination steps, the system
of equations will look like
'
2
'
23
'
232
'
22 ... bxaxaxa nn
"
3
"
33
"
33... bxaxa nn
11 n
nn
n
nn bxa
. .. .. .
11313212111 ... bxaxaxaxa nn
End of Step (n-1)
LINEAR EQUATIONS SYSTEMS
-
8/9/2019 LINEAR EQUATIONS SYSTEMS 2
17/35
LINEAR EQUATIONS SYSTEMSSOLUTION OF LINEAR EQUATIONS SYSTEMS
(4)Gauss Method1. Forward Elimination:
Matrix Form at End of Forward Elimination
)(n-n
"
'
n
)(n
nn
"
n
"
'
n
''
n
b
b
bb
x
x
xx
a
aa
aaaaaaa
1
3
2
1
3
2
1
1
333
22322
1131211
0000
00
0
-
8/9/2019 LINEAR EQUATIONS SYSTEMS 2
18/35
LINEAR EQUATIONS SYSTEMS
-
8/9/2019 LINEAR EQUATIONS SYSTEMS 2
19/35
LINEAR EQUATIONS SYSTEMSSOLUTION OF LINEAR EQUATIONS SYSTEMS
(4)Gauss Method2. Back Substitution:
Back Substitution Starting Eqns
'
2
'
23
'
232
'
22 ... bxaxaxa nn
"
3
"
3
"
33 ... bxaxa nn
11 n
nn
n
nn bxa
11313212111 ... bxaxaxaxa nn
LINEAR EQUATIONS SYSTEMS
-
8/9/2019 LINEAR EQUATIONS SYSTEMS 2
20/35
LINEAR EQUATIONS SYSTEMSSOLUTION OF LINEAR EQUATIONS SYSTEMS
(4)Gauss Method2. Back Substitution:
Start with the last equation because it has only one
unknown
1,...,1for
1
1
11
nia
xab
xi
ii
n
ijj
i
ij
i
i
i
)1(
)1(
n
nn
n
n
n a
b
x
1,...,1for...
1
1
,2
1
2,1
1
1,
1
ni
a
xaxaxabx
i
ii
n
i
nii
i
iii
i
ii
i
i
i
LINEAR EQUATIONS SYSTEMS
-
8/9/2019 LINEAR EQUATIONS SYSTEMS 2
21/35
LINEAR EQUATIONS SYSTEMSSOLUTION OF LINEAR EQUATIONS SYSTEMS
(5) Gauss-Jordan MethodIs a variant of Gaussian Elimination. Again, we are
transforming the coefficient matrix into another matrix
that is much easier to solve, and the system represented
by the new augmented matrix has the same solution setas the original system of linear equations. In Gauss-Jordan
Elimination, the goal is to transform the coefficient matrix
into a diagonal matrix, and the zeros are introduced into
the matrix one column at a time. We work to eliminate
the elements both above and below the diagonal element
of a given column in one pass through the matrix.
(5)http://ceee.rice.edu/Books/CS/chapter2/linear44.html
LINEAR EQUATIONS SYSTEMS
-
8/9/2019 LINEAR EQUATIONS SYSTEMS 2
22/35
LINEAR EQUATIONS SYSTEMSSOLUTION OF LINEAR EQUATIONS SYSTEMS
(5) Gauss-Jordan MethodSteps:
Step1. Write the augmented matrix for the system of
linear equations.
LINEAR EQUATIONS SYSTEMS
-
8/9/2019 LINEAR EQUATIONS SYSTEMS 2
23/35
LINEAR EQUATIONS SYSTEMSSOLUTION OF LINEAR EQUATIONS SYSTEMS
(5) Gauss-Jordan MethodStep 2.Use elementary row operations on the augmented
matrix [A|b] to transformA into diagonal form.
-
8/9/2019 LINEAR EQUATIONS SYSTEMS 2
24/35
LINEAR EQUATIONS SYSTEMS
-
8/9/2019 LINEAR EQUATIONS SYSTEMS 2
25/35
LINEAR EQUATIONS SYSTEMSSOLUTION OF LINEAR EQUATIONS SYSTEMS
LU Decomposition(6)The LU-decomposition method first "decomposes"
matrix A into A = L.U, where L and U are lower triangular
and upper triangular matrices, respectively. More
precisely, if A is a nn matrix, L and U are also nnmatrices with forms like the following:
33
2322
131211
3231
21
00
0
1
01
001
u
uu
uuu
ULA
(6) http://www.cs.mtu.edu/~shene/COURSES/cs3621/NOTES/INT-APP/CURVE-linear-
system.html
LINEAR EQUATIONS SYSTEMS
-
8/9/2019 LINEAR EQUATIONS SYSTEMS 2
26/35
LINEAR EQUATIONS SYSTEMSSOLUTION OF LINEAR EQUATIONS SYSTEMS
LU Decomposition(7)How does LU Decomposition work?
If solving a set of linear equations
If [A] = [L][U] then
Multiply by
Which gives
Remember [L]-1[L] = [I] which leads to
Now, if [I][U] = [U] then
Now, let
Which ends with
and
[A][X] = [C]
[L][U][X] = [C]
[L]-1
[L]-1[L][U][X] = [L]-1[C]
[I][U][X] = [L]-1[C]
[U][X] = [L]
-1
[C][L]-1[C]=[Z]
[L][Z] = [C] (1)
[U][X] = [Z] (2)
(7)http://numericalmethods.eng.usf.edu
LINEAR EQUATIONS SYSTEMS
-
8/9/2019 LINEAR EQUATIONS SYSTEMS 2
27/35
LINEAR EQUATIONS SYSTEMSSOLUTION OF LINEAR EQUATIONS SYSTEMS
LU Decomposition(7)Steps:
Step 1. Finding the [U] matrix: Using the Forward EliminationProcedure of Gauss Elimination
2279
21778106
112144
18641525
3
2
1
.
.
.
x
xx
112144
56.18.40
1525
56.212;56.225
64
RowRow
76.48.160
56.18.40
1525
76.513;76.525
144
RowRow
Step a.
LINEAR EQUATIONS SYSTEMS
-
8/9/2019 LINEAR EQUATIONS SYSTEMS 2
28/35
LINEAR EQUATIONS SYSTEMSSOLUTION OF LINEAR EQUATIONS SYSTEMS
LU Decomposition(7)Steps:
Step 1. Finding the [U] matrix:
Step b:
76.48.160
56.18.40
1525
7.000
56.18.40
1525
5.323;5.38.4
8.16
RowRow
7.000
56.18.40
1525
U
Matrix after Step a:
LINEAR EQUATIONS SYSTEMS
-
8/9/2019 LINEAR EQUATIONS SYSTEMS 2
29/35
LINEAR EQUATIONS SYSTEMSSOLUTION OF LINEAR EQUATIONS SYSTEMS
LU Decomposition(7)Steps:
Step 2. Finding the [L] matrix: Using the multipliers usedduring the Forward Elimination Procedure
From the step a of
forward elimination
56.225
64
11
21
21
a
a
76.525
144
11
31
31
a
a
112144
1864
1525
LINEAR EQUATIONS SYSTEMS
-
8/9/2019 LINEAR EQUATIONS SYSTEMS 2
30/35
LINEAR EQUATIONS SYSTEMSSOLUTION OF LINEAR EQUATIONS SYSTEMS
LU Decomposition(7)Steps:
Step 2. Finding the [L] matrix:
15.376.5
0156.2
001
L
From the step b offorward elimination
76.48.160
56.18.40
15255.3
8.4
8.16
22
32
32
a
a
LINEAR EQUATIONS SYSTEMS
-
8/9/2019 LINEAR EQUATIONS SYSTEMS 2
31/35
LINEAR EQUATIONS SYSTEMSSOLUTION OF LINEAR EQUATIONS SYSTEMS
LU Decomposition(7)Steps:
Step 3.
[L][Z] = [C]
Solve for [Z]
2.279
2.177
8.106
15.376.5
0156.2
001
3
2
1
z
z
z
2.2795.376.5
2.17756.2
10
321
21
1
zzz
zz
z
LINEAR EQUATIONS SYSTEMS
-
8/9/2019 LINEAR EQUATIONS SYSTEMS 2
32/35
LINEAR EQUATIONS SYSTEMSSOLUTION OF LINEAR EQUATIONS SYSTEMS
LU Decomposition(7)Steps:
Step 3.
735.0
21.965.38.10676.52.279
5.376.52.279
2.96
8.10656.22.177
56.22.177
8.106
213
12
1
zzz
zz
z
735.0
21.96
8.106
3
2
1
z
z
z
Z
LINEAR EQUATIONS SYSTEMS
-
8/9/2019 LINEAR EQUATIONS SYSTEMS 2
33/35
LINEAR EQUATIONS SYSTEMSSOLUTION OF LINEAR EQUATIONS SYSTEMS
LU Decomposition(7)Steps:
Step 4.
[U][X] = [Z]
Solve for [X] The 3 equations become
7350
2196
8106
7.00056.18.40
1525
3
2
1
..
.
xx
x
735.07.0
21.9656.18.4
8.106525
3
32
321
a
aa
aaa
LINEAR EQUATIONS SYSTEMS
-
8/9/2019 LINEAR EQUATIONS SYSTEMS 2
34/35
LINEAR EQUATIONS SYSTEMSSOLUTION OF LINEAR EQUATIONS SYSTEMS
LU Decomposition(7)Steps:
Step 4.
From the 3rd equation
050170
7350
735070
3
3
3
.a.
.a
.a.
Substituting in a3 and using the
second equation
21965618432 .a.a.
7019
84
05015612196
84
5612196
2
2
3
2
.a
.
...a
.
a..a
LINEAR EQUATIONS SYSTEMS
-
8/9/2019 LINEAR EQUATIONS SYSTEMS 2
35/35
LINEAR EQUATIONS SYSTEMSSOLUTION OF LINEAR EQUATIONS SYSTEMS
LU Decomposition(7)Steps:
Step 4.
Substituting in a3
and a2using the first equation
8106525321 .aaa
Hence the SolutionVector is:
050.170.19
2900.0
3
2
1
aa
a
29000
25
0501701958106
2558106 32
1
.
...
aa.a