Processing math: 60%
Skip to main content
Library homepage
 

Text Color

Text Size

 

Margin Size

 

Font Type

Enable Dyslexic Font
Mathematics LibreTexts

4.06: Gaussian Elimination Method for Solving Simultaneous Linear Equations

( \newcommand{\kernel}{\mathrm{null}\,}\)

Lesson 1: Theory of Naive Gauss Elimination Method

Learning Objectives

After successful completion of this lesson, you should be able to

1) write the algorithm to solve a set of simultaneous linear equations using Naive Gauss elimination method

How is a set of equations solved numerically by Gaussian elimination method?

One of the most popular techniques for solving simultaneous linear equations is the Gaussian elimination method. The approach is designed to solve a general set of n equations and n unknowns

a11x1+a12x2+a13x3++a1nxn=b1a21x1+a22x2+a23x3++a2nxn=b2                    an1x1+an2x2+an3x3++annxn=bn

Gaussian elimination consists of two parts

  1. Forward Elimination of Unknowns: In this part, an unknown is eliminated in the second through the last equation. This way, the equations are reduced to one equation and one unknown in each equation.
  2. Back Substitution: In this part, starting from the last equation, each of the unknowns is found.

Forward Elimination of Unknowns:

In the first step of the forward elimination part, the first unknown, x1, is eliminated from all rows below the first row. The first equation is selected as the pivot equation to eliminate x1. So, to eliminate x1 in the second equation, one divides the first equation by a11 (hence called the pivot element) and then multiplies it by a21. This operation is the same as multiplying the first equation by a21/a11 to give

a21x1+a21a11a12x2++a21a11a1nxn=a21a11b1

Now, this equation can be subtracted from the second equation to give

(a22a21a11a12)x2++(a2na21a11a1n)xn=b2a21a11b1

or

a22x2++a2nxn=b2

where

a22=a22a21a11a12a2n=a2na21a11a1n

This procedure of eliminating x1, is now repeated for the third equation to the nth equation to reduce the set of equations as

a11x1+a12x2+a13x3++a1nxn=b1a22x2+a23x3++a2nxn=b2a32x2+a33x3++a3nxn=b3                                      an2x2+an3x3++annxn=bn

This marks the end of the first step of the forward elimination part. Now for the second step of the forward elimination part, we start with the second equation as the pivot equation and a22 as the pivot element. So, to eliminate x2 in the third equation, one divides the second equation by a22 (the pivot element) and then multiply it bya32. This operation is the same as multiplying the second equation by a32/a22 and subtracting it from the third equation. This subtraction makes the coefficient of x2 zero in the third equation. The same procedure is now repeated for the fourth equation and continues until the nth equation, to give

a11x1+a12x2+a13x3++a1nxn=b1a22x2+a23x3++a2nxn=b2a33x3++a3nxn=b3                      an3x3++annxn=bn

The next steps of the forward elimination part are conducted by using the third equation as a pivot equation. That is, there will be a total of n1 steps in the forward elimination part of the method. At the end of n1 steps within the forward elimination part, we get a set of equations that look like

a11x1+a12x2+a13x3++a1nxn=b1             a22x2+a23x3++a2nxn=b2                           a33x3++a3nxn=b3                                                                                                        a(n1)nnxn=b(n1)n

Back Substitution:

In this part, the equations are solved starting from the last equation as it has only one unknown.

xn=b(n1)na(n1)nn

Then the second-to-last equation, that is, the (n1)th equation, has two unknowns: xn and xn1, but xn is already known. This recognition reduces the (n1)th equation also to one unknown. Back substitution hence can be represented for all equations by the formula

xi=b(i1)inj=i+1a(i1)ijxja(i1)ii for i=n1,  n2, , 1

and

xn=b(n1)na(n1)nn

Audiovisual Lecture

Title: Naïve Gauss Elimination Method - Theory

Summary: This video discusses the theory behind how Naïve Gaussian elimination is used to solve a set of simultaneous linear equations.

Lesson 2: Application of Naive Gauss Elimination Method

Learning Objectives

After successful completion of this lesson, you should be able to:

1) solve a set of simultaneous linear equations using Naïve Gauss elimination.

Applications

In the previous lesson, you learned the theory behind Naive Gauss Elimination. In this lesson, we will apply the theory to solve a set of simultaneous linear equations.

Example 4.6.2.1

The upward velocity of a rocket is given at three different times in Table 4.6.2.1.

Table 4.6.2.1. Velocity vs. time data.
Time, t (s) Velocity, v (m/s)
5 106.8
8 177.2
12 279.2

The velocity data is approximated by a polynomial as

v(t)=a1t2+a2t+a3, 5t12

The coefficients a1,a2, and a3 for the above expression are given by

[25516481144121][a1a2a3]=[106.8177.2279.2]

Find the values of a1,a2, and a3 using the Naïve Gauss elimination method. Find the velocity at t=6, 7.5, 9, 11 seconds.

Solution

The augmented matrix is

[2551|106.86481|177.2144121|279.2]

Forward Elimination of Unknowns

Since there are three equations, there will be two steps of the forward elimination part.

First step

Divide Row 1 by 25 and then multiply it by 64, that is, multiply Row 1 by 64/25=2.56.

([25  5       1       |     106.8])×2.56 gives Row 1 as

[64 12.82.56     |  273.408]

Subtract the result from Row 2

   [64    8  1    |  177.2][6412.82.56  |273.408]   04.81.5696.208

to get the resulting equations as

[2551|106.804.81.56|96.208144121|279.2]

Divide Row 1 by 25 and then multiply it by 144, that is, multiply Row 1 by 144/25=5.76.

([25     5   1      |         106.8])×5.76 gives Row 1 as

[14428.85.76    |      615.168]

Subtract the result from Row 3

    [14412  1      |279.2][14428.85.76   |615.168]    016.84.76335.968

to get the resulting equations as

[2551|106.804.81.56|96.208016.84.76|335.968]

Second step

We now divide Row 2 by 4.8 and then multiply by 16.8, that is, multiply Row 2 by 16.8/4.8=3.5.

([04.8  1.56          |   96.208] )×3.5 gives Row 2 as

[016.8 5.46          |336.728]

Subtract the result from Row 3

      [016.84.76     |335.968]  [016.85.46      |336.728]     0       0      0.7           0.76   

to get the resulting equations as

