0% found this document useful (0 votes)
14 views46 pages

Lecture 2.2 Solution of Systems of Linear Equation

The document discusses systems of linear equations, defining their characteristics, types of solutions, and methods for solving them. It covers analytical methods such as graphical, substitution, and elimination methods, as well as numerical methods like Cramer's Rule and Gaussian elimination. The document emphasizes the classification of systems as consistent or inconsistent based on the existence of solutions.

Uploaded by

Eyob
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)
14 views46 pages

Lecture 2.2 Solution of Systems of Linear Equation

The document discusses systems of linear equations, defining their characteristics, types of solutions, and methods for solving them. It covers analytical methods such as graphical, substitution, and elimination methods, as well as numerical methods like Cramer's Rule and Gaussian elimination. The document emphasizes the classification of systems as consistent or inconsistent based on the existence of solutions.

Uploaded by

Eyob
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/ 46

Systems Of

Linear Equations

Eyob A.
Linear equations

• Linear equations have no products or roots of variables and no


variables involved in trigonometric, exponential or logarithmic
functions.

• Variables appear only to the first power. a1 x1 + a2 x2 + ... + an xn = b

Eyob A.
LINEAR EQUATION
▪ A system of linear equations has
1. No Solution, Or
2. Exactly One Solution, Or
3. Infinitely Many Solutions.

Eyob A.
Systems of Linear Equations

• A set of m equations, each of which is linear in the same n variables:


a11 x1 + a12 x2 + ... + a1n xn = b1
a21 x1 + a22 x2 + ... + a2 n xn = b2

am1 x1 + am 2 x2 + ... + amn xn = bm
• A system of linear equations has exactly one solution, an infinite number of
solutions, or no solution.
• A system of linear equations is called consistent if it has at least one
solution and inconsistent if it has no solution.
Eyob A.
Solving Systems of Linear Equations…Analytically

Numerical methods
Analytical Methods
1. Cramer’s Rule
1. Graphically Method 2. Gaussian Method
3. LU decomposition Method
2. Substitution Method
4. Jacobian Itration
3. Elimination Method 5. Guass Seidel Iteration

Eyob A.
Analytical Solutions To
Systems Of Linear Equation

1. Graphically Method

2. Substitution Method

3. Elimination Method

Eyob A.
• System of equations: A group of two or more equations.
• A system of linear equations consists of two or more linear equations.

 x+ y =5 (Equation 1)

3x − 4 y = 8 (Equation 2)

• Solution for a system of equations: An ordered pair that makes all


equations in the system true.

Eyob A.
1. Graphical Method
a. If the lines intersect at a single point, then the
coordinates of that point form the solution.

b. If the lines are parallel, there is no solution.

c. If the lines are identical, there are an infinite number of


solutions.

Eyob A.
1. Graphical Method
x + y = 5  y = 3x + 1 x + 2 y = 4
  
 y = 2x − 4  y = 3x − 2 2 x + 4 y = 8

The graphs intersect The equations have The graphs are


at a single point. the same slope, the identical. There are
There is one graphs are parallel. an infinite number
solution. There is no solution. of solutions.
(Not the same as all real numbers.)
Eyob A.
Classifying Systems of Equations
Consistent system with Consistent system with Inconsistent system:
independent equations: dependent equations:
The system has no solution.
The system has an infinite
The system has a single solution
number of solutions. The graphs are parallel lines.
at the point of intersection.
The graphs are identical. They have the same slope,
The graphs are different.
They have the same slope but different y-intercepts.
They have different slopes. and same y-intercept.

Eyob A.
2. Substitution Method
• Solve the system of equations using substitution.

4 x + 5 y = 8

x = 1− y

• Step 1: Isolate a variable in one equation.


The second equation is already solved for x.

• Step 2: Substitute 1 – y for x in the first equation.


4x + 5 y = 8
4(1 − y ) + 5 y = 8
Eyob A.
2. Substitution Method
4 x + 5 y = 8

x = 1− y
4(1 − y ) + 5 y = 8
• Step 3: Solve for y. 4 − 4y + 5y = 8
4+ y =8
y=4
Step 4: Solve for x by substituting 4 for y in one of
the original equations.

x = 1− y
x = 1− 4 The solution is (−3, 4).
x = −3
Eyob A.
2. Substitution Method
• Solve the system of equations using substitution.
3 x − y = − 4

 y = 3x − 5

• Substitute y = 3x – 5 into the first equation.


3 x − y = −4
3 x − (3 x − 5) = −4
3x − 3x + 5 = −4 False statement.
5 = −4

The system is inconsistent and has no solution.


Eyob A.
2. Substitution Method
• Solve the system of equations using substitution.
 y = 4 − 3x

 −6 x − 2 y = −8
