Numerical Methods: System of Linear Equations
Numerical Methods: System of Linear Equations
Numerical methods
System of linear equations
Lecture 3
OUTLINE
Basic definitions
x1a11 + + xn a1n = b1
x1a 21 + + xn a 2 n = b2
(1)
x1a m1 + + xn a mn = bm
Denote
æ x1 ö æ b1 ö
çç ÷÷ çç ÷÷
çç x2 ÷÷ çç b2 ÷÷
x = çç ÷÷÷ b = çç ÷÷÷
çç ÷÷ çç ÷÷
çç ÷÷ çç ÷÷
è xn ø èbm ø
Ax = b
System of linear equations (linear system)
0
0
If b= then the system (1) is called homogeneous
0
0
0
if b then it is called nonhomogeneous
0
System of linear equations (linear system)
Definition We say that the n-tuple (r1, …, rn) is solution of system (1),
if Ar = b, where
r1
r= r2 .
r
n
Note
Direct methods
Iterative methods
x-2y+4z+ t =-6
2x+3y- z+2t =13 | (2)-2*(1)
2x+5y+ z+ t = 8 | (3)-2*(1)
3x+ y+3z+ t = 1 | (4)-3*(1)
x-2y+4z+ t =-6
7y-9z =25
9y-7z- t =20 | (3)-9/7*(2)
7y-9z-2t =19 | (4)-7/7*(2)
x-2y+ 4z+ t = -6
7y -9z = 25
32/7z- t =-85/7
-2t = -6
x = 1, y = 1, z = - 2, t = 3
Elementary row operations
– row switching ↔
– row multiplication →
– row addition →
Row equivalence of matrices
or
x-2y+4z+ t =-6 1 2 4 1 6
2x+3y- z+2t =13 /(2)-2*(1) 2 3 1 2 13
2x+5y+ z+ t = 8 /(3)-2*(1) 2 5 1 1 8
3x+ y+3z+ t = 1 /(4)-3*(1) 3 1 3 1 1
æ1 - 2 4 1 -6 ö÷
x-2y+4z+ t = -6 çç ÷÷
7y-9z = 25 çç0 7 -9 0 25÷÷
çç ÷÷
9y-7z- t = 20 /(3)-9/7*(2) çç0 9 -7 -1 20÷÷
çç ÷÷
7y-9z-2t = 19 /(4)-7/7*(2) è 0 7 -9 - 2 19ø
æ1 - 2 4 1 -6 ö
x-2y+ 4z+ t = -6 çç ÷÷
7y- 9z = 25 ççç0 7 -9 0 25 ÷÷÷
32/7z- t =-85/7 çç0 0 32 / 7 -1 -85/7÷÷÷
çç ÷÷
-2t = -6 çè0 0 0 -2 -6 ÷ø
x = 1, y = 1, z = - 2, t = 3
Gaussian elimination
We showed a principle of
Gaussian elimination (GE):
We showed a principle of
Gaussian elimination (GE):
Forward elimination:
Let
A(0) = A, b(0) = b
elements of matrix A(0) will be aij(0) = aij
elements of vector b(0) will be bi(0) = bi
Gaussian elimination
algorithm of GE
Gaussian elimination
algorithm of GE
multiplicator assures
that
element (i,k) of matrix A(k)
will be zero
Gaussian elimination
algorithm of GE
leading coefficient
(pivot)
has to be non-zero
Gaussian elimination
Example:
Solve the linear system
Partial pivoting
is the modification of GE which assures
that the absolute values of multiplicators
are less than or equal to 1.
Computational efficiency
2 3
The number of arithmetic operations in forward elimination: » n
3
x-2y+4z+ t =-6 1 2 4 1 6
2x+3y- z+2t =13 /(2)-2*(1) 2 3 1 2 13
2x+5y+ z+ t = 8 /(3)-2*(1) 2 5 1 1 8
3x+ y+3z+ t = 1 /(4)-3*(1) 3 1 3 1 1
æ1 - 2 4 1 -6 ö÷
x-2y+4z+ t = -6 çç ÷÷
7y-9z = 25 çç0 7 -9 0 25÷÷
çç ÷÷
9y-7z- t = 20 /(3)-9/7*(2) çç0 9 -7 -1 20÷÷
çç ÷÷
7y-9z-2t = 19 /(4)-7/7*(2) è 0 7 -9 - 2 19ø
æ1 - 2 4 1 -6 ö
x-2y+ 4z+ t = -6 çç ÷÷
7y- 9z = 25 ççç0 7 -9 0 25 ÷÷÷
32/7z- t =-85/7 çç0 0 32 / 7 -1 -85/7÷÷÷
çç ÷÷
-2t = -6 çè0 0 0 -2 -6 ÷ø
x = 1, y = 1, z = - 2, t = 3
LU decomposition (factorization)
x-2y+4z+ t =-6 1 2 4 1 6
2x+3y- z+2t =13 /(2)-2*(1) 2 3 1 2 13
2x+5y+ z+ t = 8 /(3)-2*(1) 2 5 1 1 8
3x+ y+3z+ t = 1 /(4)-3*(1) 3 1 3 1 1
æ 1 -2 4 1 -6 ö÷
x-2y+4z+ t = -6 çç ÷÷
7y-9z = 25 çç2 7 -9 0 25÷÷
çç ÷÷
9y-7z- t = 20 /(3)-9/7*(2) çç2 9 -7 -1 20÷÷
çç ÷÷
7y-9z-2t = 19 /(4)-7/7*(2) è 3 7 -9 - 2 19ø
æ 1 -2 4 1 -6 ö
x-2y+ 4z+ t = -6 çç ÷÷
7y- 9z = 25 çç2 7 -9 0 25 ÷÷÷
çç ÷÷
32/7z- t =-85/7 çç2 0 32 / 7 -1 -85/7÷÷
-2t = -6 çç ÷÷
è3 0 0 -2 -6 ø
x = 1, y = 1, z = - 2, t = 3
LU decomposition (factorization)
x-2y+4z+ t =-6 1 2 4 1 6
2x+3y- z+2t =13 /(2)-2*(1) 2 3 1 2 13
2x+5y+ z+ t = 8 /(3)-2*(1) 2 5 1 1 8
3x+ y+3z+ t = 1 /(4)-3*(1) 3 1 3 1 1
æ 1 -2 4 1 -6 ö÷
x-2y+4z+ t = -6 çç ÷÷
7y-9z = 25 çç2 7 -9 0 25÷÷
çç ÷÷
9y-7z- t = 20 /(3)-9/7*(2) çç2 9 -7 -1 20÷÷
çç ÷÷
7y-9z-2t = 19 /(4)-7/7*(2) è 3 7 -9 - 2 19ø
æ 1 -2 4 1 -6 ö
x-2y+ 4z+ t = -6 çç ÷÷
7y- 9z = 25 çç2 7 -9 0 25 ÷÷÷
çç ÷÷
32/7z- t =-85/7 çç2 9 / 7 32 / 7 -1 -85/7÷÷
-2t = -6 çç ÷÷
è3 1 0 -2 -6 ø
x = 1, y = 1, z = - 2, t = 3
LU decomposition (factorization)
x-2y+4z+ t =-6 1 2 4 1 6
2x+3y- z+2t =13 /(2)-2*(1) 2 3 1 2 13
2x+5y+ z+ t = 8 /(3)-2*(1) 2 5 1 1 8
3x+ y+3z+ t = 1 /(4)-3*(1) 3 1 3 1 1
æ 1 -2 4 1 -6 ö÷
x-2y+4z+ t = -6 çç ÷÷
7y-9z = 25 çç2 7 -9 0 25÷÷
çç ÷÷
9y-7z- t = 20 /(3)-9/7*(2) çç2 9 -7 -1 20÷÷
çç ÷÷
7y-9z-2t = 19 /(4)-7/7*(2) è 3 7 -9 - 2 19ø
æ 1 -2 4 1 -6 ö
x-2y+ 4z+ t = -6 çç ÷÷
7y- 9z = 25 çç2 7 -9 0 25 ÷÷÷
çç ÷÷
32/7z- t =-85/7 çç2 9 / 7 32 / 7 -1 -85/7÷÷
-2t = -6 çç ÷÷
è3 1 0 -2 -6 ø
x = 1, y = 1, z = - 2, t = 3
LU decomposition (factorization)
A = L⋅ U
æ1 -2 4 1ö æ1 0 0 0ö æ1 -2 4 1 ö
çç ÷÷ ç ÷÷ ç ÷÷
ç
çç2 3 -1 2÷÷ çç2 1 0 0÷÷ çç0 7 ç ÷÷
÷÷ = ç ÷÷⋅ ç - 9 0 ÷÷
çç
çç2 5 1 1÷÷÷ çç2 9 / 7 1 0÷÷÷ çç0 0 32 / 7 -1÷÷÷
çç ÷÷ ççç ÷÷ ççç ÷÷
3 1 3 1ø è3 1 0 1ø è0 0
è 0 -2
ø
A L U
Doolittle algorithm
makes the LU decomposition
using the half number
of arithmetic operations
1 3
» n
3
LU decomposition (factorization)
LU decomposition of A
is useful for solving of sequences of tasks
for k < i.
(show this)
LU decomposition with partial pivoting
If A is regular then
AT ⋅ A
is positive-definite.
Gaussian elimination
Gaussian elimination
is numerically stable for
diagonally dominant
or
positive-definite matrices.
Cholesky decomposition
A = L ⋅ LT
where L is the lower triangular matrix.
Cholesky decomposition
A = L ⋅ LT
where L is the lower triangular matrix.
Cholesky algorithm:
1 3
The number of arithmetic operations: » n
3
The effect of round-off errors
Example:
On the hypothetical computer working decimal system
with three digits mantissa solve the following system
The effect of round-off errors
Properties
Let
Because then
from the definition of M and m
it follows that
so for
where is a residuum.
Norm of matrix
the number M is also known as the norm of matrix
n n
A F
= åå ij
a 2
Frobenius norm (consistent with l2)
i=1 j =1
A ¥
= max aij max norm
i, j
Example: Find the solution of linear system in real numbers.
x+2y+ z- t = 1
2x+3y- z+2t = 3
4x+7y+ z = 5
5x+7y-4z+7t =10
Example: Find the solution of linear system in real numbers.
1 2 1 1 1
x+2y+ z- t = 1
2x+3y- z+2t = 3 2 3 1 2 3
4x+7y+ z = 5 4 7 1 0 5
5x+7y-4z+7t =10 5 7 -4 7 10
1 2 1 1 1
0 1 3 4 1
0 1 3 4 1
0 3 9 12 5
x+2y+ z- t = 1 1 2 1 1 1
-y-3z+4t = 1 0 1 3 4 1
0z+0t = 2 0 0 0 0 2
0t = 0 0 0 0 0 0
system has no solution
Another example: Find the solution of linear system in rational numbers.
x-2y+4z+ t =-6
2x+3y- z+2t =13
3x+ y+3z+3t = 7
x+5y-5z+ t =19
Another example: Find the solution of linear system in rational numbers.
1 2 4 1 -6
x-2y+4z+ t =-6
2x+3y- z+2t =13 2 3 1 2 13
3x+ y+3z+3t = 7 3 1 3 3 7
x+5y-5z+ t =19 1 5 -5 1 19
1 2 4 1 -6
0 7 9 0 25
0 7 9 0 25
0 7 9 0 25
x-2y+4z+ t =-6 1 2 4 1 - 6
7y-9z+0t =25 0 7 9 0 25
0z+0t = 0 0 0 0 0 0
0t = 0 0 0 0 0 0
Another example: Find the solution of linear system in rational numbers.
1 2 4 1 - 6
x-2y+4z+ t =-6
7y-9z+0t =25 0 7 9 0 25
0z+0t = 0 0 0 0 0 0
0t = 0 0 0 0 0 0
System has infinite number of solutions
t = p, z = q, p,q Q
25 9 8 10
y q x qp
7 7 7 7
8 10 25 9
S q p, q, q, p , p, q Q
7 7 7 7
2 34
For example: if q = 1, p = 0, we get particular solution , ,1,0
7 7
System of linear equations
x1a11 x n a1n 0
x1a 21 x n a 2n 0
x1a m1 x n a mn 0
x-2y+4z+ t =0 1 2 4 1 0
2x+3y- z+2t =0 2 3 1 2 0
3x+ y+3z+3t =0 3 1 3 3 0
x+5y-5z+ t =0 1 5 -5 1 0
1 2 4 1 0
0 7 9 0 0
0 7 9 0 0
0 7 9 0 0
x-2y+4z+ t =0 1 2 4 1 0
7y-9z+0t =0 0 7 9 0 0
0z+0t =0 0 0 0 0 0
0 0 0 0 0
0t =0
Example: Find the solution of linear system in rational numbers.
x-2y+4z+ t =0
7y-9z+0t =0
0z+0t =0
0t =0
t = p, z = q, p,q Q
9
y q
7
10
x qp
7
10 9
S q p, q, q, p , p, q Q
7 7
Summary of notions