[2551|106.804.81.56|96.208000.7|0.76]

[255104.81.56000.7][a1a2a3]=[106.896.2080.76]

Back substitution

From the third equation

0.7a3=0.76

a3=0.760.7=1.08571

Substituting the value of a3 in the second equation,

4.8a21.56a3=96.208

a2=96.208+1.56a34.8=96.208+1.56×1.085714.8=19.6905

Substituting the value of a2 and a3 in the first equation,

25a1+5a2+a3=106.8

a1=106.85a2a325=106.85×19.69051.0857125=0.290472

Hence the solution vector is

[a1a2a3]=[0.29047219.69051.08571]

The polynomial that passes through the three data points is then

v(t)=a1t2+a2t+a3=0.290472t2+19.6905t+1.08571,  5t12(4.6.2.E1.1)

Since we want to find the velocity at t=6,7.5,9 and 11 seconds, we could simply substitute each value of t in v(t)=0.290472t2+19.6905t+1.08571 and find the corresponding velocity. For example, at t=6

v(6)=0.290472(6)2+19.6905(6)+1.08571=129.686  m/s

However, we could also find all the needed values of velocity at t = 6,7.5,9,11 seconds using the matrix multiplication form of Equation (4.6.2.E1.1).

v(t)=[0.290472  19.6905  1.08571][t2t1]

So, if we want to find v(6),v(7.5),v(9),v(11), it is given by

[v(6)v(7.5)v(9)v(11)]=[0.290472  19.6905  1.08571][627.529211267.59111111]=[0.290472  19.6905  1.08571][3656.258112167.59111111]=[129.686  165.104  201.828  252.828]

v(6)=129.686 m/s

v(7.5)=165.104 m/s

v(9)=201.828 m/s

v(11)=252.828 m/s

Audiovisual Lecture

Title: Naïve Gauss Elimination Method - Example

Summary: Learn the Naive Gauss elimination method of solving simultaneous linear equations.

Lesson 2: Finding Determinant of a Square Matrix Using Gaussian Elimination

Learning Objectives

After successful completion of this lesson, you should be able to

1) use the forward elimination part of Naive Gauss elimination method to find the determinant of a square matrix,

2) enumerate theorems related to the determinant of matrices,

3) relate the zero and non-zero value of the determinant of a square matrix to the existence or non-existence of the matrix inverse.

Can we use Naive Gauss elimination methods to find the determinant of a square matrix?

One of the more efficient ways to find the determinant of a square matrix is by taking advantage of the following two theorems on a determinant of matrices coupled with Naive Gauss elimination.

Theorem 4.6.2.1

Let [A] be a n×n matrix. Then, if [B] is a n×n matrix that results from adding or subtracting a multiple of one row to another row, then det(A)=det(B) (The same is true for column operations also).

Theorem 4.6.2.2

Let [A] be a n×n matrix that is upper triangular, lower triangular, or diagonal, then

det(A)=a11×a22×...×aii×...×ann=ni=1aii

This formula implies that if we apply the forward elimination part of the Naive Gauss elimination method, the determinant of the matrix stays the same according to Theorem 4.6.2.1. Then since at the end of the forward elimination part, the resulting matrix is upper triangular, the determinant will be given by Theorem 4.6.2.2.

Example 4.6.2.1

Find the determinant of

[A]=[25516481144121]

Solution

If we conduct all the steps of the forward elimination part using the Naive Gauss elimination method on [A], it will give us the following upper triangular matrix (refer to the example in the previous lesson of Naive Gauss elimination for the process)

[B]=[255104.81.56000.7]

According to Theorem 4.6.2.2,

det(B)=25×(4.8)×0.7=84.00

and since the forward elimination part involve subtracting multiple of one row from another, using the Theorem 4.6.2.1 det(A)=det(B)=84.00

Audiovisual Lecture

Title: Naïve Gauss Elimination Method - Example

Summary: Learn the Naive Gauss elimination method of solving simultaneous linear equations.

What if I cannot find the determinant of the matrix using the Naive Gauss elimination method, for example, if I get division by zero problems during the Naive Gauss elimination method?

Well, in that case, you can apply Gaussian elimination with partial pivoting. However, the determinant of the resulting upper triangular matrix may differ by sign. The following theorem applies in addition to the previous two to find the determinant of a square matrix.

Theorem 4.6.2.3

Let [A] be a n×n matrix. Then, if [B] is a matrix that results from switching one row with another row, then det(B)=det(A).

Example 4.6.2.2

Find the determinant of

[A]=[107032.0996515]

Solution

The end of the forward elimination part of Gaussian elimination with partial pivoting, we would obtain

[B]=[107002.55006.002]

det(B)=10×2.5×6.002=150.05

Since rows were switched once during the forward elimination part of Gaussian elimination with partial pivoting,

det(A)=det(B)=150.05

Example 4.6.2.3

Prove

det(A)=1det(A1)

Solution

[A][A]1=[I]

det(AA1)=det(I)

det(A)det(A1)=1

det(A)=1det(A1)

If [A] is a n×n matrix and det(A)0, what other statements are equivalent to it?

(1) [A] is invertible.

(2) [A]1 exists.

(3) [A] [X]=[C] has a unique solution.

(4) [A] [X]=[0] only solution is [X]=[0].

(5) [A] [A]1=[I]=[A]1 [A].

Lesson 3: Pitfalls of Naive Gauss Elimination Method

Learning Objectives

After successful completion of this lesson, you should be able to

1) enumerate the pitfalls of the Naive Gauss elimination method

2) show the pitfalls of the Naive Gauss elimination method through examples

Are there any pitfalls of the Naive Gauss elimination method?

Yes, there are two pitfalls of the Naive Gauss elimination method.

Division by zero:

First, it is possible for division by zero to occur during the beginning of any of the n1 steps of the forward elimination part.

For example

5x2+6x3=114x1+5x2+7x3=169x1+2x2+3x3=15

will result in division by zero in the first step of the forward elimination part as the coefficient of x1 in the first equation is zero, as is evident when we write the equations in matrix form.

[056457923][x1x2x3]=[111615]

But what about the equations below: Is division by zero a problem?

5x1+6x2+7x3=1810x1+12x2+3x3=2520x1+17x2+19x3=56

Written in matrix form,

[56710123201719][x1x2x3]=[182556]

