0% found this document useful (0 votes)
26 views7 pages

Numerical Analysis Project - Chapter 1 - System of Linear Equations

Numerical Analysis

Uploaded by

haohiepdu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views7 pages

Numerical Analysis Project - Chapter 1 - System of Linear Equations

Numerical Analysis

Uploaded by

haohiepdu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

CHAPTER I: SYSTEM OF LINEAR EQUATIONS

1. Theory summary:
- System of linear equations:
+ A system of linear equations consists of two or more equations made up of two or more
variables such that all equations in the system are considered simultaneously.
+ The solution to a system of linear equations in “n” variables is any ordered group of “n”
variable that satisfies each equation independently.
+The general form of linear algebraic equations is:
a11.x1 + a12.x2 +…+ a1n.xn = b1
a21.x1 + a22.x2 +…+ a2n.xn = b2

an1.x1 + an2.x2 +…+ ann.xn = bn

- Cramer’s rule:
+ 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,
…, bn.
+ Step to do:
 Find the determinant D of a 3 × 3 matrix made from all unknowns a11, a12,...
 We make a 3 × 3 matrix by replacing the 1st column of the matrix above by
constants b1, b2, b3.
 The first unknown x1 will be equal to the division between the determinant of the
newly created matrix and D.
 The same work will be applied for calculating x2 and x3.

- Gauss elimination:
+ Its basic strategy is to multiply the equations by constants so that one of the unknowns
will be eliminated when the two equations are combined.
+ We multiply a11 for a21/a11 and then subtract the coefficients of the 1st equation for the 2nd
equation. We then repeat this method until there is an equation with only one coefficient
and start doing back substitution.

- Naive Gauss elimination (2 steps):


+ Forward Elimination of Unknowns: reducing the system of equations to an upper
triangular system, that also means changing the normal matrix to its echelon form.
+ Back Substitution: from the last equation, solve for xn first and then substitute back into
previous equations to get results of the remaining unknowns.

- LU decomposition:
+ LU decomposition methods separate the time-consuming elimination of the matrix [A]
from the manipulations of the right-hand side {B}.
+ [A] is factored into lower [L] and upper [U] triangular matrices.
+ This method can be described as [A]{X} = {B} => [A] = [L][U] where
[L]{D} = [B] and [U]{X} = [D].
+ This method has 2 ways to perform:
 Doolitte method: [L] is in row echelon form with zeros above the leading
coefficients, [U] is in echelon form with zeros below the main diagonal.
 Crout method: [L] is in echelon form with zeros above the main diagonal, [U] is in
row echelon form with zeros below the leading coefficients.

- Cholesky decomposition:
+ It is a decomposition of a symmetric, positive-definite matrix into the product of a
lower triangular matrix (C) and its conjugate transpose (CT).
+ A matrix is positive-definite when all its sub-determinants are positive.
+ This method can be described as [A] = [C][CT].

2. Numerical examples (solve by hand):


Given the set of equations:
0.3x1 + 0.52x2 + x3 = -0.01 (1)
0.5x1 + x2 + 1.9x3 = 0.67 (2)
0.1x1 + 0.3x2 + 0.5x3 = -0.44 (3)

a. Use Cramer’s rule to solve:


Step 1:
| 0.3 0.52 1 |
D = | 0.5 1 1.9 | = -2.2 × 10-3
| 0.1 0.3 0.5 |

Step 2:
| -0.01 0.52 1 |
| 0.67 1 1.9 |
| -0.44 0.3 0.5 | 0.03278
x1 = ----------------------- = -------------- = -14.9
-2.2 × 10-3 -2.2 × 10-3

| 0.3 -0.01 1 |
| 0.5 0.67 1.9 |
| 0.1 -0.44 0.5 | 0.0649
x2 = ----------------------- = -------------- = -29.5
-2.2 × 10-3 -2.2 × 10-3

| 0.3 0.52 -0.01 |


| 0.5 1 0.67 |
| 0.1 0.3 -0.44 | -0.04356
x3 = -------------------------- = -------------- = 19.8
-2.2 × 10-3 -2.2 × 10-3

b. Use Gauss Elimination to solve:


Step 1: Multiply (1) for 5/3 and subtract it for the coefficients of (2):
0x1 – 2/15.x2 - 7/30.x3 = -103/150 (1*)

