0% found this document useful (0 votes)
52 views

Lesson 3.1

The document discusses several methods for solving systems of linear equations, including substitution, elimination, Cramer's rule, and Gauss elimination. It provides examples to illustrate each method and its steps. Key aspects covered are setting up and manipulating equations to eliminate variables one by one until a solution is obtained.
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)
52 views

Lesson 3.1

The document discusses several methods for solving systems of linear equations, including substitution, elimination, Cramer's rule, and Gauss elimination. It provides examples to illustrate each method and its steps. Key aspects covered are setting up and manipulating equations to eliminate variables one by one until a solution is obtained.
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/ 44

SYSTEM OF LINEAR EQUATIONS: DIRECT METHODS

NUMERICAL METHODS AND ANALYSIS


LESSON 3

PRESENTED BY: ENGR. ROMULO C. CRUZ, JR.

Tuesday, 4 October 2022


LEARNING OUTCOMES

▪ Solve systems of linear equations by direct methods, specifically


➢ Substitution Method,
➢ Elimination Method,
➢ Cramer’s Rule
➢ Gauss Elimination Method

▪ Verify solutions by the use of the Solver Tool in Microsoft Excel

Presented by Engr. Romulo C. Cruz, Jr. Electrical Engineering Department College of Engineering & Architecture
SYSTEM OF LINEAR EQUATIONS

A system of linear equations is the set of equations


𝑎11 𝑥1 + 𝑎12 𝑥2 +…+ 𝑎1𝑛 𝑥𝑛 = 𝑐1
𝑎21 𝑥1 + 𝑎22 𝑥2 +…+ 𝑎2𝑛 𝑥𝑛 = 𝑐2

𝑎𝑛1 𝑥1 + 𝑎𝑛2 𝑥2 +…+ 𝑎𝑛𝑛 𝑥𝑛 = 𝑐𝑛

which is nonhomogeneous if 𝑐𝑛 is not zero; otherwise the system is homogeneous.

Presented by Engr. Romulo C. Cruz, Jr. Electrical Engineering Department College of Engineering & Architecture
SUBSTITUTION METHOD

works by expressing one unknown in terms of the other unknowns, then substituting
this expression into the other equations; the process continues until the last expression
solves one of the unknown variables when substituted to the remaining equation

Presented by Engr. Romulo C. Cruz, Jr. Electrical Engineering Department College of Engineering & Architecture
EXAMPLE PROBLEM 1
Solve by substitution method:
3𝑥1 − 𝑥2 + 2𝑥3 = 151
−2𝑥1 − 2𝑥2 + 𝑥3 = 12
𝑥1 + 4𝑥2 − 𝑥3 = 16

SOLUTION:
From the first equation,
𝑥2 = 3𝑥1 +2𝑥3 − 151

Substitute this into the second and third equations.


EXAMPLE PROBLEM 1

SOLUTION…

From the second equation:


−2𝑥1 − 2(3𝑥1 + 2𝑥3 − 151) + 𝑥3 = 12
−8𝑥1 − 3𝑥3 = −290
8𝑥1 + 3𝑥3 = 290, equation 2.1
EXAMPLE PROBLEM 1
SOLUTION…
From the third equation:
𝑥1 + 4𝑥2 − 𝑥3 = 16
𝑥1 + 4(3𝑥1 + 2𝑥3 − 151) − 𝑥3 = 16
13𝑥1 + 7𝑥3 = 620, equation 3.1

This gives
620−13𝑥1
𝑥3 =
7

Substitute into equation 2.1


EXAMPLE PROBLEM 1

SOLUTION…
From equation 2.1 :
8𝑥1 + 3𝑥3 = 290
620−13𝑥1
8𝑥1 + 3 = 290
7
17 170
𝑥 =
7 1 7

𝒙𝟏 = 10
EXAMPLE PROBLEM 1

SOLUTION…
From equation 3.1 :
620−13(10)
𝑥3 =
7

𝒙𝟑 = 70
Substitute 𝑥1 and 𝑥3 into the first equation
𝑥2 = 3𝑥1 +2𝑥3 − 151 = 3 10 + 2 70 − 151