there is no issue of division by zero in the the first step of forward elimination part. The pivot element is the coefficient of x1 in the first equation, that is, 5, and that is a non-zero number. However, at the end of the first step of the forward elimination part, we get the equations in the following matrix form:

[5670011079][x1x2x3]=[181116]

Now at the beginning of the 2nd step of the forward elimination part, the coefficient of x2 in this equation would be used as the pivot element. That element is zero and hence would create the division by zero problem.

So it is important to consider that the possibility of division by zero can occur at the beginning of any of the n1 steps of the forward elimination part in the Naive Gauss elimination method.

Round-off error:

Second, the Naive Gauss elimination method is prone to round-off errors. These errors are higher when there are many equations as errors propagate more than when there are a small number of equations. Also, if there is a large variation in the order of the magnitude of the numbers, and subtraction of close numbers takes place, it may also create large errors. See the examples below.

Example 4.6.4.1

Use Naive Gauss elimination to solve

20x1+15x2+10x3=453x12.249x2+7x3=1.7515x1+x2+3x3=9

Use six significant digits with chopping in your calculations.

Solution

Putting the equations in the matrix form, we get

[20151032.2497513][x1x2x3]=[451.7519]

The augmented matrix is

[201510|4532.2497|1.751513|9]

Forward Elimination

First step

Divide Row 1 by 20 and then multiply it by 3, that is, multiply Row 1 by 3/20=0.15.

([20  15  10   |   45] )×0.15 gives Row 1 as

[3  2.25  1.5   |   6.75]

Subtract the result from Row 2

  [3   2.249     7      |1.751][3    2.25  1.5     |6.75]    0     0.001    8.5     8.501

to get the resulting equations as

[201510|4500.0018.5|8.501513|9]

Divide Row 1 by 20 and then multiply it by 5, that is, multiply Row 1 by 5/20=0.25

[20  15  10   |   45] ×0.25 gives Row 1 as

[5  3.75  2.5   |   11.25]

Subtract the result from Row 3

  [5      1      3       |9][5    3.75     2.5     |11.25]   0 2.75      0.5 2.25

to get the resulting equations as

[201510|4500.0018.5|8.50102.750.5|2.25]

Second step

Now for the second step of the forward elimination part, we will use Row 2 as the pivot equation and eliminate Row 3: Column 2.

Divide Row 2 by 0.001 and then multiply it by 2.75, that is, multiply Row 2 by 2.75/0.001=2750.

[0  0.001  8.5   |   8.501] ×2750 gives Row 2 as

[0  2.75  23375   |   23377.75]

Rewriting within 6 significant digits with chopping

[0  2.75  23375   |   23377.7]

Subtract the result from Row 3

  [0      2.75      0.5       |2.25][0    2.75     23375     |23377.7]   0       0           23375.5      23375.45

Rewriting within 6 significant digits with chopping gives

[0  0  23375.5   |   23375.4] to get the resulting equations as

[201510|4500.0018.5|8.5010023375.5|23375.4]

This is the end of the forward elimination part.

Back substitution

We can now solve the above equations by back substitution. From the third equation,

23375.5x3=23375.4

x3=23375.423375.5=0.999995

Substituting the value of x3 in the second equation

0.001x2+8.5x3=8.501

x2=8.5018.5x30.001=8.5018.5×0.9999950.001=8.5018.499950.001=0.001050.001=1.05

Substituting the value of x3 and x2 in the first equation,

20x1+15x2+10x3=45

x1=4515x210x320=4515×1.0510×0.99999520=4515.759.9999520=29.259.9999520=19.250020=0.9625

This is the end of the back substitution part.

Hence the solution is

[X]=[x1x2x3]=[0.96251.050.999995]

Compare this with the exact solution of

[X]=[x1x2x3]=[111]

Example 4.6.4.2

In Example 4.6.4.1, we used Naive Gauss elimination to solve

20x1+15x2+10x3=453x12.249x2+7x3=1.7515x1+x2+3x3=9

using six significant digits with chopping in your calculations. Repeat the problem, but now use five significant digits with chopping in your calculations.

Solution

Putting the equations in the matrix form, we get

[20151032.2497513][x1x2x3]=[451.7519]

The augmented matrix is

[201510|4532.2497|1.751513|9]

Forward Elimination of Unknowns

First step

Divide Row 1 by 20 and then multiply it by 3, that is, multiply Row 1 by 3/20=0.15.

([20  15  10   |   45] )×0.15 gives Row 1 as

[3  2.25  1.5   |   6.75]

Subtract the result from Row 2

  [3   2.249     7      |1.751][3    2.25  1.5     |6.75]    0     0.001    8.5     8.501 to get the resulting equations as

[201510|4500.0018.5|8.501513|9]

Divide Row 1 by 20 and then multiply it by 5, that is, multiply Row 1 by 5/20=0.25.

[20  15  10   |   45] ×0.25 gives Row 1 as

[5  3.75  2.5   |   11.25]

Subtract the result from Row 3

  [5      1      3       |9][5    3.75     2.5     |11.25]   0 2.75      0.5 2.25

to get the resulting equations as

[201510|4500.0018.5|8.50102.750.5|2.25]

Second step

Now for the second step of the forward elimination part, we will use Row 2 as the pivot equation and eliminate Row 3: Column 2.

Divide Row 2 by 0.001 and then multiply it by 2.75; that is, multiply Row 2 by 2.75/0.001=2750.

[0  0.001  8.5   |   8.501] ×2750 gives Row 2 as

[0  2.75  23375   |   23377.75]

Rewriting within 5 significant digits with chopping gives

[0  2.75  23375   |   23377]

Subtract the result from Row 3

  [0      2.75      0.5       |2.25][0    2.75     23375   |23377]   0          0           23375.5        23374.75

Rewriting with 5 significant digits with chopping gives

[0  0  23375   |   23374]

to get the resulting equations as

[201510|4500.0018.5|8.5010023375|23374]

This marks the end of the forward elimination part.

Back substitution

We can now solve the above equations by back substitution. From the third equation,

23375x3=23374x3=2337423375=0.99995

Substituting the value of x3 in the second equation

0.001x2+8.5x3=8.501

x2=8.5018.5x30.001=8.5018.5×0.999950.001=8.5018.4995750.001=8.5018.49950.001=0.00150.001=1.5

Substituting the value of x3 and x2 in the first equation,

20x1+15x2+10x3=45

