0% found this document useful (0 votes)
40 views59 pages

System of Linear Equations

Math 31: Numerical Solutions to CE problems

Uploaded by

Just Kyle
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)
40 views59 pages

System of Linear Equations

Math 31: Numerical Solutions to CE problems

Uploaded by

Just Kyle
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/ 59

SOLVING SYSTEM OF

LINEAR EQUATIONS
NUMERICAL SOLUTIONS TO CE PROBLEMS
SYSTEM OF LINEAR EQUATIONS

- A linear equation is an equation that can be written in the form


SYSTEM OF LINEAR EQUATIONS

- The subscript ‘n’ represents the number of variables/terms in a linear


equation.
- Another definition is linear equations are equations of first order. Meaning
that the highest exponent of all variables in linear equation are equal to 1
SYSTEM OF LINEAR EQUATIONS
SYSTEM OF LINEAR EQUATIONS

A system of linear equations is a collection of one or more linear equations


with the same variables.
SYSTEM OF LINEAR EQUATIONS

A solution of the system of linear equations is a list of values that makes each
linear equation on the system a true statement when the value of the
solutions are substituted on the variables of the given linear equations
respectively.
The number of solutions depends on the number of variables on the system.
The set of all possible solutions is called the solution set of the linear system.
CONSISTENCY OF LINEAR SYSTEM

A system of linear equation has 3 types of solution:


1. No Solution
2. Exactly one solution
3. Infinitely many solutions
CONSISTENCY OF LINEAR SYSTEM

-A system of linear equation is said to be consistent if it has one or infinite


solutions
-If the system has no solution, therefore the system is inconsistent
Solving System of Linear Equations

Systems of linear equations that have to be solved simultaneously arise in


problems that include several (possibly many) variables that are dependent on
each other. A system of two (or three) equations with two (or three) unknowns
can be solved manually by substitution or other mathematical methods.
Solving a system in this way is practically impossible as the number of
equations (and unknowns) increases beyond three.
Solving System of Linear Equations

Two types of numerical methods, direct and iterative, are used for solving
systems of linear algebraic equations. In direct methods, the solution is
calculated by performing arithmetic operations with the equations. In iterative
methods, an initial approximate solution is assumed and then used in an
iterative process for obtaining successively more accurate solutions.
DIRECT METHODS

Direct methods in solving for system of linear equations:

1. Cramer’s Rule (Determinant Method)


2. Gauss Elimination Method
3. Gauss Jordan Elimination Method
4. LU Decomposition Method
DIRECT METHODS

In direct methods ,the system of equations that is initially given in the general
form is manipulated to an equivalent system of equations that can be easily
solved (with the exception of the determinant method). Three systems of
equations that can be easily solved are the upper triangular, lower triangular,
and diagonal forms.
CRAMER’S RULE
A set of n simultaneous linear equations with n unknowns x1, x2, ... , xn is
given by:

The system can be written compactly by using matrices:


CRAMER’S RULE
CRAMER’S RULE
Cramer’s rule states that

where a’j is the matrix formed by replacing the jth column of the matrix [a]
with the column vector [b] containing the right-hand sides of the original
system
CRAMER’S RULE

Cramer’s Rule specifies that when det(A) is not equal to O, there is exactly one
solution. When det(A) = O, A has no solution or infinite solutions. Cramer’s
Rule is only applicable to the case when exactly one solution exists.
EXAMPLE
• Solve using Cramer’s rule
EXAMPLE
• Solve using Cramer’s rule
EXAMPLE
Find the solution of the following system of equations using Cramer's rule.

2x+ 3y-z = 5
4x+4y- 3z = 3
-2x+ 3y-z = 1
GAUSS ELIMINATION METHOD

The Gauss elimination method is a procedure for solving a system of linear


equations. In this procedure, a system of equations that is given in a general
form is manipulated to be in upper triangular form.
GAUSS ELIMINATION METHOD

Gauss elimination consists of two steps:


1. Forward Elimination - In the first step of forward elimination, 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.
2. Back Substitution - In this step, starting from the last equation, each of the
unknowns is found.
GAUSS ELIMINATION METHOD

Forward Elimination
In the first step, the first equation is unchanged, and the terms that include the
variable x1 in all the other equations are eliminated. This is done one equation
at a time by using the first equation, which is called the pivot equation. The
coefficient a11 is called the pivot coefficient, or the pivot element. To
eliminate the term a21 x1 in the second equation, the pivot equation, is
multiplied by a21/a11, and then the equation is subtracted from second
equation.
GAUSS ELIMINATION METHOD

Forward Elimination
Now for the second step of forward elimination, we start with the second
equation as the pivot equation and a22′ as the pivot element. So, to eliminate
x2 in the third equation, multiply the second equation by a′ 32/ a′ 22 and
subtract it from the third equation.
GAUSS ELIMINATION METHOD
Forward Elimination
GAUSS ELIMINATION METHOD

Back Substitution
Now the equations are solved starting from the last equation as it has only one
unknown.

Then the second last equation has two unknowns: xn and xn-1, but xn is
already known. This reduces second last equation to just one unknown.
EXAMPLE

• Solve using Gauss Elimination


EXAMPLE

• Solve using Gauss Elimination


PROBLEMS WITH GAUSS ELIMINATION

1. Pivot coefficient is zero


Since the pivot row is divided by the pivot element, a problem will arise during
the execution of the Gauss elimination procedure if the value of the pivot
element is equal to zero. The elimination method will fail immediately if the
pivot element is zero or becomes zero during the process.
PROBLEMS WITH GAUSS ELIMINATION