𝒙𝟐 = 19
ELIMINATION METHOD

works by adding or subtracting two equations to eliminate one unknown and reduce
the number of equations by 1; the process continues until only two equations remain so
that one of the unknowns can be eliminated and the other one determined by adding
or subtracting the remaining equations.
EXAMPLE PROBLEM 2

Solve the system


3𝑥1 − 𝑥2 + 2𝑥3 = 151
−2𝑥1 − 2𝑥2 + 𝑥3 = 12
𝑥1 + 4𝑥2 − 𝑥3 = 16
by elimination method.

SOLUTION:
Eliminate first 𝑥3 by multiplying the third equation by (2) then adding the result to the first equation.
EXAMPLE PROBLEM 2
SOLUTION…
3𝑥1 − 𝑥2 + 2𝑥3 = 151 first equation
2𝑥1 + 8𝑥2 − 2𝑥3 = 32 third equation x (2)
5𝑥1 + 7𝑥2 = 183 equation 1.1

Add equations 2 and 3:


−2𝑥1 − 2𝑥2 + 𝑥3 = 12
𝑥1 + 4𝑥2 − 𝑥3 = 16
−𝑥1 + 2𝑥2 = 28 equation 2.1
EXAMPLE PROBLEM 2

SOLUTION…
𝑥1 can now be eliminated by multiplying equation 2.1 by (5), then adding the result to equation 1.1. Here,
the value of 𝑥2 will be solved:
5𝑥1 + 7𝑥2 = 183 equation 1.1
−5𝑥1 + 10𝑥2 = 140 equation 2.1 x (5)
17𝑥2 = 323

𝟑𝟐𝟑
𝒙𝟐 = = 𝟏𝟗
𝟏𝟕
EXAMPLE PROBLEM 2

SOLUTION…
To eliminate 𝑥2 and determine 𝑥1 , multiply equation 1.1 by (2) and subtract by the product of equation
2.1 and (7):
10𝑥1 + 14𝑥2 = 366 equation 1.1 x (2)
−7𝑥1 + 14𝑥2 = 196 equation 2.1 x (7)
17𝑥1 = 170

𝟏𝟕𝟎
𝒙𝟏 = = 𝟏𝟎
𝟏𝟕
EXAMPLE PROBLEM 2

SOLUTION…
To determine 𝑥3 , eliminate 𝑥1 from the three equations. Multiply the third equation by (3), then subtract
the result from the first equation:
3𝑥1 − 𝑥2 + 2𝑥3 = 151 equation 1
3𝑥1 + 12𝑥2 − 3𝑥3 = 48 equation 3 x (3)
−13𝑥2 + 5𝑥3 = 103 equation 1.2

Multiply the third equation by (2), then add the result to the second equation:
EXAMPLE PROBLEM 2

SOLUTION…
−2𝑥1 − 2𝑥2 + 𝑥3 = 12 equation 2
2𝑥1 + 8𝑥2 − 2𝑥3 = 32 equation 3 x (2)
6𝑥2 − 𝑥3 = 44 equation 2.2

Eliminate 𝑥2 from equations 1.2 and 2.2; multiply equation 1.2 by (6), and equation 2.2 by (13) then add
the results:
EXAMPLE PROBLEM 2

SOLUTION…
−78𝑥2 + 30𝑥3 = 618 equation 1.2 x (6)
78𝑥2 − 13𝑥3 = 572 equation 2.2 x (13)
17𝑥3 = 1190

𝟏𝟏𝟗𝟎
𝒙𝟑 = = 𝟕𝟎
𝟏𝟕
CRAMER’S RULE

 an explicit formula for the solution of a system


of linear equations by expressing the solution in
terms of the determinants of the coefficient
matrix and of matrices obtained from it by
replacing one column by the column vector of
right-hand-sides of the equations

 named after Gabriel Cramer who published the


rule in 1750

Cramer
photo credits: Wikipedia, the free encyclopedia
CRAMER’S RULE
Consider the system of linear equations
𝑎11 𝑥1 + 𝑎12 𝑥2 +…+ 𝑎1𝑛 𝑥𝑛 = 𝑐1
𝑎21 𝑥1 + 𝑎22 𝑥2 +…+ 𝑎2𝑛 𝑥𝑛 = 𝑐2