x1=4515x210x320=4515×1.510×0.9999520=4522.59.999520=22.59.999520=12.500520=12.50020=0.625

This marks the end of the back substitution part.

Hence, the solution is

[X]=[x1x2x3]=[0.6251.50.99995]

Compare this with the exact solution of

[X]=[x1x2x3]=[111]

Reducing the number of significant digits carried from 6 to 5 results in a substantial round-off error. In the next lesson, we will discuss how we can alleviate the two pitfalls of the Naive Gauss elimination method.

Audiovisual Lecture

Title: Pitfalls of Naive Gaussian Elimination

Summary: This video discusses the pitfalls of Naive Gauss elimination and possible solutions to the pitfalls.

Lesson 5: Theory of Gaussian Elimination with Partial Pivoting Method

Learning Objectives

After successful completion of this lesson, you should be able to

1) write the algorithm to solve a set of simultaneous linear equations using Gaussian elimination with Partial Pivoting.

What are some techniques for improving the Naïve Gauss elimination method?

As seen in the examples in the previous lesson, round-off errors were large when five significant digits were used as opposed to six significant digits. One method of decreasing the round-off error would be to use more significant digits, that is, use double or quad precision for representing the numbers. However, this would not avoid possible division by zero errors in the Naïve Gauss elimination method. To avoid division by zero as well as reduce (not eliminate) round-off error, Gaussian elimination with partial pivoting is the method of choice.

How does Gaussian elimination with partial pivoting differ from Naïve Gauss elimination?

The two methods are the same, except at the beginning of each step of the forward elimination part, a row switching is done based on the following criterion. If there are n equations, then there are n - 1 steps of the forward elimination part. At the beginning of the k^{th} step of the forward elimination part, one finds the maximum of

\left| a_{kk} \right|, \left| a_{k + 1,k} \right|, \ldots\ldots, \left| a_{nk} \right| \nonumber

Then if the maximum of these values is \left| a_{pk} \right| , k \leq p \leq n, then switch rows p and k.

The other steps of the forward elimination part are the same as the Naïve Gauss elimination method. The back substitution part stays exactly the same as the Naive Gauss elimination method.

Lesson 6: Application of Gaussian Elimination with Partial Pivoting Method

Learning Objectives

After successful completion of this lesson, you should be able to:

1) solve a set of simultaneous linear equations using the Gauss elimination method with partial pivoting

Applications

In the previous lessons, you learned why we modify the Naive Gauss elimination method to the Gaussian elimination with partial pivoting. Then we discussed, the theory behind the method. In this lesson, we will apply the theory to solve a set of simultaneous linear equations.

Example \PageIndex{6.1}

In the examples in the previous lesson, we used Naive Gauss elimination to solve

\begin{split} 20x_{1} + 15x_{2} + 10x_{3} &= 45\\ - 3x_{1} - 2.249x_{2} + 7x_{3} &= 1.751\\ 5x_{1} + x_{2} + 3x_{3} &= 9 \end{split} \nonumber

using five and six significant digits with chopping in the calculations. When we used five significant digits with chopping, the solution found was

\begin{split} \left\lbrack X \right\rbrack &= \begin{bmatrix} x_{1} \\ x_{2} \\ x_{3} \\ \end{bmatrix}\\ &= \begin{bmatrix} 0.625 \\ 1.5 \\ 0.99995 \\ \end{bmatrix} \end{split} \nonumber

This is quite different from the exact solution of

\begin{split} \left\lbrack X \right\rbrack &= \begin{bmatrix} x_{1} \\ x_{2} \\ x_{3} \\ \end{bmatrix}\\ &= \begin{bmatrix} 1 \\ 1 \\ 1 \\ \end{bmatrix} \end{split} \nonumber

Redo using Gaussian elimination with partial pivoting. Use five significant digits with chopping in all your calculations.

Solution

The augmented matrix is

\begin{bmatrix} 20 & 15 & 10 & | & 45 \\ -3 & -2.249 & 7 & | & 1.751 \\ 5 & 1 & 3 & | & 9 \\ \end{bmatrix} \nonumber

Forward Elimination of Unknowns

Now for the first step of the forward elimination part, the absolute value of the first column elements below Row 1 is

\left| 20 \right|,\left| - 3 \right|,\left| 5 \right| \nonumber

or

20,\ 3,\ 5 \nonumber

So, the largest absolute value is in Row 1. So as per Gaussian elimination with partial pivoting, the switch is between Row 1 and Row 1 to give

\begin{bmatrix} 20 & 15 & 10 & | & 45 \\ -3 & -2.249 & 7 & | & 1.751 \\ 5 & 1 & 3 & | & 9 \\ \end{bmatrix} \nonumber

Divide Row 1 by 20 and then multiply it by -3, that is, multiply Row 1 by \displaystyle - 3/20 = - 0.15.

( \left\lbrack 20\ \ 15\ \ 10\ \ \ |\ \ \ 45 \right\rbrack \ ) \times - 0.15\ \text{gives Row 1 as} \nonumber

\left\lbrack - 3 \ \ - 2.25 \ \ - 1.5 \ \ \ | \ \ \ - 6.75 \right\rbrack \nonumber

Subtract the result from Row 2

\frac{\begin{matrix} \ \ \lbrack\begin{matrix} -3 & \ \ \ -2.249 & \ \ \ \ \ 7 \\ \end{matrix}\ \ \ \ \ \ | & 1.751\rbrack \\ - \begin{matrix} \lbrack -3 & \ \ \ \ -2.25 \ \ -1.5 \ \ \\ \end{matrix}\ \ \ | & -6.75\rbrack \\ \end{matrix}}{\ \ \ \ \begin{matrix} \begin{matrix} 0 & \ \ \ \ \ 0.001 & \ \ \ \ 8.5 \\ \end{matrix} & \ \ \ \ \ 8.501 \end{matrix}} \nonumber

to get the resulting equations as

\begin{bmatrix} 20 & 15 & 10 & | & 45 \\ 0 & 0.001 & 8.5 & | & 8.501 \\ 5 & 1 & 3 & | & 9 \\ \end{bmatrix} \nonumber

Divide Row 1 by 20 and then multiply it by 5, that is, multiply Row 1 by 5/20 = 0.25.

\left\lbrack 20\ \ 15\ \ 10\ \ \ |\ \ \ 45 \right\rbrack \ \times 0.25\ \text{gives Row 1 as} \nonumber