1. Pivot coefficient is zero


PROBLEMS WITH GAUSS ELIMINATION

2. Large Round off Errors


Significant errors due to rounding can occur. 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.
PROBLEMS WITH GAUSS ELIMINATION

2. Large Round off Errors


GAUSS ELIMINATION WITH PIVOTING

In the general Gauss elimination procedure, an equation can be used as the


pivot row only if the pivot element is not zero. If the pivot element is zero, the
equation is exchanged with one of the equations that are below, which has a
nonzero pivot coefficient. This exchange of rows is called pivoting.
GAUSS ELIMINATION WITH PIVOTING

-If during the Gauss elimination procedure a pivot equation has a pivot
element that is equal to zero, then if the system of equations that is being
solved has a solution, an equation with a nonzero element in the pivot position
can always be found
GAUSS ELIMINATION WITH PIVOTING

- Among all the equations that can be exchanged to be the pivot equation, it is
better to select the equation whose pivot element has the largest absolute
numerical value. Moreover, it is good to employ pivoting for the purpose of
having a pivot equation with the pivot element that has a largest absolute
numerical value at all times (even when pivoting is not necessary)
GAUSS ELIMINATION WITH PIVOTING

Example
GAUSS ELIMINATION WITH PIVOTING

Example
GAUSS JORDAN ELIMINATION

In this procedure, a system of equations that is given in a general form is


manipulated into an equivalent system of equations in diagonal form with
normalized elements along the diagonal.
GAUSS JORDAN ELIMINATION

When the diagonal form of the matrix of the coefficients, [a] , is reduced to the
identity matrix, the new vector [b'] is the solution
GAUSS JORDAN ELIMINATION

Gauss Jordan Elimination Procedure

1. The pivot row is normalized by dividing all the terms in the pivot row by the
pivot coefficient. This makes the pivot coefficient equal to 1.
2. The pivot row is used to eliminate the off-diagonal terms in ALL the other
rows. This means that the elimination process is applied to the rows that are
above and below the pivot equation. (In the Gaussian elimination method,
only elements that are below the pivot element are eliminated.)
GAUSS JORDAN ELIMINATION

It is possible that the equations are written in such an order that during the
elimination procedure a pivot equation has a pivot element that is equal to
zero. Obviously, in this case it is impossible to normalize the pivot row (divide
by the pivot element). As with the Gauss elimination method, the problem can
be corrected by using pivoting.
EXAMPLE

• Solve using Gauss Jordan


GAUSS JORDAN ELIMINATION

Example
GAUSS JORDAN ELIMINATION

Example
GAUSS JORDAN ELIMINATION

Inverse of a Matrix
Augmented Matrix = [A | I ]
New Augmented Matrix = [ I | 𝐴−1 ]
EXAMPLE

• Solve using Inverse of Matrix (Gauss Jordan)


EXAMPLE

• Solve using Inverse of Matrix (Gauss Jordan)


GAUSS JORDAN ELIMINATION

• Solve using Inverse of Matrix (Gauss Jordan)


LU DECOMPOSITION METHOD

In the LU decomposition method, the operations with the matrix [a] are done
without using, or changing, the vector [b] , which is used only in the
substitution part of the solution. The LU decomposition method can be used
for solving a single system of linear equations, but it is especially
advantageous for solving systems that have the same coefficient matrices [a]
but different constant vectors [ b]
LU DECOMPOSITION METHOD
The LU decomposition method
The LU decomposition method is a method for solving a system of linear
equations [a] [ x] = [ b] . In this method, the matrix of coefficients [a] is
decomposed (factored) into a product of two matrices [L] and [U]:

[a] = [L][U]

where the matrix [L] is a lower triangular matrix and [ U] is an upper triangular
matrix.
LU DECOMPOSITION METHOD

With this decomposition, the system of equations to be solved has the form:
[L][U][x] = [b]
To solve this equation, the product [U][x] is defined as:
[U][x] = [y]
and is substituted to give:
[L][y] = [b]
Now, the solution [x] is obtained in two steps. First is to solve for [y]. Then, the
solution [y] is substituted and that equation is used to solve for [x].
LU DECOMPOSITION METHOD

Since the matrix [ L] is a lower triangular matrix, the solution [y] is obtained by
using the forward substitution method. Once [y] is known and is substituted,
the equation is solved by using back substitution.
LU DECOMPOSITION METHOD

LU Decomposition Using the Gauss Elimination Procedure


- The upper triangular matrix [U] is the matrix of coefficients [a] that is
obtained at the end of forward elimination
- The elements of [L] on the diagonal are all 1, and the elements below the
diagonal are the multipliers that multiply the pivot equation when it is used
to eliminate the elements below the pivot coefficient
LU DECOMPOSITION METHOD

LU Decomposition Using the Gauss Elimination Procedure


LU DECOMPOSITION METHOD

LU Decomposition Using the Gauss Elimination Procedure


EXAMPLE

• Solve by LU Decomposition using Gauss Elimination


Example

• Solve by LU Decomposition using Gauss Elimination


LU DECOMPOSITION METHOD

LU Decomposition Using Crout's Method


In this method the matrix [a] is decomposed into the product [ L] [ U] , where
the diagonal elements of the matrix [ U] are all 1 s.
LU DECOMPOSITION METHOD
LU Decomposition Using Crout's Method
EXAMPLE

• Solve by LU Decomposition using Crout’s Method

You might also like