You are on page 1of 18

LAB 1

Solution to Systems of Linear Equations


Direct Elimination Methods

John Kenneth B. Musico

CE 28
Analytical & Computational Institute of Civil Engineering
Methods in CE III
Introduction
Solutions to Systems of
Linear Equations

Direct Elimination Methods Iterative Methods

Gauss Elimination Jacobi Iteration

Gauss Jordan Gauss-Jacobi Iteration


LAB 1
LU Factorization LAB 2 Successive Overrelaxation

Thomas Algorithm
LAB 3
Cramer’s Rule

Matrix Inverse

CE 28 Analytical & Computational Methods in CE III 2


Introduction

System of linear equations can be expressed compactly in matrix


notation:
𝑨 𝒙 = [𝒃]
Coefficient matrix Constants vector

Solution vector

CE 28 Analytical & Computational Methods in CE III 3


Introduction

Row Operations useful in solving S.o.L.E.


1. Scaling – multiplying a row (equation) by a constant.
2. Pivoting – interchanging the order of the rows (equations).
3. Elimination – replacing a row (equation) by a weighted linear
combination of that row with any other row.

▪ These row operations will not affect the solution to the system of
linear equations

CE 28 Analytical & Computational Methods in CE III 4


Gauss Elimination

Gauss Elimination Method


Phase 1: Forward Elimination

STEP 1: Augment Matrix [𝐴] and [𝑏]

3 −0.1 −0.2 7.85


𝐴 𝑏 = 0.1 7 −0.3 −19.3
0.3 −0.2 10 71.4

CE 28 Analytical & Computational Methods in CE III 5


Gauss Elimination

Gauss Elimination Method


Phase 1: Forward Elimination
STEP 2: Make the left side of the augmented matrix an upper triangular
matrix.

Basic Gauss Elimination

Row 1 3 −0.1 −0.2 7.85


Row 2 0.1 7 −0.3 −19.3 E: Row 2 = Row 2 – (0.1/3)*Row 1

Row 3 0.3 −0.2 10 71.4 E: Row 3 = Row 3 – (0.3/3)*Row 1


Make these zero

CE 28 Analytical & Computational Methods in CE III 6


Gauss Elimination

Gauss Elimination Method


Phase 1: Forward Elimination
STEP 2: Make the left side of the augmented matrix an upper triangular
matrix.

Basic Gauss Elimination

Row 1 3 −0.1 −0.2 7.85


Row 2 0 7.003 −0.293 −19.562
Row 3 0 −0.19 10.02 70.615 E: Row 3 = Row 3 – (-0.19/7.003)*Row 2
Make this zero

CE 28 Analytical & Computational Methods in CE III 7


Gauss Elimination

Gauss Elimination Method


Forward Elimination
STEP 2: Make the left side of the augmented matrix an upper triangular
matrix.

Basic Gauss Elimination

Row 1 3 −0.1 −0.2 7.85


Row 2 0 7.003 −0.293 −19.562
Row 3 0 0 10.012 70.0843

CE 28 Analytical & Computational Methods in CE III 8


Gauss Elimination

Gauss Elimination Method


Phase 1: Forward Elimination
Basic Gauss Elimination
𝑘th element of Row 𝑖
Row 𝑖 = Row 𝑖 − ∗ Row 𝑘
𝑘th element of Row 𝑘

𝑎𝑖,𝑘 𝑎𝑖,𝑘
𝑎𝑖,𝑗 = 𝑎𝑖,𝑗 − ∗ 𝑎𝑘,𝑗 𝑏𝑖 = 𝑏𝑖 − ∗ 𝑏𝑘
𝑎𝑘,𝑘 𝑎𝑘,𝑘
𝒊 refers to the row whose 𝒋 refers to the 𝒌 refers to the row you are
elements you are eliminating elements in a row using to eliminate other rows
𝑖 = 𝑘 + 1, 𝑘 + 2, … , 𝑛 𝑗 = 1, 2, … , 𝑛 𝑘 = 1, 2, … , 𝑛 − 1

CE 28 Analytical & Computational Methods in CE III 9