\left\lbrack 5 \ \ 3.75\ \ 2.5 \ \ \ | \ \ \ 11.25 \right\rbrack \nonumber

Subtract the result from Row 3

\displaystyle \frac{\begin{matrix} \ \ \lbrack\begin{matrix} 5 & \ \ \ \ \ \ 1 & \ \ \ \ \ \ 3 \\ \end{matrix}\ \ \ \ \ \ \ | & 9\rbrack \\ - \begin{matrix} \lbrack 5 & \ \ \ \ 3.75 \ \ \ \ \ 2.5 \ \ \\ \end{matrix}\ \ \ | & 11.25\rbrack \\ \end{matrix}}{\ \ \ \begin{matrix} \begin{matrix} 0 &\ -2.75 \ \ \ \ \ \ 0.5 \\ \end{matrix} & \ -2.25 \end{matrix}} \nonumber

to get the resulting equations as

\begin{bmatrix} 20 & 15 & 10 & | & 45 \\ 0 & 0.001 & 8.5 & | & 8.501 \\ 0 & -2.75 & 0.5 & | & -2.25 \\ \end{bmatrix} \nonumber

This marks the end of the first step of the forward elimination part.

Now for the second step of the forward elimination part, the absolute value of the second column elements below Row 1 is

\left| 0.001 \right|,\left| - 2.75 \right| \nonumber

or

0.001,\ 2.75 \nonumber

So, the largest absolute value is in Row 3. So, Row 2 is switched with Row 3 to give

\begin{bmatrix} 20 & 15 & 10 & | & 45 \\ 0 & -2.75 & 0.5 & | & -2.25 \\ 0 & 0.001 & 8.5 & | & 8.501 \\ \end{bmatrix} \nonumber

Divide Row 2 by -2.75 and then multiply it by 0.001, that is, multiply Row 2 by 0.001/ - 2.75 = - 0.00036363.

\left\lbrack 0 \ \ - 2.75\ \ 0.5 \ \ \ |\ \ \ - 2.25 \right\rbrack \ \times - 0.00036363\ \text{gives Row 2 as} \nonumber

\left\lbrack 0 \ \ \ 0.00099998 \ \ \ - 0.00018182 \ \ \ |\ \ \ 0.00081816 \right\rbrack \nonumber

Subtract the result from Row 3

\displaystyle \frac{\begin{matrix} \ \ \ \lbrack \begin{matrix} 0 & \ \ \ \ \ \ \ \ \ \ \ 0.001 \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 8.5 \\ \end{matrix} \ \ \ \ \ \ \ \ \ \ \ \ \ \ | & 8.501\rbrack \\ - \begin{matrix} \lbrack 0 & \ \ \ \ 0.00099998 \ \ \ \ \ -0.00018182 \ \ \\ \end{matrix}\ \ \ | & 0.00081816\rbrack \\ \end{matrix}}{\ \ \begin{matrix} \ \begin{matrix} 0 &\ \ \ \ \ \ \ \ \ \ \ 0 \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 8.50018182 \\ \end{matrix} & \ \ \ \ \ \ \ \ \ 8.50018184 \end{matrix}} \nonumber

Rewriting within 5 significant digits with chopping

\left\lbrack 0 \ \ \ 0 \ \ \ 8.5001 \ \ \ | \ \ \ 8.5001 \right\rbrack \nonumber

to get the resulting equations as

\begin{bmatrix} 20 & 15 & 10 & | & 45 \\ 0 & -2.75 & 0.5 & | & -2.25 \\ 0 & 0 & 8.5001 & | & 8.5001 \\ \end{bmatrix} \nonumber

Back substitution

8.5001x_{3} = 8.5001 \nonumber

\begin{split} x_{3} &= \frac{8.5001}{8.5001}\\ &= 1 \end{split} \nonumber

Substituting the value of x_{3} in Row 2

- 2.75x_{2} + 0.5x_{3} = - 2.25 \nonumber

\begin{split} x_{2} &= \frac{- 2.25 - 0.5x_{3}}{- 2.75}\\ &= \frac{- 2.25 - 0.5 \times 1}{- 2.75}\\ &= \frac{- 2.25 - 0.5}{- 2.75}\\ &= \frac{- 2.75}{- 2.75}\\ &= 1\end{split} \nonumber

Substituting the value of x_{3} and x_{2} in Row 1

20x_{1} + 15x_{2} + 10x_{3} = 45 \nonumber

\begin{split} x_{1} &= \frac{45 - 15x_{2} - 10x_{3}}{20}\\ &= \frac{45 - 15 \times 1 - 10 \times 1}{20}\\ &= \frac{45 - 15 - 10}{20}\\ &= \frac{30 - 10}{20}\\ &= \frac{20}{20}\\ &= 1 \end{split} \nonumber

So, the solution is

\begin{split} \left\lbrack X \right\rbrack &= \begin{bmatrix} x_{1} \\ x_{2} \\ x_{3} \\ \end{bmatrix}\\ &= \begin{bmatrix} 1 \\ 1 \\ 1 \\ \end{bmatrix} \end{split} \nonumber

This, in fact, is the exact solution. By coincidence only, in this case, the round-off error is not only reduced but fully removed.

Add example text here.

Example \PageIndex{6.2}

The upward velocity of a rocket is given at three different times in Table \PageIndex{6.1}.

Table \PageIndex{6.1}. Velocity vs. time data.
Time, t \ (\text{s}) Velocity, v \ (\text{m/s})
5 106.8
8 177.2
12 279.2

The velocity data is approximated by a polynomial as

v\left( t \right) = a_{1}t^{2} + a_{2}t + a_{3},5 \leq t \leq 12 \nonumber

The coefficients a_{1}, a_{2}, and a_{3} for the above expression are given by

\begin{bmatrix} 25 & 5 & 1 \\ 64 & 8 & 1 \\ 144 & 12 & 1 \\ \end{bmatrix}\begin{bmatrix} a_{1} \\ a_{2} \\ a_{3} \\ \end{bmatrix} = \begin{bmatrix} 106.8 \\ 177.2 \\ 279.2 \\ \end{bmatrix} \nonumber

Find the values of a_{1},a_{2}, and a_{3} using the Gaussian elimination method with partial pivoting showing 6 significant digits. Find the velocity at t = 6,\ 7.5,\ 9,\ 11 seconds.