Step 2: Multiply (2) for 1/5 and subtract it for the coefficients of (3):
0x1 - 0.1x2 - 0.12x3 = 0.574 (2*)

Step 3: Multiply (1*) for 3/4 and subtract it for the coefficients of (2*):
0x1 + 0x2 – 0.055x3 = -1.089 (1**)

Step 4: Continue with back substitution:


=> x3 = 1.089/0.055 = 19.8; x2 = (0.574 + 0.12 × 19.8)/(-0.1) = -29.5
=> x1 = [-0.44 – 0.3 × (-29.5) - 0.5 × 19.8]/0.1 = -14.9

c. Use Naive Gauss Elimination to solve:


Step 1: The initial matrix representing coefficients in the equations is:
| 0.3 0.52 1 : -0.01 |
A(0) = | 0.5 1 1.9 : 0.67 |
| 0.1 0.3 0.5 : -0.44 |
Step 2: Eliminate x1 from the 1st row by subtracting it for 3 times the 3rd row, and for 2nd
row we subtract it for 5 times the 3rd row:
|0 -0.38 -0.5 : 1.31 |
A(1) = | 0 -0.5 -0.6 : 2.87 |
| 0.1 0.3 0.5 : -0.44 |

Step 3: Eliminate x2 from the 1st row by subtracting it for 0.76 times the 2nd row:
|0 0 -0.044 : -0.8712 |
A(2) = | 0 -0.5 -0.6 : 2.87 |
| 0.1 0.3 0.5 : -0.44 |

Step 4: Solve these equations by back substitution:


{X} = = { x1 x2 x3 }T = { 19.8 -29.5 -14.9 }T

d. Use LU decomposition (Doolitte method) to solve:


Step 1: Decomposing [A] into [L] and [U]:
| 0.3 0.52 1 | |1 0 0 | | 0.3 0.52 1 |
[A] = | 0.5 1 1.9 | = [L].[U] = | 5/3 1 0 |.|0 2/15 7/30 |
| 0.1 0.3 0.5 | | 1/3 0.95 1| |0 0 -0.055 |
Step 2: Substituting back to obtain results:
[L].[D] = [B]  [D] = [L]-1.[B]
|1 0 0 | -1 | -0.01 | | -0.01 |
 [D] = | 5/3 1 0 | . | 0.67 | = | 103/150 |
| 1/3 0.95 1| | -0.44 | | -1.089 |

[U].[X] = [D]  [X] = [U]-1.[D]


| 0.3 0.52 1 | -1 | -0.01 | | -14.9 |
 [X] = | 0 2/15 7/30 | . | 103/150 | = | -29.5 |
|0 0 -0.055 | | -1.089 | | 19.8 |

e. Use Cholesky decomposition to solve:


- It can not be solved as Cholesky decomposition only applied for symmetric matrix.
Therefore, there will be no solution here.
- However, if we solve with Cholesky method, it will look like this:
Step 1: Creating [C] and [CT]:
| 0.3 0.52 1 | | √(30)/10 0 0 |
[A] = | 0.5 1 1.9 | => [C] = | √(30)/6 √(6)/6 0 |
| 0.1 0.3 0.5 | | √(30)/30 2√(6)/15 0.6 |
| 0.5477 0.9129 0.1826 |
 [CT] = | 0 0.4082 0.3266 |
|0 0 0.6 |

Step 2: Verify the method:


| 0.3 0.5 0.1 |
[A] = [C].[CT] = | 0.5 1 0.3 | which is not equal to the original [A].
| 0.1 0.3 0.5 |

3. Numerical examples (solve by Excel):


4. Estimating the errors:
- Every method used for solving the problem has the same result for x1, x2 and x3:
εx1 = | [-14.9-(-14.9)] / (-14.9) | × 100% = 0%
εx2 = | [-29.5-(-29.5)] / (-29.5) | × 100% = 0%
εx3 = | (19.8-19.8) / (19.8) | × 100% = 0%

5. Conclusion:
- All errors of x1, x2 and x3 are good as all of them are at 0%.
- There is good agreement between solutions obtained by hand and by software, more
specifically Excel.
- Opinion: with the help of software, calculating becomes simpler but it is essential to
practice solving by hand as it gives us the understanding of the actual steps to deal with
the problem.

You might also like