Download pdf - Gauss Elimination

Transcript
Page 1: Gauss Elimination
Page 2: Gauss Elimination

• Graphical method

• Cramer's Rule

• The Elimination of

Unknowns

Page 3: Gauss Elimination

A graphical solution is obtainable for two equations by plotting on Cartesian

coordinates with one axis corresponding to x1 and the other x2.

a11 x1 + a12x2 = b1

a21 x1 + a22x2 = b2

Both equations can be solved for x2:

Thus, the equations are now in the form of straight lines; that is,

x1=(slope)x1+intercept.Yhese lines can be graphed on Cartesian coordinates with

x2 as the ordinate and x1 as the abscissa. The values of x1 and x2 at the

intersection of the lines represent the solution

Page 4: Gauss Elimination

Example Use the graphical method to solve :

Solution. Let x1 be the abscissa. Solve eq,1 and eq,2 for x2

Page 5: Gauss Elimination

0

1

2

3

4

5

6

7

8

9

0 1 2 3 4 5 6 7 8 9

X2

X1

Graphical Method

2

1

Solution x1=4 x2=3

Graphical solution of a set of two simultaneous linear algebraic

equations. The intersection of the lines represents the solution

Page 6: Gauss Elimination

Cramer´s rule is another solution technique that is

best suited to small numbers of equation .

This rule states that each unknown in a system of

linear algebraic equations may be expressed as a

fraction of two determinants with denominator D and

with the numerator obtained from D by replacing the

column of coefficients of the unknown in question by

the constants b1, b2,b3 … bn, for example ,x1 would

be computed as

𝑥1 =

𝑏1 𝑎12 𝑎13

𝑏2 𝑎22 𝑎23

𝑏3 𝑎23 𝑎33

𝐷

Page 7: Gauss Elimination

Example:

Use Cramer´s rule to solve

𝒙 + 𝟎𝒚 − 𝟐𝒛 = 𝟑𝟎𝒙 − 𝒚 + 𝟑𝒛 = 𝟏

𝟐𝒙 + 𝟎𝒚 + 𝟓𝒚 = 𝟎

𝐷 =1 0 −20 −1 32 0 5

𝐷𝑥 =3 0 −21 −1 30 0 5

𝐷𝑦 =1 3 −20 1 32 0 5

𝐷𝑧 =1 0 30 −1 12 0 0

The determinant can be written as det D=-9, det Dx=-15, det Dy=27 y det

Dz=6. Therefore 𝒙 =−𝟏𝟓

−𝟗 𝒚 =

𝟐𝟕

−𝟗 𝒛 =

𝟔

−𝟗

Page 8: Gauss Elimination

The elimination of unknowns by combining equations is an algebraic

approach that can be illustrated for a set of two equations:

𝑎11𝑥1 + 𝑎12𝑥2 = 𝑏1

𝑎21𝑥1 + 𝑎22𝑥2 = 𝑏2

The basic strategy is to multiply the equations by constants so that one of the

unknowns will be eliminated when the two equations are combined. The result

is a single equation that can be solved for the remaining unknown, and this

value can then be substituted into either of the original equations to compute

the other variable

𝑎21(𝑎11𝑥1 + 𝑎12𝑥2) = 𝑏1𝑎21 𝑎11(𝑎21𝑥1 + 𝑎22𝑥2) = 𝑏2𝑎11

Page 9: Gauss Elimination

This method to solve equations is called

Naïve Gauss Elimination because it does

not avoid division by zero. The technique

for n equations consists of two phases :

• Elimination of unknowns

• Solution through back substitution

Page 10: Gauss Elimination

𝒂𝟏𝟏 𝒂𝟏𝟐 𝒂𝟏𝟑

𝒂𝟐𝟏 𝒂𝟐𝟐 𝒂𝟐𝟑

𝒂𝟑𝟏 𝒂𝟐𝟑 𝒂𝟑𝟑

=

𝒃𝟏

𝒃𝟐

𝒃𝟑

𝒂𝟏𝟏 𝒂𝟏𝟐 𝒂𝟏𝟑

𝟎 𝒂´𝟐𝟐 𝒂´𝟐𝟑

𝟎 𝟎 𝒂´´𝟑𝟑

=

𝒃𝟏

𝒃´𝟐

𝒃´´𝟑

𝒙𝟑 =𝒃´´𝟑

𝒂´´𝟑𝟑

𝒙𝟐 =𝒃´𝟐 − 𝒂´𝟐𝟑

𝒂´𝟐𝟐