𝑎𝑛1 𝑥1 + 𝑎𝑛2 𝑥2 +…+ 𝑎𝑛𝑛 𝑥𝑛 = 𝑐𝑛

which in matrix form is

𝑎11 𝑎12 … 𝑎1𝑛 𝑥1 𝑐1


𝑎21 𝑎22 … 𝑎2𝑛 𝑥2 𝑐
= 2
⋮ ⋮ ⋮ ⋮ ⋮
𝑎𝑛1 𝑎𝑛2 … 𝑎𝑛𝑛 𝑥𝑛 𝑐𝑛
CRAMER’S RULE
Let
𝑎11 𝑎12 … 𝑎1𝑛
𝑎21 𝑎22 … 𝑎2𝑛
A= = 𝑚𝑎𝑡𝑟𝑖𝑥 𝑜𝑓 𝑐𝑜𝑒𝑓𝑓𝑖𝑐𝑖𝑒𝑛𝑡𝑠
⋮ ⋮ ⋮
𝑎𝑛1 𝑎𝑛2 … 𝑎𝑛𝑛

𝑥1
𝑥2
𝑥= = 𝑚𝑎𝑡𝑟𝑖𝑥 𝑜𝑓 𝑢𝑛𝑘𝑛𝑜𝑤𝑛𝑠

𝑥𝑛

𝑐1
𝑐
𝑐= 2 = 𝑚𝑎𝑡𝑟𝑖𝑥 𝑜𝑓 𝑐𝑜𝑛𝑠𝑡𝑎𝑛𝑡𝑠

𝑐𝑛
CRAMER’S RULE
In symbols:

𝑨𝒙 = 𝒄

The solutions of this matrix equation may be obtained from

𝒅𝒆𝒕 𝑨𝒌
𝒙𝒌 =
𝒅𝒆𝒕 𝑨

where: 𝐴𝑘 = matrix formed by replacing the kth column of A by the column vector c
det (A) = determinant of A = |A|
det (Ak) = determinant of Ak = |Ak|
DETERMINANT OF A MATRIX
𝑎 𝑏
For a 2x2 matrix 𝐴 = ,
𝑐 𝑑

det (A) = ad – bc

𝑎 𝑏 𝑐
For a 3x3 matrix 𝐴 = 𝑑 𝑒 𝑓 ,
𝑔 ℎ 𝑖

det (A) = a (ei – fh) – b (di – fg) + c (dh – eg)

NOTE: Multiply a by the determinant of the 2x2 matrix that is not in the row and column of a; the same
applies for b and c.
EXAMPLE PROBLEM 3

Solve the system as shown by Cramer’s Rule


3𝑥1 − 𝑥2 + 2𝑥3 = 151
−2𝑥1 − 2𝑥2 + 𝑥3 = 12
𝑥1 + 4𝑥2 − 𝑥3 = 16

SOLUTION:
By Cramer’s Rule
𝒅𝒆𝒕 𝑨𝟏 |𝑨𝟏 |
𝒙𝟏 = =
𝒅𝒆𝒕 𝑨 |𝑨|
EXAMPLE PROBLEM 3

SOLUTION…
151 −1 2
𝐴1 = 12 −2 1
16 4 −1

= 151 −2 −1 − 1 4 − (−1) 12 −1 − 1 16 + 2 12 4 − −2 16

𝐴1 = −302 − 28 + 160 = −170


EXAMPLE PROBLEM 3
SOLUTION…
3 −1 2
𝐴 = −2 −2 1
1 4 −1

= 3 −2 −1 − 1 4 − (−1) −2 −1 − 1 1 + 2 −2 4 − −2 1

𝐴 = −6 + 1 − 12 = −17

Therefore,
−𝟏𝟕𝟎
𝒙𝟏 = = 𝟏𝟎
−𝟏𝟕
EXAMPLE PROBLEM 3
SOLUTION…
|𝑨𝟐 |
𝒙𝟐 =
|𝑨|