Gauss Elimination

Gauss Elimination Method


Phase 2: Back Substitution 3 −0.1 −0.2 7.85
Basic Gauss Elimination 0 7.003 −0.293 −19.562
0 0 10.012 70.0843

CE 28 Analytical & Computational Methods in CE III 10


Gauss Elimination

Gauss Elimination Method


Back Substitution
Basic Gauss Elimination

𝑏𝑛
𝑥𝑛 =
𝑎𝑛,𝑛
𝑏𝑖 − σ𝑛𝑗=𝑖+1 𝑎𝑖,𝑗 𝑥𝑗
𝑥𝑖 =
𝑎𝑖,𝑖
𝑖 = 𝑛 − 1, 𝑛 − 2, … , 1

CE 28 Analytical & Computational Methods in CE III 11


Gauss Elimination

Gauss Elimination Method


Division by Zero

E: Row 2 = Row 2 – (4/0)*Row 1


E: Row 3 = Row 3 – (-2/0)*Row 1

P: Swapping Row 1 and Row 2 Solution:


Pivoting –
interchanging the order
of the rows (equations).

CE 28 Analytical & Computational Methods in CE III 12


Gauss-Jordan Elimination

Gauss-Jordan Method
▪ Variation of Gauss Elimination method in which the elements
above the major diagonal are eliminated as well.
➢ No more need for back substitution.
▪ The number of multiplications and divisions for Gauss-Jordan
elimination is approximately 50% larger than for Gauss
elimination.
➢ Gauss elimination is preferred.

CE 28 Analytical & Computational Methods in CE III 13


Gauss-Jordan Elimination

Gauss-Jordan Method

Forward Elimination Step:


Make the left side of the augmented matrix an IDENTITY MATRIX.

Row 1 3 −0.1 −0.2 7.85


Row 2 0.1 7 −0.3 −19.3 E: Row 2 = Row 2 – (0.1/3)*Row 1

Row 3 0.3 −0.2 10 71.4 E: Row 3 = Row 3 – (0.3/3)*Row 1


Make these zero

CE 28 Analytical & Computational Methods in CE III 14


Gauss-Jordan Elimination

Gauss-Jordan Method

Forward Elimination Step:


Make the left side of the augmented matrix an IDENTITY MATRIX.
Make this zero
Row 1 3 −0.1 −0.2 7.85 E: Row 1 = Row 1 – (-0.1/7.003)*Row 2

Row 2 0 7.003 −0.293 −19.562


Row 3 0 −0.19 10.02 70.615 E: Row 3 = Row 3 – (-0.19/7.003)*Row 2
Make this zero

CE 28 Analytical & Computational Methods in CE III 15


Gauss-Jordan Elimination

Gauss-Jordan Method

Forward Elimination Step:


Make the left side of the augmented matrix an IDENTITY MATRIX.
Make these zero
E: Row 1 = Row 1 – (-0.204/10.012)*Row 3
Row 1 3 0 −0.204 7.571
Row 2 0 7.003 −0.293 −19.562 E: Row 1 = Row 1 – (-0.293/10.012)*Row 3

Row 3 0 0 10.012 70.0843

CE 28 Analytical & Computational Methods in CE III 16


Gauss-Jordan Elimination

Gauss-Jordan Method

Forward Elimination Step:


Make the left side of the augmented matrix an IDENTITY MATRIX.
Make these 1
Row 1 3 0 0 9 S: Row 1 = Row 1*(1/3)
Row 2 0 7.003 0 −17.508 S: Row 2 = Row 2*(1/7.003)
Row 3 0 0 10.012 70.0843 S: Row 3 = Row 3*(1/10.012)

CE 28 Analytical & Computational Methods in CE III 17


Gauss-Jordan Elimination

Gauss-Jordan Method

Forward Elimination Step:


Make the left side of the augmented matrix an IDENTITY MATRIX.

Row 1 1 0 0 3
Row 2 0 1 0 −2.5
Row 3 0 0 1 7
SOLUTION!!

CE 28 Analytical & Computational Methods in CE III 18

You might also like