Solution

The augmented matrix is

\begin{bmatrix} 25 & 5 & 1 & | & 106.8 \\ 64 & 8 & 1 & | & 177.2 \\ 144 & 12 & 1 & | & 279.2 \\ \end{bmatrix} \nonumber

Forward Elimination of unknowns

For the first step of the forward elimination part, the absolute value of the first column elements is

|25|,\ |64|,\ |144| \nonumber

or

25,\ 64,\ 144 \nonumber

So, the largest absolute value is in Row 3. As per the Gaussian elimination with partial pivoting, we switch Row 3 by Row 1 to give

\begin{bmatrix} 144 & 12 & 1 & | & 279.2 \\ 64 & 8 & 1 & | & 177.2 \\ 25 & 5 & 1 & | & 106.8 \\ \end{bmatrix} \nonumber

Divide Row 1 by 144 and then multiply it be 64, that is, multiply Row 1 by 64/144 = 0.444444

(\lbrack 144\ \ \ 12\ \ \ 1\ \ \ |\ \ \ 279.2\rbrack) \times 0.444444\ \text{gives Row 1 as} \nonumber

\lbrack 64\ \ \ 5.33333\ \ \ 0.444444\ \ \ |\ \ \ 124.089\rbrack \nonumber

Subtract the result from Row 2

\frac{\begin{matrix} \ \ \ \ \lbrack\begin{matrix} 64 & \ \ \ \ 8 & \ \ \ \ \ \ \ \ \ \ \ 1 \\ \end{matrix}\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ |\ \ & 177.2\rbrack \\ - \lbrack\begin{matrix} 64 & 5.33333 & 0.444444 \\ \end{matrix}\ \ \ \ \ | & 124.089\rbrack \\ \end{matrix}}{\begin{matrix} \begin{matrix} \ \ \ \ \ \ 0 & \ \ 2.66667 & 0.555556 \\ \end{matrix} & \ \ \ \ \ \ \ \ 53.1111 \\ \end{matrix}} \nonumber

to get the resulting equation as

\begin{bmatrix} 144 & 12 & 1 & | & 279.2 \\ 0 & 2.66667 & 0.555556 & | & 53.1111 \\ 25 & 5 & 1 & | & 106.8 \\ \end{bmatrix} \nonumber

Divide Row 1 by 144 and then multiply it by 25, that is, multiply Row 1 by 25/144 = 0.173611.

(\lbrack 144\ \ \ 12\ \ \ 1\ \ \ |\ \ \ 279.2\rbrack) \times 0.173611\ \text{gives Row 1 as} \nonumber

\lbrack 25\ \ \ 2.08333\ \ 0.172611\ \ \ |\ \ \ \ 48.4722\rbrack \nonumber

Subtract the result from Row 3

\frac{\begin{matrix} \ \ \ \ \lbrack\begin{matrix} 25 & 5 & \ \ \ \ \ \ \ \ \ \ \ \ \ 1 \\ \end{matrix}\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ | & 106.8\rbrack \\ - \begin{matrix} \lbrack 25 & 2.08333 & 0.173611 \\ \end{matrix}\ \ \ \ \ \ \ \ | & 48.4722\rbrack \\ \end{matrix}}{\ \ \ \ \begin{matrix} \begin{matrix} 0 \ \ \ & 2.91667 & 0.826389 \\ \end{matrix} & \ \ \ \ \ \ \ 58.3278 \\ \end{matrix}} \nonumber

to get the resulting equations as

\begin{bmatrix} 144 & 12 & 1 & | & 279.2 \\ 0 & 2.66667 & 0.555556 & | & 53.1111 \\ 0 & 2.91667 & 0.826389 & | & 58.3278 \\ \end{bmatrix} \nonumber

This marks the end of the first step of forward elimination part.

Now for the second step of forward elimination part, the absolute value of the second column elements in Row 2 and below are

|2.66667|,\ |2.91667| \nonumber

or

2.66667,\ 2.91667 \nonumber

The largest value is in Row 3. So, Row 2 is switched with Row 3 to give

\begin{bmatrix} 144 & 12 & 1 & | & 279.2 \\ 0 & 2.91667 & 0.826389 & | & 58.3278 \\ 0 & 2.66667 & 0.555556 & | & 53.1111 \\ \end{bmatrix} \nonumber

Divide Row 2 by 2.91667, then multiply it by 2.66667, that is, multiply Row 2 by 2.66667/2.91667 = 0.914286.

(\lbrack 0\ \ \ 2.91667\ \ \ 0.826389\ \ \ \ |\ \ \ 58.3278\rbrack)\ \times \ 0.914286\ \text{gives Row 2 as} \nonumber

\lbrack 0\ \ \ 2.66667\ \ \ 0.755556\ \ \ \ |\ \ \ \ 53.3283\rbrack \nonumber

Subtract the result from Row 3

\frac{\begin{matrix} {\ \ \ \ }\lbrack\begin{matrix} 0\ \ \ \ & {\ \ \ \ }2.66667 & {\ \ \ \ \ \ \ }0.555556 \\ \end{matrix}\ \ \ \ \ \ \ \ \ | & 53.1111\rbrack \\ - \begin{matrix} \lbrack 0\ \ \ \ \ & {\ \ \ }2.66667 & \ \ \ \ \ \ \ 0.755556\ \ \ \ \ \ \ \ \\ \end{matrix}\ \ | & 53.3283\rbrack \\ \end{matrix}}{\ \ \ \ \begin{matrix} \begin{matrix} \ 0\ \ {\ \ \ \ \ \ \ } & 0\ & \ \ \ \ \ \ \ \ \ \ \ \ \ - 0.2\ \\ \end{matrix} & {\ \ \ } \\ \end{matrix}{\ \ \ \ }{\ \ } - 0.217189} \nonumber

to get the resulting equations as

\begin{bmatrix} 144 & 12 & 1 & | & 279.2 \\ 0 & 2.91667 & 0.826389 & | & 58.3278 \\ 0 & 0 & - 0.2 & | & - 0.217189 \\ \end{bmatrix} \nonumber

Back Substitution

- 0.2a_{3}\ = \ - 0.217189 \nonumber

\begin{split} a_{3}\ &= \ \frac{- 0.217189}{- 0.2}\\ a_{3}\ &= 1.08595\end{split} \nonumber