• Substitute y = 4 – 3x into the second equation.
−6 x − 2 y = −8
−6 x − 2( 4 − 3 x) = −8
−6x − 8 + 6x = −8
−6x + 6x − 8 = −8
−8 = −8 True statement.
There are an infinite number of solutions.
Eyob A.
3. Elimination Method

• Multiply both equations by numbers

• Combine the two equations

• Eliminate one of the variables.

Eyob A.
3. Elimination Method
Example: Solve the following system of equations using the elimination method.
6x – 3y = –3 and 4x + 5y = –9
Multiply both sides of the first equation by 5 and the second equation by 3.
5(6x – 3y) = 5(–3) 3(4x + 5y) = 3(–9)
30x – 15y = –15 12x + 15y = –27
6x – 3y = –3 and 4x + 5y = –9
Combine the two resulting equations (eliminating the variable y).
30x – 15y = –15
12x + 15y = –27 x = –1 and y = –1
42x = –42

Our computations have produced the point (–1, –1).


Eyob A.
Numerical Solution To Systems
Of Linear Equation
1. Cramer’s Rule
2. Gaussian Method
3. LU decomposition Method
4. Jacobian Itration
5. Guass Seidel Iteration

Eyob A.
1. Cramer's Rule
• A method for solving linear simultaneous equations.

• It makes use of determinants

• Cramer’s Rule relies on determinants

Eyob A.
Coefficient Matrices
You can use determinants to solve a system of linear equations.
You use the coefficient matrix of the linear system.

Linear System Coeff Matrix


ax+by=e a b 
cx+dy=f c d 
 

Eyob A.
Considering Cramer’s Rule

a11 a12 a13 b1 a12 a13


 a11 a12 a13   x1   b1 
a D = a12 D1 = b2
a23   x2  = b2 
a22 a23 a22 a23
 21 a22
a13 a32 a33 b3 a32 a33
 a31 a32 a33   x3   b3 

a11 b1 a13 a11 a12 b1


