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

Ch2 SL1 Linear system

The document outlines the Gaussian elimination method for solving systems of linear equations, including the use of partial pivoting. It provides a detailed example involving electrical currents and demonstrates the process of elimination and back-substitution, along with MATLAB code for implementation. Additionally, it includes sample multiple-choice questions and exercises for further practice on the topic.

Uploaded by

c.sunjid707
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)
5 views

Ch2 SL1 Linear system

The document outlines the Gaussian elimination method for solving systems of linear equations, including the use of partial pivoting. It provides a detailed example involving electrical currents and demonstrates the process of elimination and back-substitution, along with MATLAB code for implementation. Additionally, it includes sample multiple-choice questions and exercises for further practice on the topic.

Uploaded by

c.sunjid707
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/ 9

Numerical Methods for Science and

Engineering
Chapter one
Solutions to Linear System
Solution of Linear System by Elimination

Objective: Solve the system of linear equations using Elimination


Method

Gaussian Elimination: The process which eliminates an unknown from


succeeding equations using elementary operations

Gaussian Elimination with Partial Pivoting


• Select pivotal equation for a variable for elimination.

• Eliminate the chosen variable from the remaining equations with respect to the
pivotal equation.

• Repeat the process for the subsystem.

• Using back-substitution find solutions by using pivotal equations.

Output : By applying Gaussian Elimination with partial pivoting, system of


linear equations can be solved to find roots (approximately) of the system.
Example :
The currents running through an electrical system are given by the
following system of equations. The three currents, x, y, and z, are
measured in amps.

8𝑥 + 3𝑦 − 5𝑧 = 3
10𝑥 + 7𝑦 + 2𝑧 = 4 .
6𝑥 + 4𝑦 + 7𝑧 = 8

a. Solve the above system to find the currents in this circuit using
Gaussian elimination with partial pivoting.

b. Justify your result by direct substitution in the original equation.

c. Write MATLAB codes to solve by left division (backslash) operator.


Operation x y z Const Eq Remark
8 3 -5 3 Eq1
10 7 2 4 Eq2
6 4 7 8 Eq3
Eq2/10 1.0000 0.7000 0.2000 0.4000 E4* pivot in x
Eq1/8 1.0000 0.3750 -0.6250 0.3750 E5
Eq3/6 1.0000 0.6667 1.1667 1.3333 E6
E5-E4 0.0000 -0.3250 -0.8250 -0.0250 E7
E6-E4 0.0000 -0.0333 0.9667 0.9333 E8
E7/(-0.325 1.0000 2.5385 0.0769 E9* Pivot in y
E8(-/0.033 1.0000 -29.0003 -28.0003 E10
E10-E9 0.0000 -31.5388 -28.0772 E11
E11/-31.538 0.8902 E12* Pivot in z

z= 0.8902
y= -2.1829
x= 1.7500
Pivot --- the element which Do yourself
is highest in magnitude

Operation x y z Constant Eqn #


8 3 -5 3 E1
10 7 2 4 E2
6 4 7 8 E3
E2/10 1.000 E4* 1st Piv eq in x
E1/8 1.000 E5
E3/6 1.000 E6
E5-E4 0 E7
E6-E4 0 E8
E7/(-0.325) 0 1 E9* 2nd Piv eq in y
E8/(-0.03) 0 1 E10
E10-E9 0 0 E11
E11/(- 0 0 1 E12* 3rd Piv eq in z
31.5388)
The upper triangular form of the system can be summarized as
𝑥 + 0.7𝑦 + 0.2𝑧 = 0.4
𝑦 + 2.5385𝑧 = 0.0769
𝑧 = 0.8902
Solving by back substitution, we have, z = 0.8902
𝑦 = 0.0769 − 2.538 0.8902 = −2.1829
𝑥 = 0.4 − 0.7 −2.1829 − 0.2 0.8902 = 1.7500
b.
Justification: 𝐸1: 8 1.750 + 3 −2.1829 − 5 0.8902 ≅ 3
𝐸2: 10 1.750 + 7 −2.1829 + 2 0.8902 ≈ 4
𝐸3: 6 1.750 + 4 −2.1829 + 7 0.8902 ≈ 8

8𝑥 + 3𝑦 − 5𝑧 = 3
c. MATLAB
10𝑥 + 7𝑦 + 2𝑧 = 4
>> A=[8 3 -5; 10 7 2; 6 4 7];
6𝑥 + 4𝑦 + 7𝑧 = 8
>> b=[3; 4; 8];
>> Solution = A\b
Ax=b
Solution = 1.7500, -2.1829, 0.8902
𝑥 = 𝐴−1 𝑏
Sample MCQ
1. To solve the system of linear equation which method we use?
a) Gaussian elimination
b) Iterative method
c) Both
d) None
2. The process which eliminates an unknown from succeeding equations using
elementary operations is known as
a) Gaussian Elimination
b) Gauss Jacobi Method
c) Gauss-Seidal Iterative Method
d) None
3. One such system is the upper triangular form which method is then used to
solve the system?
a) Substitution
b) Back-substation
c) Both
d) None
4. The equation with numerical coefficient, highest in magnitude, of that variable
in the system is called
a) Main equation
b) Pivotal equation
c) Iterative equation
d) None
Exercise
1. a. 5𝑥 − 4𝑦 + 3𝑧 = 21, 2𝑥 + 3𝑦 + 2𝑧 = 20, 8𝑥 + 2𝑦 + 𝑧 = 13.