Substituting the value of a_{3} in Row 2

2.91667a_{2} + 0.826389a_{3}\ = \ 58.3278 \nonumber

\begin{split} a_{2}\ &= \frac{58.3278 - 0.826389 \times a_{3}}{2.91667}\\ &= \ \frac{58.3278 - 0.826389 \times 1.08595}{2.91667}\\ &= \frac{57.4304}{2.91667}\\ &= 19.6903 \end{split} \nonumber

Substituting the value of a_{3} and a_{2} in Row 1

144a_{1} + 12a_{2} + {1a}_{3}\ = \ 279.2 \nonumber

\begin{split} a_{1} &= \frac{279.2 - 12a_{2} - 1a_{3}}{144}\\ &= \frac{279.2 - 12 \times 19.6903 - 1.08595}{144}\\ &= \frac{41.8305}{144}\\ &= 0.290489 \end{split} \nonumber

Hence, the solution vector is

\begin{bmatrix} a_{1} \\ a_{2} \\ a_{3} \\ \end{bmatrix} = \begin{bmatrix} 0.290489 \\ 19.6903 \\ 1.08595 \\ \end{bmatrix} \nonumber

The polynomial that passes through the three data points is then

\begin{split} v\left( t \right) &= a_{1}t^{2} + a_{2}t + a_{3}\\ &= 0.290489t^{2} + 19.6903t + 1.08595,\ \ 5 \leq t \leq 12 \end{split} \nonumber

Since we want to find the velocity at t = 6,\ 7.5,\ 9\ and\ 11 seconds, we could simply substitute each value of t in v\left( t \right) = 0.290489t^{2} + 19.6903t + 1.08595 and find the corresponding velocity. For example, at t = 6

\begin{split} v\left( 6 \right) &= 0.290489{(6)}^{2} + 19.6903(6) + 1.08595\\ &= \ 129.685\ \text{m/s} \end{split} \nonumber

However, we could also find all the needed values of velocity at t = 6,\ 7.5,\ 9,\ 11 seconds using matrix multiplication.

v\left( t \right) = \left\lbrack 0.290489\ \ 19.6903\ \ 1.08595 \right\rbrack\begin{bmatrix} t^{2} \\ t \\ 1 \\ \end{bmatrix} \nonumber

So, if we want to find v\left( 6 \right),\ v\left( 7.5 \right),\ v\left( 9 \right),\ v\left( 11 \right), it is given by

\begin{split}\left\lbrack v\left( 6 \right)v\left( 7.5 \right)v\left( 9 \right)v\left( 11 \right) \right\rbrack &= \left\lbrack 0.290489\ \ 19.6903\ \ 1.08595 \right\rbrack\begin{bmatrix} 6^{2} & 7.5^{2} & 9^{2} & 11^{2} \\ 6 & 7.5 & 9 & 11 \\ 1 & 1 & 1 & 1 \\ \end{bmatrix} \\ &= \left\lbrack 0.290489\ \ 19.6903\ \ 1.08595 \right\rbrack\begin{bmatrix} 36 & 56.25 & 81 & 121 \\ 6 & 7.5 & 9 & 11 \\ 1 & 1 & 1 & 1 \\ \end{bmatrix}\\ &= \left\lbrack 129.685\ \ 165.103\ \ 201.828\ \ 252.828 \right\rbrack \end{split} \nonumber

v(6) = 129.685\ \text{m/s} \nonumber

v(7.5) = 165.103\ \text{m/s} \nonumber

v(9) = 201.828\ \text{m/s} \nonumber

v(11) = 252.828\ \text{m/s} \nonumber

Audiovisual Lecture

Title: Gaussian Elimination with Partial Pivoting: Theory

Summary: This video discusses how Gaussian Elimination with partial pivoting works. Be sure to learn how Naive Gauss elimination method works before you venture into this topic.

Multiple Choice Test

(1). The goal of the forward elimination part in the Naive Gauss elimination method is to reduce the coefficient matrix to a(n) _____________ matrix.

(A) diagonal

(B) identity

(C) lower triangular

(D) upper triangular

(2). Division by zero during the forward elimination part in Naive Gaussian elimination of the set of equations \left\lbrack A \right\rbrack\left\lbrack X \right\rbrack = \left\lbrack C \right\rbrack implies the coefficient matrix \left\lbrack A \right\rbrack

(A) is invertible

(B) is nonsingular

(C) may be singular or nonsingular

(D) is singular

(3). Using a computer with four significant digits with chopping, the Naive Gauss elimination solution to

\begin{matrix} 0.0030x_{1} + 55.23x_{2} = 58.12 \\ 6.239x_{1} - 7.123x_{2} = 47.23 \\ \end{matrix} \nonumber is

(A) x_{1} = 26.66;\ x_{2} = 1.051

(B) x_{1} = 8.769;\ x_{2} = 1.051

(C) x_{1} = 8.800;\ x_{2} = 1.000

(D) x_{1} = 8.771;\ x_{2} = 1.052

(4). Using a computer with four significant digits with chopping, the Gaussian elimination with partial pivoting method solution to

\begin{matrix} 0.0030x_{1} + 55.23x_{2} = 58.12 \\ 6.239x_{1} - 7.123x_{2} = 47.23 \\ \end{matrix} \nonumber is

(A) x_{1} = 26.66;\ x_{2} = 1.051

(B) x_{1} = 8.769;\ x_{2} = 1.051

(C) x_{1} = 8.800;\ x_{2} = 1.000

(D) x_{1} = 8.771;\ x_{2} = 1.052

(5). At the end of the forward elimination part of the Naive Gauss elimination method on the following equations

\begin{bmatrix} {4.2857 \times 10}^{7} & {- 9.2307 \times 10}^{5} & {0} & {0} \\ {4.2857 \times 10}^{7} & {- 5.4619 \times 10}^{5} & {- 4.2857 \times 10}^{7} & {5.4619 \times 10}^{5} \\ {- 6.5} & {- 0.15384} & {6.5} & {0.15384} \\ {0} & {0} & {4.2857 \times 10}^{7} & {- 3.6057 \times 10}^{5} \\ \end{bmatrix}{\ \ }\begin{bmatrix} {c}_{1} \\ {c}_{2} \\ {c}_{3} \\ {c}_{4} \\ \end{bmatrix} = \begin{bmatrix} {- 7.887 \times 10}^{3} \\ {0} \\ {0.007} \\ {0} \\ \end{bmatrix} \nonumber

