Numerical Methods 6
Numerical Methods 6
Numerical Methods 6
Matrix
Matrix algebra is a means of making
calculations upon arrays of numbers (or data).
a11 ,, a1n
a 21 ,, a 2n
A
A
ij
am1 ,, amn
Scalar
a scalar is a number
(denoted with
regular type: 1 or 22)
Row Vector
[1 x n] matrix
A a1 a 2 ,, an aj
Column Vector
[m x 1] matrix
a1
a 2
A ai
am
Square Matrix
Same number of rows and columns
5 4 7
B 3 6 1
2 1 3
The
Identity
Identity Matrix
Square matrix with ones on the
diagonal and zeros elsewhere.
1
0
I
0
0 0 0
1 0 0
0 1 0
0 0 1
Transpose Matrix
Rows become columns and
columns become rows
a11 a 21 ,, am1
a12 a 22 ,, am 2
A'
a1n a 2n ,, amn
Addition
If
a11 a12
A
a 21 a 22
and
b11 b12
B
b 21 b 22
then
3 4 1 2
4 6
A B
5 6
3 4
8 10
Matrix Subtraction
C = A - B
Is defined by
Matrix Multiplication
Matrices A and B have these dimensions:
[r x c] and [s x d]
Matrix Multiplication
Matrices A and B can be multiplied if:
[r x c] and [s x d]
c=s
Matrix Multiplication
The resulting matrix will have the dimensions:
[r x c] and [s x d]
rxd
Matrix Multiplication
Thus
where
a
c
21 22 23 21 22 21 22
a31 a32 a33 b31 b32 c31 c32
c11 a11b11 a12b21 a13b31
c12 a11b12 a12b22 a13b32
c 21 a21b11 a22b21 a23b31
c 22 a21b12 a22b22 a23b32
c31 a31b11 a32b21 a33b31
c32 a31b12 a32b22 a33b32
Computation: A x B = C
2 3
1 1 1
A 1 1 and B
1
0
2
1 0
[3 x 2]
[2 x 3]
2 *1 3 *1 5 2 *1 3 * 0 2 2 *1 3 * 2 8 5 2 8
C 1*1 1*1 2 1*1 1* 0 1 1*1 1* 2 3 2 1 3
1*1 0 *1 1 1*1 0 * 0 1 1*1 0 * 2 1 111
[3 x 3]
Computation: A x B = C
2 3
1 1 1
A 1 1 and B
1
0
2
1 0
[3 x 2]
[2 x 3]
Result is 3 x 3
2 *1 3 *1 5 2 *1 3 * 0 2 2 *1 3 * 2 8 5 2 8
C 1*1 1*1 2 1*1 1* 0 1 1*1 1* 2 3 2 1 3
1*1 0 *1 1 1*1 0 * 0 1 1*1 0 * 2 1 111
[3 x 3]
Inversion
Matrix Inversion
1
B B BB
Like a reciprocal
in scalar math
Definition
Definition
If A is a square matrix, and if a matrix B of
the same size can be found such that
AB=BA=I , then A is said to be invertible
and B is called an inverse of A . If no such
matrix B can be found, then A is said to be
singular .
Notation:
B A1
a
a
a
mn
m1 m 2
a
a
a
mn
1n 2 n
a b
A
c d
1 d b
A
ad bc c a
1
Determinants of larger
matrices
Definition of a Determinant
If A is a square matrix of order 2 or greater, then the
determinant of A is the sum of the entries in the first
row of A multiplied by their cofactors. That is,
n
det( A) A a1 j C1 j
j 1
det( A) A ad bc
det( A) A a
b
e
h
c
f
i
Matrix Inversion
How to calculate the matrix inverse?
A
adj ( A)
A
Matrix Inversion
Consider the following set of linear equations.
2 x1 4 x2 5 x3 36
-3x1 5 x2 7 x3 7
5 x 3x 8 x -31
2
3
1
The coefficients can be arranged in a matrix form as shown.
2 -4 5
-3 5 7
A
5 3 -8
Matrix Inversion
The set of equations in matrix form is:
2 -4 5 x1 36
-3 5 7 x 7
2
5 3 -8 x3 -31
[A ][x ]= [B ]
[x ]=
- 1
[A ] [B ]
Minors
2
3
2
3
2
3
5
3
5
3
5
3
5
7
8
5
7
8
5
7
8
5
M 11 =
3 -8
-3
M 12 =
= -61
7
-8
= -11
-3 5
M 13 =
= -34
Minors
2 4 5
3 5
5
3 8
M 23
2 -4
5
26
Cofactors
Cofactors are the signed minors.
The cofactor of element aij of matrix [A] is:
Therefore
1+ 1
M 11
1+ 2
M 12
1+ 3
M 13
C 11 = (-1)
C 12 = (-1)
C 13 = (-1)
i+ j
C ij = (-1)
-61 11 -34
C -17 -41 -26
-53 -29 -2
M ij
Adjoint matrix
The adjoint matrix of [A], Adj[A] is obtained by taking the
T
transpose of the cofactor matrix of [A]. adj [A ]= [C ]
-61 11 -34
C -17 -41 -26
-53 -29 -2
-4
A = -3
7 = -336
-8
Matrix Inversion
A
-61
-336
11
-336
-34
-336
-17
-336
-41
-336
-26
-336
-53
-336
-29
-336
-2
-336
- 1
[A ] =
1
adj [A ]
A
11
-41
-29
-336
-34 -26 -2
61
336
-11
336
17
168
17
336
41
336
13
168
53
336
29
336
1
168
2
A 1
1
2
1
0
1
2
I 1
0
0
A1
0
0
3
4
1
2
1
4
1
2
1
1
2
1
4
1
2
3
4
The matrix augmentation can now be undone, which gives the following:
1
I 0
0
1
0
0
0
A1
3
4
1
2
1
4
1
2
1
1
2
1
4
1
2
3
4