b. 3𝑥 − 4𝑦 + 6𝑧 = 12, 7𝑥 + 𝑦 − 5𝑧 = 18, 2𝑥 + 9𝑦 + 4𝑧 = 14.

c. 2𝑥 + 𝑦 − 3𝑧 = 17, 5𝑥 − 2𝑦 + 3𝑧 = 6, 𝑥 − 8𝑦 + 𝑧 = 11.

d. 6𝑥 + 5𝑦 − 8𝑧 = 24, 10𝑥 + 3𝑦 + 4𝑧 = 11, 8𝑦 + 3𝑧 = 10

e. 5𝑥 + 2𝑦 + 𝑧 = 7, 2𝑥 − 4𝑦 + 3𝑧 = 6, 3𝑥 + 5𝑦 + 7𝑧 = 6

f. 6𝑥 + 5𝑦 − 8𝑧 = 14, 8𝑥 + 3𝑦 + 4𝑧 = 16, 2𝑥 + 7𝑦 + 3𝑧 = 12.

i. Solve the above linear system using Gaussian elimination with


pivoting (partial/total).

ii. Justify your result by direct substitution in the original


equations.

iii. Write MATLAB codes to solve by left division (backslash)


operator.
2. Cory, Josh and Dan went shopping for Halloween treats. Cory bought 3 chocolate
pumpkins, 4 masks and 8 candy witches. He spent $36.65. Josh bought 5 chocolate
pumpkins,3 masks and 10 candy witches. He spent $37.50. Dan bought 4 chocolate
pumpkins, 5 masks and 6 candy witches. He spent $43.45.
i. Write a system of equations to represent this problem
ii. Solve the system of linear equation using Gaussian elimination with partial pivoting.
iii. Write MATLAB codes to solve by left division (backslash) operator.
3. A local computer company sells three types of laptop computers to three nearby
stores.The number of laptops ordered by each store and the amount owing to the company
for the order is shown in the following table:

Store Laptop A Laptop B Laptop C Amount


Owing($)
Wal-Mart 10 8 6 21 200
Sears 7 9 5 18 700
Target 8 4 3 13 000
i. Write a system of equations to represent the above information.
ii. Solve the system of linear equation using Gaussian elimination with partial
pivoting.
iii. Write MATLAB codes to solve by left division (backslash) operator.

You might also like