𝒙𝟏 = (𝒃𝟏 − 𝒂𝟏𝟐𝒙𝟐 − 𝒂𝟏𝟑𝒙𝟑)/𝒂𝟏𝟏

The first phase is designed to reduce the set of

equation to an upper triangular system.

Multiply eq.1 by 𝑎21/𝑎11 to give:

𝑎21 +𝑎21

𝑎11𝑎12𝑥2+. .+ +

𝑎21

𝑎11𝑎1𝑛𝑥𝑛 = +

𝑎21

𝑎11𝑏1

Now this equation can be subtracted from eq.2

to give:

𝑎22 − +𝑎21

𝑎11𝑎12 𝑥2+..+ 𝑎2𝑛 − +

𝑎21

𝑎11𝑎1𝑛 𝑥𝑛 = 𝑏2 −

𝑎21

𝑎11𝑏1

or

𝑎´´22𝑥2+. . +𝑎´´2𝑛𝑥𝑛 = 𝑏´2

Where the prime indicates that the elements have been

changed from their original values. The procedure is

then repeated for the remaining equations. eq,. Can be

multiplied by 𝑎31

𝑎11 and the result can be subtracted from

the third equation. Now the equations are solved

starting from the last equation as it has only one

unknown by back sustitution.

𝑎11𝑥1 + 𝑎12𝑥2 + 𝑎13𝑥3+. . +𝑎𝑛𝑛𝑥𝑛 = 𝑏1

𝑎21𝑥1 + 𝑎22𝑥2 + 𝑎23𝑥3+. . +𝑎𝑛𝑛𝑥𝑛 = 𝑏2

𝑎𝑛1𝑥1 + 𝑎𝑛2𝑥2 + 𝑎𝑛3𝑥3+. . +𝑎𝑛𝑛𝑥𝑛 = 𝑏𝑛

.

.

Page 11: Gauss Elimination

Example: Use Naïve Gauss elimination to solve

Working in the matrix form

First step

Divide Row 1 by 20 and then multiply it by –3, that is, multiply Row 1 by

Subtract the result from Row 2

Page 12: Gauss Elimination

to get the resulting equations as

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

Subtract the result from Row 3

to get the resulting equations as

Page 13: Gauss Elimination

Second step

Now for the second step of forward elimination, we will use Row 2 as

the pivot equation and eliminate Row 3 Column 2 to get the resulting

equations as

Back substitution

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

equation

Substituting the value of in the second equation

Page 14: Gauss Elimination

Substituting the value of and in the first equation,

Hence the solution is

Page 15: Gauss Elimination

Division by zero: It is possible for division by zero to occur during the beginning

of the steps of forward elimination.

For example

will result in division by zero in the first step of forward elimination as the

coefficient of in the first equation is zero as is evident when we write the

equations in matrix form.

Page 16: Gauss Elimination

Another example

There is no issue of division by zero in the first step of forward elimination. The pivot

element is the coefficient of in the first equation, 5, and that is a non-zero number.

However, at the end of the first step of forward elimination, Now at the beginning of

the 2nd step of forward elimination, the coefficient of in Equation 2 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 step of forward elimination.

Round-off error: The Naïve Gauss elimination method is prone to round-off errors.

This is true when there are large numbers of equations as errors propagate. Also, if

there is subtraction of numbers from each other, it may create large errors.

Page 17: Gauss Elimination

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.

Page 18: Gauss Elimination

Gauss-Jordan Elimination is a variant of Gaussian

Elimination. Again, we are transforming the coefficient

matrix into another matrix that is much easier to solve, and

the system represented by the new augmented matrix has

the same solution set as the original system of linear

equations. In Gauss-Jordan Elimination, the goal is to

transform the coefficient matrix into a diagonal matrix, and

the zeros are introduced into the matrix one column at a

time

Gauss-Jordan Elimination Steps

• Write the augmented matrix for the system of linear equations.

• Use elementary row operations on the augmented matrix [A|b] to

transform A into diagonal form. If a zero is located on the diagonal,

switch the rows until a nonzero is in that place. If you are unable to do

so, stop; the system has either infinite or no solutions.

• By dividing the diagonal element and the right-hand-side element in

each row by the diagonal element in that row, make each diagonal

element equal to one.

Page 19: Gauss Elimination

Example:

In Gauss-Jordan Elimination we want to introduce zeros both below and

above the diagonal.

1. Write the augmented matrix for the system of linear equations.

As before , we use the symbol to indicate that the matrix

preceding the arrows is being changed due to the specified

operation; the matrix following the arrow displays the result of that

change.

Page 20: Gauss Elimination

2. Use elementary row operations on the augmented matrix [A|b] to