the resulting equations in matrix form are given by

\begin{bmatrix} {4.2857 \times 10}^{7} & {- 9.2307 \times 10}^{5} & {0} & {0} \\ {0} & {3.7688 \times 10}^{5} & {- 4.2857 \times 10}^{7} & {5.4619 \times 10}^{5} \\ {0} & {0} & {- 26.9140} & {0.579684} \\ {0} & {0} & {0} & {5.62500 \times 10}^{5} \\ \end{bmatrix}{\ \ }\begin{bmatrix} {c}_{1} \\ {c}_{2} \\ {c}_{3} \\ {c}_{4} \\ \end{bmatrix} = \begin{bmatrix} {- 7.887 \times 10}^{3} \\ {7.887 \times 10}^{3} \\ {1.19530 \times 10}^{- 2} \\ {1.90336 \times 10}^{4} \\ \end{bmatrix} \nonumber

The determinant of the original coefficient matrix is

(A) 0.00

(B) 4.2857 \times 10^{7}

(C) 5.486 \times 10^{19}

(D) - 2.445 \times 10^{20}

(6). The following data is given for the velocity of the rocket as a function of time. To find the velocity at t = 21 \text{ s}, you are asked to use a quadratic polynomial, v(t) = at^{2} + {bt} + c, to approximate the velocity profile.

t \ (\text{s}) 0 14 15 20 30 35
v(t) \ (\text{m} / \text{s}) 0 227.04 362.78 517.35 602.97 901.67

The correct set of equations that will find a, b, and c are

(A) \begin{bmatrix} {176} & {14} & {1} \\ {225} & {15} & {1} \\ {400} & {20} & {1} \\ \end{bmatrix}\begin{bmatrix} {a} \\ {b} \\ {c} \\ \end{bmatrix} = \begin{bmatrix} {227.04} \\ {362.78} \\ {517.35} \\ \end{bmatrix}

(B) \begin{bmatrix} {225} & {15} & {1} \\ {400} & {20} & {1} \\ {900} & {30} & {1} \\ \end{bmatrix}\begin{bmatrix} {a} \\ {b} \\ {c} \\ \end{bmatrix} = \begin{bmatrix} {362.78} \\ {517.35} \\ {602.97} \\ \end{bmatrix}

(C) \begin{bmatrix} {0} & {0} & {1} \\ {225} & {15} & {1} \\ {400} & {20} & {1} \\ \end{bmatrix}\begin{bmatrix} {a} \\ {b} \\ {c} \\ \end{bmatrix} = \begin{bmatrix} {0} \\ {362.78} \\ {517.35} \\ \end{bmatrix}

(D) \begin{bmatrix} 400 & 20 & 1 \\ 900 & 30 & 1 \\ 1225 & 35 & 1 \\ \end{bmatrix}\begin{bmatrix} a \\ b \\ c \\ \end{bmatrix} = \begin{bmatrix} 517.35 \\ 602.97 \\ 901.67 \\ \end{bmatrix}

For complete solution, go to

http://nm.mathforcollege.com/mcquizzes/04sle/quiz_04sle_gaussianelimination_solution.pdf

Problem Set

(1). Use Naive Gauss elimination to solve

{4x_{1} + x_{2} - x_{3} = - 2} \nonumber {5x_{1} + x_{2} + 2x_{3} = 4} \nonumber {6x_{1} + x_{2} + x_{3} = 6} \nonumber

Answer

\left[\begin{matrix}x_1\\x_2\\x_3\\\end{matrix}\right]=\left[\begin{matrix}3\\-13\\1\\\end{matrix}\right]

(2). Assume that you are using a computer with four significant digits with chopping. Use the Naive Gauss elimination method to solve

{4x_{1} + x_{2} - x_{3} = - 2} \nonumber {5x_{1} + x_{2} + 2x_{3} = 4} \nonumber {6x_{1} + x_{2} + x_{3} = 6} \nonumber

Answer

\left[\begin{matrix}x_1\\x_2\\x_3\\\end{matrix}\right]=\left[\begin{matrix}3.000\\-13.00\\1.000\\ \end{matrix}\right]

(3). For

[A]= \begin{bmatrix} 10 & - 7 & 0 \\ - 3 & 2.099 & 6 \\ 5 & - 1 & 5 \\ \end{bmatrix} \nonumber

Find the determinant of [A] using the forward elimination part of Naive Gauss elimination method.

Answer

-150.05

(4). At the end of the forward elimination part of using the Naive Gauss elimination method on the coefficient matrix

[A]= \begin{bmatrix} 25 & c & 1 \\ 64 & a & 1 \\ 144 & b & 1 \\ \end{bmatrix}, \nonumber

[A] reduces to

[B]= \begin{bmatrix} 25 & 5 & 1 \\ 0 & - 4.8 & - 1.56 \\ 0 & 0 & 0.7 \\ \end{bmatrix} \nonumber \nonumber

What is the determinant of [A]?

Answer

-84

(5). Use Gaussian elimination with partial pivoting method to solve

{4x_{1} + x_{2} - x_{3} = - 2} \nonumber {5x_{1} + x_{2} + 2x_{3} = 4} \nonumber {6x_{1} + x_{2} + x_{3} = 6} \nonumber

Answer

\left[\begin{matrix}x_1\\x_2\\x_3\\\end{matrix}\right]=\left[\begin{matrix}3\\-13\\1\\\end{matrix}\right]

(6). Assume that you are using a computer with four significant digits with chopping, use Gaussian elimination with partial pivoting method to solve

{4x_{1} + x_{2} - x_{3} = - 2} \nonumber {5x_{1} + x_{2} + 2x_{3} = 4} \nonumber {6x_{1} + x_{2} + x_{3} = 6} \nonumber

Answer

\left[\begin{matrix}x_1\\x_2\\x_3\\\end{matrix}\right]=\left[\begin{matrix}2.998\\-12.99\\1.000\\\end{matrix}\right]


This page titled 4.06: Gaussian Elimination Method for Solving Simultaneous Linear Equations is shared under a CC BY-NC-SA 4.0 license and was authored, remixed, and/or curated by Autar Kaw via source content that was edited to the style and standards of the LibreTexts platform.

Support Center

How can we help?