Lec-5 (Gauss-Elimination, Gauss-Jordan, Matrix Inversion)
Lec-5 (Gauss-Elimination, Gauss-Jordan, Matrix Inversion)
Lec-5 (Gauss-Elimination, Gauss-Jordan, Matrix Inversion)
Lecture 05
5/27/2023 Md. Golam Moazzam, Dept. of CSE, JU 1
Direct Solution of Linear Equations
❑ Necessity
Analysis of linear equations is significant for a number of reasons:
– Mathematical models of many of the real world problems are either linear or
can be approximated reasonably well using linear relationships.
– The analysis of linear relationship of variables is generally easier than that of
nonlinear relationships.
❑ Linear Equation
– A linear equation involving two variables x and y has the standard form:
ax + by = c
Where a, b and c are real numbers and a and b cannot both equal zero.
– Some examples of linear equations:
4x + 7y = 15
- x - 2/3y = 0
– In practice, linear equations occur in more than two variables. A linear equation
with n variables has the form:
a1x1 + a2x2 + a3x3 + . . . . . . . . . . + anxn = b
Where ai are real numbers and at least one of them is not zero.
– The main concern is to solve for xi, given the values of ai and b.
– An infinite set of xi values will satisfy the above equation. There is no unique
solution.
❑ Elimination Approach
– Elimination approach, also known as direct method, reduces the given system
of equations to a form which the solution can be obtained by simple
substitution.
Some elimination methods are given:
• Basic Gauss elimination method
• Gauss elimination with pivoting
• Gauss-Jordan method
• LU decomposition methods
• Matrix inverse method
❑ Existence of Solution
– Given an arbitrary system of equations, it is difficult to say whether the system
has a solution or not. Sometimes there may be a solution but it may not be
unique. There are four possibilities:
• System has a unique solution
• System has no solution
• System has a solution but not a unique one (i.e. it has infinite solutions)
• System is ill-conditioned
3x – 1.5y = 4
4.5 x + 2y = 9 y
2x - 3y = 4 2x - y = 5
y
(x = 5, y = 2)
0 x 9 0 x
2
y y x - 2y = -2
-2x + 3y = 6
0.45x – 0.91y = -1
4x - 6y = -12
0 x 0 x
= j=1, ……, n
If = 0, k-th row cannot be normalized. Therefore, the procedure fails. One way
to overcome this problem is to interchange this row with another row below it
which does not have a zero element in that position. It can be proved that round-off
errors would be reduced if the absolute value of the pivot element is large.
Therefore, it is suggested that the row with zero pivot element should be
interchanged with the row having the largest (absolute value) coefficient in that
position.
– In complete pivoting, at each stage, the largest element in any of the remaining rows is
used as the pivot. Complete pivoting requires a lot of overhead and therefore, it is not
generally used.
In matrix form:
Ax = b - - - - - - - - - - - - - - - - - - - - - - - - (1)
Where
a11 a12 a13 x1 b1
A = a 21 a 22 a 23 x = x2 and b = b2
a31 a32 a33 x3 b3
Multiply each side of equation (1) by the inverse of A. This yields
A-1Ax = A-1b
Therefore, x = A-1b
This gives the solution for x.
5/27/2023 Md. Golam Moazzam, Dept. of CSE, JU 20
Direct Solution of Linear Equations
❑ Matrix Inversion Method
Computing Matrix Inverse
– Gauss-Jordan method is more complicated compared to Gauss elimination
method.
– Matrix inversion method provides a simple approach for obtaining the inverse
of a matrix.
– This is done as follows:
1. Argument the coefficient matrix A with an identity matrix as shown below:
– The right–hand side of the augmented matrix is the inverse of A. Now, we can
obtain the solution as follows:
x1 = a11/ b1 + a12/ b2 + a13/ b3
x2 = a 21
/
b1 + a 22
/
b2 + a 23
/
b3
x3 = a31
/
b1 + a32
/
b2 + a33
/
b3
Augmented matrix: 2 4 − 6 1 0 0
1 3 1 0 1 0
2 − 4 − 2 0 0 1
Therefore,
x1 = (-1/36)(-8) + (4/9)(10) + (11/36)(-12) = 1
x2 = (1/18)(-8) + (1/9)(10) + (-1/9)(-12) = 2
x3 = (-5/36)(-8) + (2/9)(10) + (1/36)(-12) = 3