transform A into diagonal form

At this point we have a diagonal coefficient matrix. The final step in Gauss-

Jordan Elimination is to make each diagonal element equal to one. To do this,

we divide each row of the augmented matrix by the diagonal element in that row

Page 21: Gauss Elimination

3. By dividing the diagonal element and the right-hand-side element in

each row by the diagonal element in that row, make each diagonal

element equal to one.

Our solution is simply the right-hand side of the augmented matrix.

Notice that the coefficient matrix is now a diagonal matrix with ones on

the diagonal. This is a special matrix called the identity matrix

Page 22: Gauss Elimination

The LU decomposition is a matrix decomposition which writes a matrix as the

product of a lower triangular matrix and an upper triangular matrix. The product

sometimes includes a permutation matrix as well. This decomposition is used in

numerical analysis to solve systems of linear equations or calculate the

determinant.

Definition 1 If A is a square matrix and it can be factored as A = LU where L is a

lower triangular matrix and U is an upper triangular matrix, then we say that A

has an LU Decomposition of LU.

Theorem 1 If A is a square matrix and it can be reduced to a row-echelon form,

U, without interchanging any rows then A can be factored as A = LU where L is a

lower triangular matrix

Page 23: Gauss Elimination

We’re not going to prove this theorem but let’s examine it in some detail

and we’ll find a way to determine a way of determining L. Let’s start off by

assuming that we’ve got a square matrix A and that we are able to reduce

it row-echelon form U without interchanging any rows. We know that each

row operation that we used has a corresponding elementary matrix, so

let’s suppose that the elementary matrices corresponding to the row

operations we used are 𝐸1𝐸2 … 𝐸𝑘.

We also know that elementary matrices are invertible so let’s multiply

each side by the inverses

Page 24: Gauss Elimination

Now, it can be shown that provided we avoid interchanging rows the elementary

row operations that we needed to reduce A to U will all have corresponding

elementary matrices that are lower triangular matrices. We also know from the

previous section that inverses of lower triangular matrices are lower triangular

matrices and products of lower triangular matrices are lower triangular matrices.

In other words,

is a lower triangular matrix and so using this we get the LU-Decomposition for

A of A = LU .

Example 1 Determine an LU-Decomposition for the following matrix and use the

LU-Decomposition method to find the solution to the following system of

equations.

Page 25: Gauss Elimination

So, first let’s go through the row operations to get this into row-echelon form

and remember that we aren’t allowed to do any interchanging of rows. Also,

we’ll do this step by step so that we can keep track of the row operations that

we used since we’re going to need to write down the elementary matrices that

are associated with them eventually.

Page 26: Gauss Elimination

And we have got U

Page 27: Gauss Elimination

Now we need to get L. This is going to take a little more work. We’ll need the

elementary matrices for each of these, or more precisely their inverses. Recall

that we can get the elementary matrix for a particular row operation by applying

that operation to the appropriately sized identity matrix (3´3 in this case). Also

recall that the inverse matrix can be found by applying the inverse operation to the

identity matrix.

Here are the elementary matrices and their inverses for each of the operations

above.

Page 28: Gauss Elimination

we know can compute L.

Page 29: Gauss Elimination

We can verify that we’ve gotten an LU-Decomposition with a quick computation

SOLUTION SYSTEM: Now we are going to let’s write down the matrix form of

the system

According to the method outlined above this means that we actually need to

solve the following two systems

and

Page 30: Gauss Elimination

So, let’s get started on the first one. Notice that we don’t really need to do

anything other than write down the equations that are associated with this

system and solve using forward substitution. The first equation will give us

𝑦1 for free and once we know that the second equation will give us 𝑦2.

Finally, with these two values in hand the third equation will give us 𝑦3 . Here

is that work.

The second system that we need to solve is then,

Page 31: Gauss Elimination

Again, notice that to solve this all we need to do is write down the equations and

do back substitution. The third equation will give us 𝑥3 for free and plugging

this into the second equation will give us 𝑥2.. etc. Here’s the work for this.

Page 32: Gauss Elimination

• Computational Science: Tools for a Changing World A High School

Curriculum by Richard A. Tapia and Cynthia Lanius

• numericalmethods.eng.usf.edu/.../mws_gen_sle_txt_gaussian.doc

• LINEAR ALGEBRA, Systems of Equations and Matrices by Paul

Dawkins

• http://ceee.rice.edu/Books/CS/chapter2/linear44.html

• Numerical Methods for Engineers, Fifth Edition, Steven C. Chapra

and Raymond P. Canale.


Recommended