My Unit 5 Lecture DIrect Method
My Unit 5 Lecture DIrect Method
My Unit 5 Lecture DIrect Method
Example :
2 3 1
det 1 0 5 2
0 5 3 -1 3 -1
-1 -1
5 4 5 4 0 5
1 5 4
2(25) 1(12 5) 1(15 0) 82
BASIC FUNDAMENTALS 95
• Addition of Matrices
The addition of two matrices A and B is possible only if
they have the same size
C A B cij a ij b ij i, j
• Multiplication of Matrices
Multiplication of two matrices A(n m) and B(p q)
The product C AB is defined only if m p
m
C A B cij a ik b kj i, j
k 1
BASIC FUNDAMENTALS
• Suppose that we want to multiply [X] by [Y ] to yield [Z ],
3 1
5 9
• [Z] = [X][Y] = 8 6 x
7 2
0 4
2 x1 4 x2 3x3 3 2 4 3 x1 3
2.5 x1 x2 3x3 5 2.5 1 3 x2 5
x1 6 x3 7 1 0 6 x3 7
Standard form Matrix form
SOLUTIONS OF LINEAR EQUATIONS
x1 1
x 2 is a solution to the following equations :
2
x1 x2 3
x1 2 x2 5
• A set of equations is inconsistent if there exists no solution to the system of
equations:
x1 2 x2 3
2 x1 4 x2 5
These equations are inconsistent
SOLUTIONS OF LINEAR EQUATIONS
• Some systems of equations may have infinite number of solutions
x1 2 x2 3
2 x1 4 x2 6
have infinite number of solutions
x1
x 0.5(3 ) is a solution for all
2
SOLUTIONS OF LINEAR EQUATIONS
• There are two classes of methods for solving system of linear, algebraic equations:
1.Direct methods.
2. Indirect or Iterative methods
• Direct methods
• They transform the original equation into equivalent equations (equations that have
the same solution) that can be solved more easily.
• The transformation is carried out by applying certain operations.
• The solution does not contain any truncation errors but the round off errors is
introduced due to floating point operations.
SOLUTIONS OF LINEAR EQUATIONS
• Indirect methods
• Iterative or indirect methods, start with a guess of the solution x, and then repeatedly refine
the solution until a certain convergence criterion is reached.
• Generally less efficient than direct methods since, large number of operations or iterations
required.
• Iterative procedures are self-correcting, meaning that round off errors (or even arithmetic
mistakes) in one iteration cycle are corrected in subsequent cycles.
Finally, the first row of the augmented matrix represents the equation
GAUSS ELIMINATION METHOD
• Gaussian Elimination Method with Partial Pivoting
• Gauss elimination method fails if any one of the pivots in the equations becomes zero.
• To overcome this difficulty, the equations are to be rewritten in a slightly different
order such that the pivots are not zero.
Partial pivoting Procedure:
Step 1: The numerically largest coefficient of x1 is selected from all the equations as pivot
and the corresponding equation becomes the first equation.
Step 2: The numerically largest coefficient of x2 is selected from all the remaining
equations as pivot and the corresponding equation becomes the second equation.
• This process is repeated till an equation into a simple variable is obtained.
• Remaining 1st and last method is same as GEM.
GAUSS ELIMINATION METHOD
• Example : Solve the system of equations using the Gauss elimination with partial pivoting.
x1 + 10x2 – x3 = 3
2x1 + 3x2 + 20x3 = 7
10x1 – x2 + 2x3 = 4
• Solution:
Step 1: We have the augmented matrix as
Step 2: We perform the following elementary row transformations and do the eliminations.
GAUSS ELIMINATION METHOD
Step 3:Back substitution gives the solution.
Third equation gives x3 = 5.37624/ 19.98020 = 0.26908.
Second equation gives x2 = (1/10.1)(2.6 + 1.2x3) =(1/10.1)(2.6 + 1.2(0.26908)) = 0.28940.
First equation gives x1 = (1/10)(4 + x2 – 2x3) = (1/10)(4 + 0.2894 – 2(0.26908)) = 0.37512.
PRACTICE QSN:
1) Solve the following equations by Gauss elimination method:
a) 2x + 4y – 6z = –4 b)
x + 5y + 3z = 10
x + 3y + 2z = 5 Ans: x=-3, y=-2, z=1 Ans: x1=1, x2=2, x3=-1, x4=0
2) Solve the following equations using the Gauss elimination with partial pivoting.
a) b) 5x +12y + 9z = 5
8x +11y + 20z = 35
16x + 5y + 7z = 29
Ans: x1=5, x2=6, x3=-10,x4=8 Ans: x = 1.426, y = -1.808, z = 2.174
GAUSS JORDAN METHOD
• Gauss-Jordan method is a modification of Gauss elimination method.
• The series of operations performed are quite similar to the Gauss elimination method.
• In the Gauss elimination method, an upper triangular matrix is derived while in the
Gauss-Jordan method an identity matrix is derived. Hence, back substitutions are not
required.
Wilhelm Jordan
Famous German Geodesist
GAUSS JORDAN METHOD
• PROCEDURE:
1. Write the augmented matrix for the system of linear equations.
2. 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.
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.
GAUSS JORDAN METHOD
• Example:
• Step 1: Write the augmented matrix for the system of linear equations.
• Step 2: Use elementary row operations on the augmented matrix [A|b] to transform A
into diagonal form.
GAUSS JORDAN METHOD
• Step 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.
• Hence,
PRACTICE QSN: Use to Gauss-Jordan method solve the system
• b) x + 3y + 2z = 17
x + 2y + 3z = 16
Ans: x=y=z=1 2x – y + 4z = 13 Ans: x=4,y=3,z=2
LU DECOMPOSITION METHOD
• Linear algebraic notation can be rearranged to give
A X- B = 0 eq1
• Suppose that this equation could be expressed as an upper triangular
system:
eq2
• That has the property that when Eq. 3 is pre-multiplied by it, Eq. 1 is the result. That
is, L U X- D =A X- B eq5
• If this equation holds, it follows from the rules for matrix multiplication that
L U =A eq6
L D= B eq7
LU DECOMPOSITION METHOD
• A two-step strategy for obtaining solutions can be based on Eqs. 3, 6 & 7.
• LU decomposition step. [A] is factored or “decomposed” into lower [L] and upper [U]
triangular matrices.
• Substitution step. [L] and [U] are used to determine a solution {X} for a right-hand side
{B}. This step itself consists of two steps. First, Eq. 7 is used to generate an intermediate
vector {D} by forward substitution.
• Then, the result is substituted into Eq. 3, which can solved by back substitution for
[X].In the other hand, Gauss Elimination can be implemented in this way.
LU DECOMPOSITION METHOD
• LU-decomposition of a non-singular matrix (when it exists) is not unique. In practice we
use one of the following alternatives to get unique factorization:
(a) Crout’s formalism: All the diagonal elements of U is chosen 1.
(b) Dolittle’s formalism: All the diagonal elements of L is chosen 1.
Crout’s Method
• Consider the matrix equation of the system of 3 equations in 3 unknowns
𝐴𝑋 = 𝐵
• We write matrix A as a product of an Upper and Lower Triangular matrices[1]
𝐴 = 𝐿𝑈
Prescott Durand Crout
American Mathematician
LU DECOMPOSITION METHOD
• Since 𝑨 = 𝑳𝑼 ∴ 𝑨𝑿 = 𝑩 eq(1) Gives 𝑳𝑼𝑿 = 𝑩 eq(2)
• Let us take 𝑼𝑿 = 𝒀 eq(3)
• 𝑌 is some unknown matrix which is to be evaluated
• Then 𝐋𝐘 = 𝐁 eq(4)
• Therefore to find the solution of the system (1) we will have to solve (4) and then (3), but
before that we will have to evaluate the values of L and U
PROCEDURE:
• Use the following steps to solve the System of Linear algebraic equations.
LU DECOMPOSITION METHOD
• Step 2: Calculate the Product of L and U
• (i) Determine a lower triangular matrix L and an upper triangular matrix U such that
L U = A using Crout’s algorithm.
• (ii) Use the above factorization to solve the equation A X = B.
Solution: i)
LU DECOMPOSITION METHOD
• Equating the corresponding elements of the two matrices, we have
• Thus,
LU DECOMPOSITION METHOD
• (ii) The equation can be written as AX = LUX = LY = B
Where, UX = Y and
• where A is the determinant of the coefficient matrix A, and C11, C21 and C31 are the
cofactors of A corresponding to element 11, 21 and 31.
• We can also write similar expressions for x2 and x3 by replacing the second and third
columns by the y column respectively. Hence, the complete solution can be written in
matrix form as follows:
MATRIX INVERSION METHOD
• Although this method is quite general but it is not quite suitable for large systems
because evaluation of A–1 by co-factors becomes very cumbersome.
Example: Obtain the solution of the following linear simultaneous equations by the matrix
inversion method.
MATRIX INVERSION METHOD
• Hence
MATRIX INVERSION METHOD
PRACTICE QSN: Obtain the solution of the following linear simultaneous equations by the
matrix inversion method.
Ans: x1 = 0, x2 = 1, x3 = 2.
Cholesky’s Method
• Cholesky’s decomposition method is faster than the LU decomposition. There is no
need for pivoting. If the decomposition fails, the matrix is not positive definite.
• Consider the system of linear equations:
a11x1 + a12x2 + a13x3 = b1
a21x1 + a22x2 + a23x3 = b2
a31x1 + a32x2 + a33x3 = b3
• The above system can be written as
Ax = b eq(1) Andre Louis Cholesky
Where French Military & Mathematician
eq(2)
Cholesky’s Method
• Let A = LU
EXAMPLE:
2x + y + 4z = 12
8x – 3y + 2z = 20
4x + 11y – z = 33
Solution:
We have
Cholesky’s Method
Let
We get,
2x + y + 4z = 12
–7y – 14z = –28
–27z = –27 ⇒z=1
• Which gives, Substituting z in eq b we get,
7y = 28 – 14 × 1 ⇒ y =14/7 ⇒y=2
Now substituting y & z value in eq a we get,
• The solution to the original system is given by:
2x = 12 – y – 4z = 12 – 2 – 4 × 1
UX = V
or, x= 6/2 ⇒x=2
Cholesky’s Method
PRACTICE QSN:
b) 2x – 6y + 8z = 24
a) x1 + x2 + x3 – x4 = 2
5x + 4y – 3z = 2
x1 – x2 – x3 + 2x4 = 0 3x + y + 2z = 16
4x1 + 4x2 + x3 + x4 = 11
2x1 + x2 + 2x3 – 2x4 = 2
Ans: x4 = 0, x3 = –1, x2 = 2, x1 = 1. Ans: x=1, y=3, z=5