You are on page 1of 31

Introduction to Matrices

Dr. Ammar Isam


This chapter contains
This chapter is introducing matrices. It is divided into three main sections.
- Section 1 is discuss some of the basic properties and types of matrices
- Section 2 the operations of matrices strictly from a mathematical
perspective is given with examples.
- Section 3 the way to find invers of the square matrix with size 2*2, and
3*3 is discussed in details.

2
Section 1
Matrix: An Algebraic Definition
Algebraic definition of a matrix: a table of scalars in square brackets.
Matrix dimension is the width and height of the table, n x m.
Typically we use dimensions 2 x 2 for 2D work, and 3 x 3 for 3D
work.

- A matrix is a set of elements, organized into rows and columns


rows

a b 
columns
c d 
 
3
Matrix Components
Entries are numbered by row and column, eg. mij is the entry in row
i, column j.
Start numbering at 1, not 0.

4
Square Matrices
Same number as rows as columns.
Entries mii are called the diagonal entries. The others are called
nondiagonal entries

5
Diagonal Matrices
A diagonal matrix is a square matrix whose nondiagonal elements
are zero.

6
The Identity Matrix
The identity matrix of dimension n, denoted In, is the n x n matrix with 1s
on the diagonal and 0s elsewhere.

7
Vectors as Matrices
A row vector is a 1 x n matrix.
A column vector is an n x 1 matrix.
They were pretty much interchangeable in the lecture on Vectors.
They’re not once you start treating them as matrices.

8
Transpose of a Matrix
The transpose of an r x c matrix M is a c x r matrix called MT.
Take every row and rewrite it as a column.
Equivalently, flip about the diagonal

9
Transpose of a Vector
If v is a row vector, vT is a column vector and vice-versa

10
Basic Matrix Operations
Addition, and Subtraction

a b   e f  a  e b  f 
c d    g   
h  c  g d  h 
Just add elements
  

a b   e f  a  e b  f 
c d    g 
h  c  g d  h 
 Just subtract elements
  

11
Multiplying By a Scalar
Can multiply a matrix by a scalar.
Result is a matrix of the same dimension.
To multiply a matrix by a scalar, multiply each component by the
scalar.

12
Matrix Multiplication
Multiplying an r x n matrix A by an n x c matrix B gives an r x c
result AB.

13
Matrix Times Column Vector Multiplication
Can multiply a matrix times a column vector.

14
Example

15
Another Way of Looking at It

16
2 x 2 Case

17
2 x 2 Example

18
3 x 3 Case

19
3 x 3 Example

20
Identity Matrix
Recall that the identity matrix I (or In) is a diagonal
matrix whose diagonal entries are all 1.
Now that we’ve seen the definition of matrix
multiplication, we can say that IM = MI = M for all
matrices M (dimensions appropriate)

21
Matrix Multiplication Facts
Not commutative: in general AB  BA.
Associative:
(AB)C = A(BC)
Associates with scalar multiplication:
k(AB) = (kA)B =A(kB)
(AB)T = BTAT
(M1M2M3…Mn)T = MnT …M3TM2TM1T

22
Row Vector Times Matrix Multiplication
Can multiply a row vector times a matrix

23
Determinants
Determinant of order 2

 a11 a12 
Consider a 2  2 matrix: A
a22 
 a21

Determinant of A, denoted , is
|A | a number and
can be evaluated by
a11 a12
| A |  a11a22  a12 a21
a21 a22

24
easy to remember (for order 2 only)..
a11 a12
| A |  a11a22  a12 a21
a21 a22
- +

1 2
Example: Evaluate the determinant: 3 4
1 2
 1  4  2  3  2
3 4

25
The following properties are true for
determinants of any order.
1. If every element of a row (column) is zero,
e.g., 1 2
 1 0  2  0  0 , then |A| = 0.
0 0

determinant of a matrix
2. |AT| = |A| = that of its transpose

3. |AB| = |A||B|
26
 a11 a12 
For any 2x2 matrix A
 a21 a22 

1  a22 a12 
Its inverse can be written as A  1
 a
A  21 a11 

 1 0 
Example: Find the inverse of A 
 1 2 
The determinant of A is -2
 1 0 
Hence, the inverse of A is 1
A  
1/ 2 1/ 2 
How to find an inverse for a 3x3 matrix?

27
Determinants of order 3
1 2 3
Consider an example: A   4 5 6
7 8 9 

Its determinant can be obtained by:


1 2 3
4 5 1 2 1 2
A  4 5 6 3 6 9
7 8 7 8 4 5
7 8 9
 3  3  6  6  9  3  0

You are encouraged to find the determinant by


using other rows or columns 28
Inverse of a 33 matrix
1 2 3 
Cofactor matrix of A  0 4 5 
1 0 6 

The cofactor for each element of matrix A:


4 5 0 5 0 4
A11   24 A12   5 A13   4
0 6 1 6 1 0

2 3 1 3 1 2
A21   12 A22  3 A23   2
0 6 1 6 1 0

2 3 1 3 1 2
A31   2 A32    5 A33  4
4 5 0 5 0 4
29
1 2 3 
Cofactor matrix of A  0 4 5  is then given by:
1 0 6 

 24 5 4 
 12 3 2 
 
 2 5 4 

30
1 2 3 
Inverse matrix of A  0 4 5  is given by:
1 0 6 

 24 5 4   24 12 2 
T

1 1   1  
A   12 3 2  5 3 5
A  22  
 2 5 4   4 2 4 

 12 11  6 11 1 11 
  5 22 3 22 5 22 
  2 11 1 11 2 11 

31