3 151 2
𝐴2 = −2 12 1
1 16 −1

= 3 12 −1 − 1 16 − 151 −2 −1 − 1 1 + 2 −2 16 − 12 1

𝐴2 = −84 − 151 − 88 = −323

Therefore, −𝟑𝟐𝟑
𝒙𝟐 = = 𝟏𝟗
−𝟏𝟕
EXAMPLE PROBLEM 3
SOLUTION…
|𝑨𝟑 |
𝒙𝟑 =
|𝑨|

3 −1 151
𝐴3 = −2 −2 12
1 4 16

= 3 −2 16 − 12 4 − (−1) −2 16 − 12 1 + 151 −2 4 − −2 1
𝐴3 = −240 − 44 − 906 = −1190

Therefore, −𝟏𝟏𝟗𝟎
𝒙𝟑 = = 𝟕𝟎
−𝟏𝟕
GAUSS ELIMINATION METHOD
The system of linear equations
𝑎11 𝑥1 + 𝑎12 𝑥2 +…+ 𝑎1𝑛 𝑥𝑛 = 𝑐1
𝑎21 𝑥1 + 𝑎22 𝑥2 +…+ 𝑎2𝑛 𝑥𝑛 = 𝑐2

𝑎𝑛1 𝑥1 + 𝑎𝑛2 𝑥2 +…+ 𝑎𝑛𝑛 𝑥𝑛 = 𝑐𝑛

as shown previously can be written as

𝐴𝑥 = 𝑐
GAUSS ELIMINATION METHOD
The augmented matrix of the system is
𝑎11 𝑎12 … 𝑎1𝑛 𝑐1
𝑎21 𝑎22 … 𝑎2𝑛 𝑐2
𝐴ሚ = 𝐴 𝑐 =
⋮ ⋮ ⋮ ⋮
𝑎𝑛1 𝑎𝑛2 … 𝑎𝑛𝑛 𝑐𝑛

 reduces the augmented matrix into a triangular


form, with the unknowns solved either by
backward substitution or forward substitution

 named after Carl Friedrich Gauss


Gauss
photo credits: Wikipedia, the free encyclopedia
GAUSS ELIMINATION METHOD
ALGORITHM:
1. Eliminate 𝑥1 from the second row of the augmented matrix up to the nth (last) row by adding
suitable multiples of the first row to the second row up to the last row.
NOTE: The first row (or first equation) is called the pivot row (or pivot equation) in this step
and the element 𝑎11 is called the pivot. This row is left unaltered.

2. After eliminating 𝑥1 from the second row down to the last row, the second row (which no
longer contains 𝑥1 ) becomes the new pivot row; 𝑥2 is to be eliminated from the third row
down to the last row by adding suitable multiples of the second row to the third row up to the
last row.
NOTE: The element 𝑎22 is the new pivot; the first and second rows are left unaltered.
GAUSS ELIMINATION METHOD
ALGORITHM:
3. This process is to be repeated until the augmented matrix is transformed into an upper triangular
matrix. The unknowns can then be solved by backward substitution.
NOTE: The pivot 𝑎𝑘𝑘 must not be zero and should be large in absolute value* to avoid round-off
magnification** by the multiplication in the elimination.

*Partial pivoting, i.e. interchanging of rows may be used


**A small round-off error in one unknown leads to a large error in another

NOTE: Forward substitution can be used if the augmented matrix is transformed into a lower triangular
matrix.
EXAMPLE PROBLEM 4
Solve the system as shown by Gauss Elimination Method
6𝑥2 + 13𝑥3 = 137.86
6𝑥1 − 8𝑥3 = −85.88
13𝑥1 − 8𝑥2 = 178.54

SOLUTION:
Since equation 1 has no 𝑥1 term, and equation 3 has the largest coefficient in column 1, interchange
equations 3 and 1:
EXAMPLE PROBLEM 4

SOLUTION…
The augmented matrix is
Pivot row 13 −8 0 178.54 R1 = r1
6 0 −8 −85.88 R2 = r2 – (6/13) (r1)
0 6 13 137.86 R3 = r3

where: R = new row, r = old row


EXAMPLE PROBLEM 4