D2 = a12 b2 a23 D3 = a12 a22 b2
If D  0, then the system has a unique solution
a13 b3 a33 a13 a32 b3
as shown below (Cramer's Rule).
D1 D2 D3
x1 = , x2 = , x3 =
D D D

Eyob A.
Solve the system:
Cramer’s Rule…Example 1 8x+5y= 2
The coefficient matrix 2x-4y= -10
8 5  8 5
= (−32) − (10) = −42
 2 − 4 2 −4
 
2 5
8 2
2 5 − 10 − 4 − 8 − ( −50) 42
2 − 10 x= = = =
− 10 − 4 y= − 42 − 42 − 42
x= − 42
− 42
8 2
2 − 10 − 80 − 4 − 84
y= = = =2
− 42 − 42 − 42

𝑺𝒐𝒍𝒖𝒕𝒊𝒐𝒏: (−𝟏, 𝟐) Eyob A.


Cramer’s Rule…Example 2
Consider the following equations:
2 x1 − 4 x2 + 5 x3 = 36  x1   36 
−3 x1 + 5 x2 + 7 x3 = 7  x  =  x2  and  B  =  7 
5 x1 + 3 x2 − 8 x3 = −31  x3   −31

 A x  =  B 
2 −4 5 36 −4 5
where
D = −3 5 7 = −336 D1 = 7 5 7 = −672
 2 −4 5  −31 −8
−8 3
 A =  −3 7 
5 3
5 

 5 3 −8 
 2 36 5 2 −4 36
D2 = −3 7 7 = 1008 D3 = −3 5 7 = −1344
5 −31 −8 5 3 −31
Eyob A.
Example 2

D1 −672
x1 = = =2
D −336
D2 1008
x2 = = = −3
D −336
D −1344
x3 = 3 = =4
D −336

Eyob A.
Solve the system : 3x - 2y + z = 9
Example 3 x + 2y - 2z = -5
x + y - 4z = -2

9 −2 1 3 9 1 3 −2 9
−5 2 −2 1 −5 −2 1 2 −5
−2 1 −4 −23 1 −2 −4 69 1 1 −2 0
x= = =1 y= = = −3 z= = =0
3 −2 1 −23 3 −2 1 −23 3 −2 1 −23
1 2 −2 1 2 −2 1 2 −2
1 1 −4 1 1 −4 1 1 −4

The solution is
(1, -3, 0)
Eyob A.
2. Gaussian Elimination

Transforms the problem into a triangular system

Consists of 2 steps

1. Forward Elimination of Unknowns.

2. Back Substitution
 25 5 1 25 5 1 
 64 8 1 →  0 − 4.8 − 1.56
  
144 12 1  0 0 0.7 

Eyob A.
2. Gaussian Elimination

• Systematically eliminate unknowns until only one unknown is left.


• Multiplied by a non-zero constant
• Substitute the result to the original equation

Eyob A.
2. Gaussian Elimination…Example 1

2x + 4 y − 2z = 2
4x + 9 y − 3z = 8
− 2 x − 3 y + 7 z = 10

Using the first equation to eliminate x from the next two equations

Eyob A.
2. Gaussian Elimination…Example 1

2x + 4 y − 2z = 2
y + z = 4
y + 5 z = 12

Using the second equation to eliminate y from the third equation

Eyob A.
2. Gaussian Elimination…Example 1
Using the second equation to eliminate y from the third equation

2x + 4 y − 2z = 2
y + z = 4
4z = 8

We now have a triangular system which is easily solved using a technique called
Backward-Substitution. 2x + 4 y − 2z = 2
y + z = 4
Eyob A. 4z = 8
Backward Substitution
2x + 4 y − 2z = 2
From the previous work, we have
y + z = 4
And substitute z in the first two equations z = 2
2x + 4 y − 4 = 2
y + 2 = 4
2x + 4 y − 4 = 2 z = 2
We can solve y y = 2
z = 2
And 𝑥 = −1
Eyob A.
3. LU Decomposition

Method
Conduct Naïve Gauss Elimination forward elimination steps [A] = [L][U]

Where,
[L] = lower triangular matrix
[U] = upper triangular matrix

Eyob A.
3. LU Decomposition

How can this be used?

Given [A][X] = [B]


1. Decompose [A] into [L] and [U]
2. Solve [L][Y] = [B] for [Y]
3. Solve [U][X] = [Z] for [X]

Eyob A.
3. LU Decomposition

1 0 0 u11 u12 u13 


A = LU  =  21 1 0  0 u 22 u 23 
 31  32 1  0 0 u 33 

[U] is the same as the coefficient matrix at the end of the forward elimination step.
[L] is obtained using the multipliers that were used in the forward elimination process

Eyob A.
Finding the [U] Matrix

25 5 1 
Matrix after Step 1:  0 − 4.8 − 1.56
 
 0 − 16.8 − 4.76

25 5 1 
− 16.8
Step 2: = 3.5; Row3 − Row2(3.5) =  0 − 4.8 − 1.56
− 4.8
 0 0 0.7 

25 5 1 
U  =  0 − 4.8 − 1.56
 0 0 0.7 
Eyob A.
Finding the [L] Matrix

25 5 1  a32 − 16.8


From the second step of  
0 − 4 . 8 − 1 . 56  32 = = = 3.5
forward elimination   a 22 − 4.8
 0 − 16.8 − 4.76

 1 0 0
L = 2.56 1 0
5.76 3.5 1

Eyob A.
3. LU Decomposition

 25 5 1  x1  106.8 
Solve the following set of linear  64 8 1  x  = 177.2 
equations using LU Decomposition    2  
144 12 1  x3  279.2

Using the procedure for finding the [L] and [U] matrices

 1 0 0 25 5 1 
A = LU  = 2.56 1 0  0 − 4.8 − 1.56
5.76 3.5 1  0 0 0.7 

Eyob A.
LU Decomposition… Example1
Complete the forward substitution to solve for [Z]
z1 = 106.8
z 2 = 177.2 − 2.56z1
= 177.2 − 2.56(106.8)  z1   106.8 
= −96.2 Z  =  z2  = − 96.21
z3 = 279.2 − 5.76z1 − 3.5 z 2  z3   0.735 
= 279.2 − 5.76(106.8) − 3.5(− 96.21)
= 0.735

Eyob A.
LU Decomposition… Example1
Set [U][X] = [Z]
25 5 1   x1   106.8 
 0 − 4.8 − 1.56  x  = − 96.21
   2  
 0 0 0.7   x3   0.735 

Solve for [X] The 3 equations become

25a1 + 5a2 + a3 = 106.8


− 4.8a2 − 1.56a3 = −96.21
0.7 a3 = 0.735
Eyob A.
LU Decomposition… Example1
From the 3rd equation Substituting in a3 and using the second equation

0.7 a3 = 0.735 − 4.8a2 − 1.56a3 = −96.21


0.735 − 96.21 + 1.56a3
a3 = a2 =
0.7 − 4.8
a3 = 1.050 − 96.21 + 1.56(1.050)
a2 =
− 4.8
a2 = 19.70

Eyob A.
LU Decomposition… Example1
Substituting in a3 and a2 using the first equation Hence the Solution Vector is:

25a1 + 5a2 + a3 = 106.8  a1  0.2900


a  =  19.70 
a1 =
106.8 − 5a2 − a3  2  
25  a3   1.050 
106.8 − 5(19.70) − 1.050
=
25
= 0.2900

Eyob A.
3. Jacobi İteration
a11 x1 + a12 x2 +  + a1n xn = b1  x10 
a21 x1 + a22 x2 +  + a2 n xn = b2  0
 x2 
x =
0

 
 0
an1 x1 + an 2 x2 +  + ann xn = bn  xn 

x11 =
1
(b1 − a12 x20 −  − a1n xn0 ) 1  i −1 n 
bi −  aij x j −  aij x j 
k +1
a11 x
i = k k

aii  j =1 j =i +1 
1
x12 = (b2 − a21 x10 − a23 x30 −  − a2 n xn0 )
a22
1
x1n = (bn − an1 x10 − an 2 x20 −  − ann −1 xn0−1 )
ann
Eyob A.
Jacobi Iteration… Example 1
7 + x20 − x30 7
 4 − 1 1  x1   7  0  x =
1
1
= = 1.75
 4 − 8 1  x  = − 21 4 4
  2    x 0 = 0 21
− 2 1 5  x3   15 
21 + 4 x 0
+ x 0
= = 2.625
0 x12 = 1 3
8
8
15
15 + 2 x10 − x20 = = 3.0
Diagonally dominant matrix x3 =
1
5
5
7 + x1
− x1
7 + 2.625 − 3
x12 = 2 3
= = 1.65625 7 + 3.875 − 4.225
4 4 x13 = = 1.6625
4
21 + 4 x11 + x31 21 + 4 1.75 + 3
x2 =
2
= = 3.875 21 + 4  1.65625+ 4.225
8 x23 = = 3.98125
8 8
15 + 2 x11 − x12 15 + 2 1.75 − 2.625 15 + 2  1.65625− 3.875
x3 =
2
= = 4.225 x33 = = 2.8875
5 5 5
Matrix is diagonally dominant, Jacobi iterations are converging
Eyob A.
5. Gauss-Seidel iteration

a11 x1 + a12 x2 +  + a1n xn = b1  x10 


Use the latest update a21 x1 + a22 x2 +  + a2 n xn = b2  0
 x2 
x =
0

 
 0
an1 x1 + an 2 x2 +  + ann xn = bn  xn 
1
x =
1
1 (b1 − a12 x20 −  − a1n xn0 )
a11
1  i −1 n 
bi −  aij x j −  aij x j 
k +1 k +1
x12 =
1
(b2 − a21 x11 − a23 x30 −  − a2 n xn0 ) x i = k

a22 aii  j =1 j =i +1 
1
xn =
1
(bn − an1 x11 − an 2 x12 −  − ann −1 x1n −1 )
ann

Eyob A.
Gauss-Seidel Iteration… Example

 4 − 1 1  x1   7  0 
 4
 − 8 1  x2  = − 21 x 0 = 0 b − Ax 0 = 26.7395
2

− 2 1 5  x3   15  0

Diagonally dominant matrix

7 + x20 − x30 7
x =
1
= = 1.75
1
4 4 b − Ax1 = 3.0414
2
21 + 4 x11 + x30 = 21 + 4 1.75 = 3.5
x2 =
1

8 8 b − Ax1 = 10.0452
15 + 2 x 1
− x 1 15 + 2 1.75 − 3.5 2

x3 =
1 1 2 = = 3.0
5 5
Jacobi iteration
Eyob A.
Gauss-Seidel Iteration… Example

7 + x12 − x31 7 + 3.5 − 3 b − Ax 2 = 0.4765


x2
1 = = = 1.875 2
4 4
21 + 4 x12 + x31 21 + 4 1.875 + 3
x22 = = = 3.9375
8 8 b − Ax 2 = 6.7413
2
15 + 2 x12 − x22 15 + 2 1.875 − 3.9375
x32 = = = 2.9625 Jacobi iteration
5 5

Gauss-Seidel converges faster

Eyob A.
Errors in Jacobi’s and Gauss-Seidel Iteration

𝐸𝑟𝑟𝑜𝑟 = 𝑥1 𝑘 − 𝑥1 𝑘−1 OR 𝑥1 𝑘+1 − 𝑥1 𝑘

𝑥2 𝑘 − 𝑥2 𝑘−1 OR 𝑥2 𝑘+1 − 𝑥2 𝑘

𝑥3 𝑘 − 𝑥3 𝑘−1 OR 𝑥3 𝑘+1 − 𝑥3 𝑘

You can terminate after the approximation error is less than or equal to preset error
| ∈𝛂 ≤∈𝐬 |

Eyob A.

You might also like