Beruflich Dokumente
Kultur Dokumente
Lecture 4
SOLVING SYSTEMS OF LINEAR EQUATIONS
Contents of lecture:
a. Graphical method
b. Direct method
c. Indirect method
1
A Linear Equation representation
a. Graphical solution is the point of intersection of the two lines for simple
systems
x + 2y =1
unique Solution x + 2y =1
2x + 4y = 4 No Solution Infinite Solutions
10
2x + 4y = 2
9
Graphical 8method for LE
7 Y1
6 versu X
5
4
3
2
Y (Axis)
1
0
-10-9 -8 -7 -6 -5 -4 -3 -2-1-1 0 1 2 3 4 5 6 7 8 9 10
-2
-3
-4
-5
-6 X=3, y=-1
-7
-8
-9
X (Axis)
-10 2
10
x y1 y2 9
Graphical method for LE
-10 5.5 -14
8
-8 4.5 -12
-6 3.5 -10 7
-4 2.5 -8 6
-2 1.5 -6 5
0 0.5 -4
4
2 -0.5 -2
3
4 -1.5 0
6 -2.5 2 2
8 -3.5 4 1
Y (Axis)
10 -4.5 6 0
-10 -9 -8 -7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7 8 9 10
-1
-2
-3
-4 Y1 versu X
-5
Y2 versus X
-6
-7
-8
-9
-10
X (Axis)
3
System of linear algebraic
Have a general equations that are of the form
5
Summary of Operating rules that govern matrix
• Two n by m matrices are equal if, and only if, every element in the
first is equal to every element in the second, that is, [A] = [B] if aij
= bij for all i and j.
• Addition and subtraction of two matrices, say, [A] and [B], is
accomplished by adding and subtraction of corresponding terms
respectively in each matrix. The elements of the resulting matrix
[C] are computed as:
• cij = aij + bij ; dij = eij – fij
7
Determinant and rank
Both these terms are equivalent, but it is much easier to evaluate a
rank of a matrix rather than to evaluate a determinant of a matrix
for a larger size systems.
9
Linear equation solution methods
• There are several methods which directly used to solve
equation. Prominent among these are direct methods:
Cramer’s rule,
Gaussian elimination,
Gauss-Jordan method and
LU decomposition.
• Another class of method for solving linear equations is
known as indirect method (iterative methods).
• By this approach, we starts from any initial guess, say x(0),and
generate an improved estimate x(k+1) from previous approximation
x(k).
Jacobi Method
Gauss-Seidel Method etc.
10
Cramer’s Rule method of solution finding
(The Determinant Method)
12
Step to apply Gaussian elimination method.
a11 a12 a1n b1
a21 a22 a23 b2
1. Create augmented matrix
an1 an 2 ann bn
2. Elimination
1st round elimination
21=a21/a11, 31=a31/a11, 41=a41/a11………, n1=an1/a11
R21=R20- 21R10, R31=R30- 31R10, R41=R40- 41R10,…, Rn1=Rn0-n1R10
2nd round elimination
32=a32/a22, 42=a42/a22,….. , n2=an2/a22
R32=R31- 32R21, R42=R41- 42R21,…., Rn2=Rn1- n2R21
3rd round elimination
43=a43/a33,
R43=R42- 43R32,………., Rn3=Rn2- n2R32
3. Then finally back substitution
13
Cont’d
14
15
16
Example
x1 x2 x3 4
2 x1 x2 3x3 7
3x1 4 x2 2 x3 9
17
Are there any pitfalls of Naïve Gauss Elimination Method?
Division by zero:
It is possible that division by zero may occur during forward
elimination steps. For example for the set of equations
Round-off error:
Naive Gauss Elimination Method is prone to round-off errors. This is
true when there are large numbers of equations as errors propagate.
Also, if there is subtraction of numbers from each other, it may create
large errors.
19
Step to apply Gaussian elimination with pivoting method.
a11 a12 a1n b1
1. Create augmented matrix
a21 a22 a23 b2
2. Elimination
an1 an 2 ann bn
Check the first indices of all rows, and take the row with the highest absolute value
of the 1st indices to interchange with raw 1.
1st round elimination
21=a21/a11, 31=a31/a11, 41=a41/a11………, n1=an1/a11
R21=R20- 21R10, R31=R30- 31R10, R41=R40- 41R10,……, Rn1=Rn0- n1R10
2nd round elimination
Check the 2nd indices of all rows below Row2, and take the row with the highest
absolute value of the 2nd indices to interchange with raw 2 .
32=a32/a22, 42=a42/a22,….. , n2=an2/a22
R32=R31- 32R21, R42=R41- 42R21,…., Rn2=Rn1- n2R21
3rd round elimination
43=a43/a33,
R43=R42- 43R32,………., Rn3=Rn2- n2R32
Check the 3rd indices of all rows below Row3, and take the row with the highest absolute
value of the 3rd indices to interchange with raw 3.
3. Then finally back substitution 20
a11 a12 a1n b1
Matrix Form at Beginning of
a21 a22 a23 b2
2nd Step of Forward Elimination
an1 an 2 ann bn
21
Back Substitution Starting Eqns.
Back Substitution
Example
x1 x2 x3 4
2 x1 x2 3 x3 7
3 x1 4 x2 2 x3 9
22
direct method : 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 pivot elements.
• Thus, the elimination step results in an identity matrix
rather than a triangular matrix
• Consequently, it is not necessary to employ back
substitution to obtain the solution.
23
Cont’d
Starting from a system Ax=b of the general form
Example
1 0 0 ... 0
0 1 0 ... 0
0 0 ... 1 0
0 0 0 1 24
direct method :LU Decomposition
• LU Decomposition is another method to solve a set of
simultaneous linear equations
• Which is better, Gauss Elimination or LU Decomposition?
• To answer this, a closer look at LU decomposition is
needed.
Method
• For most non-singular matrix [A] that one could conduct
Naïve Gauss Elimination forward elimination steps, one
can always write it as:
[A] = [L][U]
• Where [L] = lower triangular matrix
[U] = upper triangular matrix
25
How does LU Decomposition work?
26
Example: Solve the following equation by using:
27
Iterative method (indirect method)
Indirect method is consists:
Jacobi Method
Gauss-Seidel Method and etc.
28
Iterative Methods (Example)
E1 : 10 x1 x 2 2 x3 6
E2 : x1 11x2 x3 3x4 25
E3 : 2 x1 x2 10 x3 x 4 11
E4 : 3 x 2 x3 8 x 4 15