Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
A. Matrix: Definition
B. Special Types of Matrices
C. Equality of Matrices
Lecture on Matrices D. Elementary Operations on Matrices
1. Matrix Addition
2. Scalar Multiplication
3. Matrix Subtraction
4. Matrix Multiplication
5. Transposition of a Matrix
CE 26
A matrix is a rectangular array of numbers or Unless stated, we assume that all our
functions arranged in rows and columns matrices are composed of real numbers.
usually designated by a capital letter and
enclosed by brackets, parentheses or double The horizontal groups of elements are called
bars. A matrix may be denoted by: the rows of the matrix. The ith row of A is
A = 21
: : :
am1 am 2 ... amn
1
2/18/2010
The vertical groups of elements are called the The size of a matrix is denoted by “m x n” (m
columns of the matrix. The jth column of A is by n) where m is the number of rows and n is
the number of columns.
a1j
a We refer to aij as the entry or the element in
2j (1 ≤ j ≤ n) the ith row and jth column of the matrix.
:
We may often write a given matrix as
a 3 j
A = [aij].
Columns
Example:
5 − 3 2 5
A = 0 1 1 4
Rows
Special Types of Matrices
7 9 1 8 3 x 4
2
2/18/2010
C. Square Matrix – is a matrix in which the no. C. Square Matrix – is a matrix in which the no.
of rows equals the no. of columns. of rows equals the no. of columns.
2 0 3 2 0 3
A = 1 1 4 A = 1 1 4
0 5 7 3 x 3 0 5 7 3 x 3
Principal Diagonal or Main Diagonal of a The Trace of a Square Matrix – is the sum
Square Matrix – consists of the elements a11, of the elements on the main diagonal of the
a22, a33, … ann. matrix. In the above matrix, trace = 2 + 1
+ 7 = 10.
D. Upper Triangular Matrix – a square matrix E. Lower Triangular Matrix – a square matrix
all elements of which below the principal all elements of which above the principal
diagonal are zero (aij = 0 for i>j). diagonal are zero (aij = 0 for i<j).
F. Diagonal Matrix – is a square matrix that is G. Scalar Matrix – is a diagonal matrix whose
an upper triangular and lower triangular at diagonal elements are equal.
the same time. The only non-zero elements
are the elements on the principal diagonal.
(aij = 0 for i ≠ j) s 0 0
d11 0 0 S = 0 s 0
D = 0 d22 0 0 0 s
0 0 d33
3
2/18/2010
J. Symmetric Matrix – a square matrix whose K. Skew Symmetric Matrix – a square matrix
element aij = aji. whose element aij = -aji
1 2 4 0 2 − 4
S = 2 2 − 5 T = − 2 0 − 5
4 −5 3 4 5 0
4
2/18/2010
x 1 c − 2 2 1 −1
A = a y + 1 2 and B = x + 1 b − 2 2 Elementary Operations on
3 b z 3 4 c + 1 Matrices
are equal if and only if x = 2, y = 1, z = 2, a =
3, b = 4 and c = 1.
5
2/18/2010
for i = 1 to m and j = 1 to p
Note: Examples:
1 2 2 − 4 1(2) + 2(3) 1( −4 ) + 2( −1)
A= B= AB =
The product is defined only if the number of 3 4 3 − 1 3(2) + 4(3 ) 3( −4 ) + 4( −1)
columns of the first factor A (pre-multiplier) is 8 −6
equal to the number of rows of the second AB =
18 − 16
factor B (post-multiplier). If this is satisfied,
we say that the matrices are conformable in 2(1) + ( −4 )(3 ) 2(2) + ( −4)(4 )
the order AB. Note: Although AB and BA =
BA are defined it is not 3(1) + ( −1)(3 ) 3( 2) + ( −1)(4 )
necessary that AB = BA. − 10 − 12
BA =
The formula An will be defined as A∗ A∗ A…∗ A 0 2
6
2/18/2010
7
2/18/2010
Examples:
By the Fundamental Principle of Counting we If S = {1, 2, 3} then S3 = {123, 132, 213, 231,
can put any one of the n elements of S in the 312, 321}
first position, any one of the remaining (n-1) If S = {1, 2, 3, 4} then there are 4! = 24
elements in the second position, any one of elements of S4.
the remaining (n-2) elements in the third
position, and so on until the nth position. Odd and Even Permutations
Thus there are n(n-1)(n-2)…3*2*1 = n! A permutation a1a2a3…an is said to have an
permutations of S. We refer to the set of all inversion if a larger number precedes a
permutations of S by Sn. smaller one. If the total number of inversion
in the permutation is even, then we say that
the permutation is even, otherwise it is odd.
Examples: ODD and EVEN Permutation S3 has 3! = 6 permutations: 123, 231and 312
are even while 132, 213, and 321 are odd.
S1 has only one permutation; that is 1, which is S4 has 4! = 24 permutations: 1234, 1243,
even since there are no inversions. 1324, 1342, 1423, 1432, 2134, 2143, 2314,
2341, 2413, 2431, 3124, 3142, 3214, 3241,
In the permutation 35241, 3 precedes 2 and 1, 3412, 3421, 4123, 4132, 4213, 4231, 4312,
5 precedes 2, 4 and 1, 2 precedes 1 and 4 4321.
precedes 1. There is a total of 7 inversions,
thus the permutation is odd. For any Sn, where n>1 it contains n!/2 even
permutations and n!/2 odd permutations.
8
2/18/2010
where the summation is over all permutations then to get Awe write down the terms a1-a2-
b and replace the dashes with the all-possible
j1j2…jn of the set S = {1,2,…,n}. The sign is
permutations of S = {1, 2}, namely 12 (even)
taken as (+) if the permutation is even and (–) and 21 (odd). Thus A= a11a22 - a12a21.
if the permutation is odd.
a 21 a 22 a 31
a 32
a 33
a 31
a 32
= a 11 a 22
a 33
+ a 12 a 23
a 31
+ a 13 a 21
a 32
−a 31 a 22 a 13 − a 32 a 23 a 11 − a 33 a 21 a 12
9
2/18/2010
The determinant of a square matrix maybe The determinant of a square matrix maybe
obtained using expansion about a row or obtained using expansion about a row or
expansion about a column. The following expansion about a column. The following
formulas maybe used in getting the formulas maybe used in getting the
determinant: determinant:
n n
det( A ) = ai1A i1 + ai2 A i2 + ... + ain A in = ∑ aik A ik det( A ) = a1j A 1j + a 2 j A 2 j + ... + anj A nj = ∑ akj A kj
k =1 k =1
(expansion about the ith row) (expansion about the jth column)
0 3 −1
= − 13
It is best to expand about the fourth row because it has the most
numbers of zeros. The optimal course of action is to expand
about the row or column that has the largest number of zeros,
because in that case the cofactors Aij of those aij which are zero
need not be evaluated since the product of aijAij = (0)Aij = 0.
10
2/18/2010
Step 1: Get the cofactors of all the elements Step 2: Set up the adjoint matrix by taking
in the original matrix. the transpose of the matrix of cofactors.
adj A = [A ij ]
T
Recall: the cofactor of an element aij can be
denoted as Aij and is defined by:
Example:
A ij = ( −1)i+ j Mij a b d − b
If A = then adj(A) =
c d − c a
11
2/18/2010
1 − 1 1
Example 2: Set up the inverse of the given matrix Getting the cofactors of all the A = 1 2 3
1 − 1 1 elements in the original matrix. 4 − 2 3
A = 1 2 3 A ij = ( −1)i+ j Mij
4 − 2 3 A 11 = ( −1)2
2 3
= 12 A 12 = ( −1)3
1 3
=9 A 13 = ( −1)4
1 2
= −10
−2 3 4 3 4 −2
Compute first the determinant using the diagonal
−1 1 1 1 1 −1
method A 21 = ( −1)3
=1 A 22 = ( −1) 4
= −1 A 23 = ( −1) 5
= −2
A = 6 − 12 − 2 − 8 + 6 + 3 = −7 −2 3 4 3 4 −2
−1 1 1 1 1 −1
A 31 = ( −1)4 = −5 A 32 = ( −1)5 = −2 A 33 = ( −1)6 =3
Since the determinant is not zero, then matrix A 2 3 1 3 1 2
is said to be non-singular. In this case, the
inverse exists and there is a need to set up the 12 9 − 10
adjoint. Thus, the cofactor
matrix Aij is [A ] = 1
ij
−1 − 2
− 5 − 2 3
12
2/18/2010
We can have the equation form Or we can transform that to the matrix form:
a11x 1 + a12 x 2 + a13 x 3 + L + a1n x n = b1
a11 a12 a13 L a1n x1 b1
a 21x1 + a 22 x 2 + a 23 x 3 + L + a2n x n = b 2 a a 22 a 23 L a 2n x 2 b 2
a 31x 1 + a32 x 2 + a 33 x 3 + L + a3 n x n = b 3 21
a31 a32 a33 L a 3n x 3 = b 3
M M M M M
am1x1 + am2 x 2 + am3 x 3 + L + amn x n = bm M M M M M M M
am1 am 2 am 3 L amn x n bm
where aij are constant coefficients of the
unknowns xj and bj are the constants
13
2/18/2010
A X B
14
2/18/2010
15
2/18/2010
1
Solution: Compute the determinant of A first. 2
The right hand side matrix B is
1 2 1 3
A = 3 3 1
To set up the matrix A1, all you just have to do is
1 2 − 1
to replace the first column of A by B. Doing what
A = −3 + 2 + 6 − 3 − 2 + 6 = 6 has just been described will result in:
Now, let us compute for the value of x1 by
1 2 1
using the formula A1 0
A 1 = 2 3 1 x1 = = =0
A 6
A1 3 2 − 1
x1 =
A A 1 = −3 + 6 + 4 − 9 − 2 + 4 = 0
1 1 1 1 2 1
A2 1 A3 1
x2 = = * 3 2 1 =1 x3 = = * 3 3 2 = −1
A 6 A 6
1 3 −1 1 2 3 LU Factorization
or
Direct L-
L-U Factorization: From matrix multiplication, we know that:
In theory any square matrix A may be factored into
a product of lower and upper triangular matrices. a11 a12 a13 a14 l11 0 0 0 1 u12 u13 u14
a a 22 a 23 a 24 l21 l22 0 0 0 1 u23 u24
21 = *
Let us take the case of a 4th order matrix: a31 a 32 a33 a34 l31 l32 l33 0 0 0 1 u34
a 41 a 42 a 43 a 44 l41 l42 l43 l44 0 0 0 1
a11 a12 a13 a14 l11 0 0 0 1 u12 u13 u14
a a 22 a 23 a 24 l21 l22 0 0 0 1 u23 u24 1. Get First Column Elements of Matrix L (1 unknown per equation)
21 = *
a31 a 32 a33 a34 l31 l32 l33 0 0 0 1 u34 a11 = l11(1) + 0(0) + 0(0) + 0(0) l11 = a11
a 41 a 42 a 43 a 44 l41 l42 l43 l44 0 0 0 1
l21 = a21
a 21 = l21(1) + l22 (0) + 0(0) + 0(0)
Notice that the diagonal elements of the upper a31 = l31(1) + l32 (0) + l33 (0) + 0(0) l31 = a 31
triangular matrix have been set to values of 1 for
reason of simplicity. (L-U Factorization is not a 41 = l41(1) + l42 (0) + l43 (0) + l44 (0) l41 = a 41
unique.)
16
2/18/2010
or or
From matrix multiplication, we know that: From matrix multiplication, we know that:
a11 a12 a13 a14 l11 0 0 0 1 u12 u13 u14 a11 a12 a13 a14 l11 0 0 0 1 u12 u13 u14
a a 22 a 23 a 24 l21 l22 0 0 0 1 u23 u24 a a 22 a 23 a 24 l21 l22 0 0 0 1 u23 u24
21 = * 21 = *
a31 a 32 a33 a34 l31 l32 l33 0 0 0 1 u34 a31 a 32 a33 a34 l31 l32 l33 0 0 0 1 u34
a 41 a 42 a 43 a 44 l41 l42 l43 l44 0 0 0 1 a 41 a 42 a 43 a 44 l41 l42 l43 l44 0 0 0 1
2. Get First Row Elements of Matrix U (1 unknown per equation) 3. Get Second Column Elements of Matrix L (1 unknown per equation)
a12 = l11(u12 ) + 0(1) + 0(0) + 0(0) u12 = a12 / l11 a22 = l21(u12 ) + l22 (1) + 0(0) + 0(0) l22 = a 22 − l21(u12 )
a13 = l11 (u13 ) + 0(u23 ) + 0(1) + 0(0) u13 = a13 / l11 a32 = l31 (u12 ) + l32 (1) + l33 (0) + 0(0) l32 = a32 − l31(u12 )
a14 = l11(u14 ) + 0(u24 ) + 0(u34 ) + 0(1) u14 = a14 / l11 a 42 = l41(u12 ) + l42 (1) + l43 (0) + l44 (0) l42 = a42 − l41(u12 )
From matrix multiplication, we know that: From matrix multiplication, we know that:
a11 a12 a13 a14 l11 0 0 0 1 u12 u13 u14 a11 a12 a13 a14 l11 0 0 0 1 u12 u13 u14
a a 22 a 23 a 24 l21 l22 0 0 0 1 u23 u24 a a 22 a 23 a 24 l21 l22 0 0 0 1 u23 u24
21 = * 21 = *
a31 a 32 a33 a34 l31 l32 l33 0 0 0 1 u34 a31 a 32 a33 a34 l31 l32 l33 0 0 0 1 u34
a 41 a 42 a 43 a 44 l41 l42 l43 l44 0 0 0 1 a 41 a 42 a 43 a 44 l41 l42 l43 l44 0 0 0 1
4. Get Second Row Elements of Matrix U (1 unknown per equation) 5. Get Third Column Elements of Matrix L (1 unknown per equation)
a 23 = l21 (u13 ) + l22 (u 23 ) + 0(1) + 0(0 ) a 33 = l31(u13 ) + l32 (u23 ) + l33 (1) + 0(0)
u23 = [a 23 − l21(u13 )] / l22 l33 = a 33 − l31(u13 ) − l32 (u23 )
From matrix multiplication, we know that: From matrix multiplication, we know that:
a11 a12 a13 a14 l11 0 0 0 1 u12 u13 u14 a11 a12 a13 a14 l11 0 0 0 1 u12 u13 u14
a a 22 a 23 a 24 l21 l22 0 0 0 1 u23 u24 a a 22 a 23 a 24 l21 l22 0 0 0 1 u23 u24
21 = * 21 = *
a31 a 32 a33 a34 l31 l32 l33 0 0 0 1 u34 a31 a 32 a33 a34 l31 l32 l33 0 0 0 1 u34
a 41 a 42 a 43 a 44 l41 l42 l43 l44 0 0 0 1 a 41 a 42 a 43 a 44 l41 l42 l43 l44 0 0 0 1
6. Get Third Row Element of Matrix U (1 unknown per equation) 7. Get Fourth Column Element of Matrix L (1 unknown per equation)
a34 = l31(u14 ) + l32 (u24 ) + l33 (u34 ) + 0(1) a 44 = l41(u14 ) + l42 (u24 ) + l43 (u34 ) + l44 (1)
u34 = [a34 − l31(u14 ) − l32 (u24 )] / l33 l44 = a 44 − l41 (u14 ) − l42 (u24 ) − l43 (u34 )
17
2/18/2010
− 4 2 1 − 4 0 0 y 1 3
4
A = − 3 5 − 1 0 y 2 = 4
1
− 3 7
y2 =
2
5 y 3 8
2
1 2 1 1
5
2 2
y3 = 3
− 4 0 0 1 − 1 − 1
2 4 Note that the computed values of yi's here
L = − 3 7 0 U = 0 1 −1
2 2 are not yet the solution since the original
1 5 5 0 0 1
2 2 system of equations is in terms of xi's.
18
2/18/2010
Examples:
An m x n matrix A is said to be in reduced row
echelon form if added to the first three The following matrices are not in row echelon form.
properties it satisfies a fourth property: (Why not?)
1 2 0 −1 3 2 1 0 0 0
0 1 2 −2 4
4. If a column contains a leading entry of some 1 0 1 − 3 5 0 1 2 0 0
1 6 − 7
row, then all the other entries must be zero. A = 0 0 0 1 9 2 B = 0 0 − 1 0 C=
0 0 1 8
0 0 0 0 0 0 0 0 0 1
0 1 0 0
0 0 0 0 0 1 0 0 0 0
Examples: Examples:
The following matrices are in row echelon form but not The following matrices are in reduced row echelon
in reduce row echelon form. form. (Hence, in row echelon form.)
Must all be zeroes to satisfy the 4th property.
1 0 − 3
1 0 0 0 0
1 0 8 0
0 0 1 0 0 2 1 0
1 2 3 4 0
0 1 0 − 5 6 2 1 0 − 3 G=
1 0 0
H = 0 0 1 0 − 3 J = 0 0 0
1 2 3
D= E = 0 1 0 0 − 8 F = 0 0 1 0 0 0 1 0
0 0 1 2 0 0 0 1 0 0 0 0
0 0 1 0 0 0 0 0 1
0 0 0 0 0 0 0
0 0 0 1
0 0 0 0
19
2/18/2010
20
2/18/2010
The objective of the Gaussian Elimination 1. Find the leftmost non-zero column.
2. If the 1st row has a zero in the column of step 1,
Method is to transform the augmented matrix interchange it with one that has a non-zero entry
[A : B] to the matrix [A* : B*] in row echelon in the same column.
form by applying a series of elementary row 3. Obtain zeros below the leading entry by adding
suitable multiples of the top row and to the rows
transformations. Getting the solution of the below that.
system [A* : B*] using back substitution will 4. Cover the top row and repeat the same process
also give the solution to the original system starting with step 1 applied to the leftover
submatrix. Repeat this process with the rest of
[A : B]. the rows.
5. For each row obtain leading entry 1 by dividing
each row by their corresponding leading entry
Has the augmented matrix associated to the system Element in the 1st row 1st column is non-zero and already
is equal to 1 (leading entry).
1 2 3 | 9 Transform into zeroes all elements below the leading
entry.
[A : B] = 2 − 1 1 | 8 1 2 3 9 |
3 0 − 1 | 3 R 2 ' → R 2 − 2 ⋅ R1
R 3 ' → R 3 − 3 ⋅ R1
[A * : B *] = 0 −5 | − 10
−5
0 − 6 − 10 | − 24
Consider now the transformation of column 2 Consider now the transformation of column 3
elements 1 2 3 | 9 elements
1 2 3 | 9
[A * : B *] = 0 − 5 − 5 | − 10
[A * : B *] = 0 1 1 | 2
0 − 6 − 10 | − 24 0 0 − 4 | − 12
Element at 2nd row 2nd column is non-zero and will be
Element at 3rd row 3rd column is non-zero and will be
transformed to 1 (leading entry). Afterwards, transform transformed to 1 (leading entry).
elements below to zero.
1 2 3 | 9
1 1 2 3 | 9
R2 ' → − R2 [A * : B *] = 0 1 1 | 2
1
R3 ' → − R 3 [A * : B *] = 0 1 1 | 2
5
0 − 6 − 10 | − 24 4
0 0 1 | 3
1 2 3 | 9
[A * : B *] = 0 1 1 | 2
Augmented Matrix in Row Echelon Form!
R3 ' → R3 + 6 R 2
0 0 − 4 | − 12
21
2/18/2010
On the other hand a second method called the S Search – search the ith column of the augmented
matrix from the ith row to the nth row for the
Gauss-
Gauss-Jordan Reduction Method gets rid of the maximum pivot, i.e. element with the largest
back substitution phase. The objective of the absolute value.
Gauss-Jordan Reduction Method is to I Interchange – assuming the maximum pivot
transform the augmented matrix [A : B] to the occurs in the jth row, interchange the ith row and
the jth row so that the maximum pivot will now
matrix [A* : B*] in reduced row echelon form by occur in the diagonal position.
applying a series of elementary row N Normalize – normalize the new ith row by
transformations. Doing this will automatically dividing it by the maximum pivot on the diagonal
position.
give the solution of the system [A* : B*] which E Eliminate – eliminate the ith column from the first
also provides the solution to the original up to the nth equation, except in the ith equation
system [A : B]. itself using the transformations.
22
2/18/2010
THE END
23