SOLUTION…
The new matrix is
13 −8 0 178.54 R1 = r1
48
New pivot row 0 −8 −168.28 R2 = r2
13
0 6 13 137.86 R3 = r3 – (13/8) (r2)

The upper triangular matrix is


13 −8 0 178.54
48
0 −8 −168.28
13
0 0 26 411.32
EXAMPLE PROBLEM 4
SOLUTION…
This simplifies the system of equations into
13𝑥1 − 8𝑥2 = 178.54
48
𝑥 − 8𝑥3 = −168.28
13 2

26𝑥3 = 411.32

The unknowns can now be solved by backward substitution (i.e. starting from the last equation going up):
26𝑥3 411.32
=
26 26

𝒙𝟑 = 𝟏𝟓. 𝟖𝟐
EXAMPLE PROBLEM 4

SOLUTION…
Substitute the value of 𝑥3 into the second equation:
48
𝑥 − 8𝑥3 = −168.28
13 2
48
𝑥 = 8𝑥3 − 168.28 = 8 15.82 − 168.28 = −41.72
13 2
41.72
𝑥2 = − 48
13

𝒙𝟐 = −𝟏𝟏. 𝟑𝟎
EXAMPLE PROBLEM 4
SOLUTION…
Substitute the value of 𝑥2 into the first equation:
13𝑥1 − 8𝑥2 = 178.54
13𝑥1 = 8𝑥2 + 178.54 = 8 −11.30 + 178.54 = 88.14
88.14
𝑥1 =
13

𝒙𝟏 = 𝟔. 𝟕𝟖
EXAMPLE PROBLEM 4
ANOTHER SOLUTION:
The augmented matrix may also be transformed into a lower triangular matrix. Since equation 1 has the
largest 𝑥3 term, we interchange equations 1 and 3:
6𝑥2 + 13𝑥3 = 137.86
6𝑥1 − 8𝑥3 = −85.88
13𝑥1 − 8𝑥2 = 178.54

13𝑥1 − 8𝑥2 = 178.54


6𝑥1 − 8𝑥3 = −85.88
6𝑥2 + 13𝑥3 = 137.86
EXAMPLE PROBLEM 4

ANOTHER SOLUTION…
The augmented matrix in this case is
13 −8 0 178.54 R1 = r1
6 0 −8 −85.88 R2 = r2 + 8/13 (r3)
Pivot row 0 6 13 137.86 R3 = r3

The new matrix is


13 −8 0 178.54 R1 = r1 + 13/6 (r2)
48
New pivot row 6 0 −1.04 R2 = r2
13
0 6 13 137.86 R3 = r3
EXAMPLE PROBLEM 4
ANOTHER SOLUTION…
The lower triangular matrix is

26 0 0 176.29
48
6 0 −1.04
13
0 6 13 137.86

This simplifies the system of equations into


26𝑥1 = 176.29
48
6𝑥1 + 𝑥 = −1.04
13 2

6𝑥2 + 13𝑥3 = 137.86


EXAMPLE PROBLEM 4

ANOTHER SOLUTION…
The unknowns can now be solved by forward substitution (i.e. starting from the first equation going
down):
26𝑥1 = 176.29
26𝑥1 176.29
=
26 26

𝒙𝟏 = 𝟔. 𝟕𝟖
EXAMPLE PROBLEM 4

ANOTHER SOLUTION…
Substitute 𝑥1 into the second equation:
48
6𝑥1 + 𝑥 = −1.04
13 2
48
𝑥 = −1.04 − 6𝑥1 = −1.04 − 6 6.78 = −41.72
13 2
41.72
𝑥2 = − 48
13

𝒙𝟐 = −𝟏𝟏. 𝟑𝟎
EXAMPLE PROBLEM 4

ANOTHER SOLUTION…
Substitute 𝑥2 into the second equation:
6𝑥2 + 13𝑥3 = 137.86
13𝑥3 = 137.86 − 6𝑥2 = 137.86 − 6 −11.30 = 205.66
13𝑥3 205.66
=
13 13

𝒙𝟑 = 𝟏𝟓. 𝟖𝟐

You might also like