You are on page 1of 100

MATRIX ALGEBRA

Matrices
Matrices
Geometric Concept
2

Addition

S=T+X
or
S=TX

Multiplication

4
Translation
Scaling
Rotation

Matrix Algebra

Definitions
Operations

Definition - scalar

a scalar is a real number


Ex: 1,3, 5.5,

Matrix
A matrix is an array of numbers
a11 , , a1n
a , , a
2n
A 21
a ij

a
,

,
a
mn
m1
Denoted by Capital letters
All matrices have an order (or dimension):
that is, the number of rows the number of
columns. So, A is m by n or (m n).

Example 01: Find the dimensions of each matrix.

2 1

1.A = 0 5
4 8
Dimension: 3x2

0 5 3 1
3. C =

2 0 9 6

1
2
2.B =
3

4
Dimension: 4x1

Dimension: 2x4

Definitions

A square matrix - a matrix that has the


same number of rows and columns (n
n).

Column Matrix - a matrix that has only


one column.

Row Matrix - a matrix that has only one


row.

Matrix Equality

Two matrices are equal if and only if

they both have the same number of rows


and the same number of columns
their corresponding elements are equal

Example 02: Find the values for x and y.

2x y
1.

2x 3y 12

* Since the matrices


are equal, the
corresponding
elements are equal!
* Form two linear
equations.

Answer

2x y
2x 3y 12

3
x
2
y 3

Example 03: Find the values for x and y

3x y x 3
2.

2y
y

Answer

3x y x 3
x 2y y 2

x 1
y 1

Matrix Operations

Transposition
Addition and Subtraction
Scalar Multiplication
Matrix Multiplication
Inversion

The Transpose of a Matrix:


T
A

The transpose of a matrix is a new


matrix that is formed by interchanging
the rows and columns of the original
matrix.

The transpose of A is denoted by AT

Example of a transpose

Thus,
a11 a12
A a21 a22
a a
31 32

a11

a12

a21
a22

If A = AT, then A is symmetric

a31
a32

Addition and Subtraction

Two matrices can be added (or


subtracted) iff they are in the same
order.

Simply add (or subtract) the


corresponding elements. So, A + B = C
yields.

Addition and Subtraction


(cont.)
a11
a
21
a31

a12

a22
a32

b11 b12 a11 b11


b21 b22 a21 b21
b31 b32 a31 b31

If A [aij ]mn , B [bij ]mn


Then A B [aij ]mn [bij ]mn [aij bij ]mn

a12 b12

a22 b22
a32 b32

Example 04: (Matrix addition)

1 2 1 3 1 1 2 3 0 5
0 1 1 2 0 1 1 2 1 3

1 1
1 1
0
3 3 3 3 0

2 2
0
2 2

Scalar Multiplication

To multiply a scalar times a matrix,


simply multiply each element of the
matrix by the scalar quantity.
a11 a12 ka11 ka12

a21 a22 ka21 ka22

If A [aij ]mn , k : scalar


Then kA [kaij ]mn

Matrix subtraction:
A B A (1) B

Example 04: (Scalar multiplication and matrix


subtraction)
4
0 0
1 2
2
A 3 0 1
B 1 4 3

2
3 2
2 1
1
Find (a) 3A (b) B (c) 3A B

Solution:
(a)
3A 3

(b)

1 2 4 31 3 2
3 4 3 6 12
3 0 1 3 3 3 0 3 1 9 0 3

2 1 2 3 2 31
3 2 6 3
6

0
0
0 0
2
2
4 3
B 1 1 4 3 1

1 3 2
3 2
1

(c)
3A B

1 6 12
3 6 12 2
0 0
9 0 3 1 4 3 10 4 6



4
6 3
6 1
3 2 7 0

Matrix Multiplication

In order to multiply matrices, number of


columns in the first matrix must equal
number of rows in the second matrix.

Matrix Multiplication (cont.)


A
Ex.

B =

mxn nx
p

mxp

Can you multiply? What will the


A
B
AB
dimensions
be?
2x3
3x4
2x4
A
5x3

B
5x2

AB

AB
Not
possible

How to multiply...

a
a
b c d = c

2x
1

1x
2

ad

2x2

How to multiply...

a
a
b c d = c
b

ad
bd

2x
1

1x
2

2x2

Matrix Multiplication (cont.)

Thus

where

a11 a12 a13 b11 b12 c11 c12


a a
x b b c

a
c
23
21 22
21 22 21 22
a31 a32 a33 b31 b32 c31 c32
c11 a11b11 a12 b21 a13b31
c12 a11b12 a12 b22 a13b32
c 21 a21b11 a22 b21 a23b31
c 22 a21b12 a22 b22 a23b32
c31 a31b11 a32 b21 a33b31
c32 a31b12 a32 b22 a33b32

Example 05

1
5

-1(4)+5(6) -1(-3)+5(8)
5(4)+2(6)
0(4)+(-4)6

5(-3)+2(8 =
)
0(-3)+(4)8
26 43
32

-24 -32

5 4 3

2 6 8
4

-4+
3+
30
40
20+12 -15+
16
0 -24
0 -32

3 9 2
2.

5 7 6

2 1

3 4

Dimensions: 2 x 3
2x
2
Multiplication is not defined
1 2 1
3. 1 3 2
2 6 1

x 1
y 7

z 8

x 2y z 1
x 3y 2z 7
2x 6y z 8

Special matrices

Diagonal
Null
Identity

Diagonal Matrix

A diagonal matrix is a square matrix that


has values on the diagonal with all offdiagonal entities being zero.
a11 0
0 a
22

0
0

0
0

0
0
a33
0

0
0
0

a44

Identity Matrix

An identity matrix is a diagonal matrix


where all diagonal elements equal one.
I=

1
0

0
1
0
0

0
0
1
0

0
0
0

A I = A= I A

Null Matrix (Zero matrix)

A square matrix where all elements equal


zero.
0
0

0
0
0
0

0
0
0
0

0
0
0

Properties
Properties of matrix addition and scalar
multiplication:
If A, B, C M , c, d : scalars
mn

Then (1) A+B = B + A


(2) A + ( B + C ) = ( A + B ) + C
(3) ( cd ) A = c ( dA )
(4) 1A = A
(5) c( A+B ) = cA + cB
(6) ( c+d ) A = cA + dA

Properties of zero matrices:

If A M mn ,

c : scalar

Then (1) A 0 mn A

(2) A ( A) 0 mn
(3) cA 0 mn c 0 or A 0 mn
Note:
(1)0mn: the additive identity for the set of all
mn matrices
(2)A: the additive inverse of A

Properties of transposes:

(1) ( AT )T A

(2) ( A B )T AT B T
(3) (cA)T c( AT )
(4) ( AB )T B T AT

Example 06:
0 1 2
If A a 0 3 is a skew-symmetric, find a,

b c 0 b, c?

Sol:
0 1 2
A a 0 3
b c 0

0 a b
AT 1 0 c

2 3 0

A AT a 1, b 2, c 3

Example 07:
Show thatAAT

is symmetric

Poof ( AAT )T ( AT )T AT AAT


:
AAT is symmetric

Real number:
ab =
(Commutative law for
ba
multiplication)
Matrix:
AB BA
mn n p

Three situations:
(1) If m p, then AB is defined, BA is undefined.
(2) If m p, m n, then AB M mm , BA M nn (Sizes are not the
(3) If m p n, then AB M mm , BA M mm

same)

(Sizes are the same, but matrices are


not equal)

Properties
AB does not necessarily equal BA
(BA may even be an impossible operation)
For example,

(2 3)
B

(3 2)

(3 2) = (2 2)
A

(2 3) = (3 3)

Matrix multiplication is Associative


A(BC) = (AB)C

The Determinant of a Matrix

The determinant of a matrix A is denoted


by |A| (or det(A)).
Determinants exist only for square
matrices.

The Determinant of a 2x2


matrix

If A =

a11 a12
a

21 a22

Then

A a11a22 a12a21

Minor and Cofactor of a Matrix Entry


Definition:
If A is a square matrix, then the minor of
entry aij is denoted by Mij and is defined to
be the determinant of the sub-matrix that
remains after the ith row and jth column are
deleted from A. The number (-1)i+jMij is
denoted by Cij and is called the cofactor of
a11 a12 a13
entry aij.
A= a21 a a
22
23
For 3x3 matrix
a31 a32 a33

M11 =

a22
a23
a

C11 =(-1)1+1 M11 = M11

Example

A=

The minor M11=


of a11 is:
The
cofactor of
a11 is:
The minor
of a23 is:
The
cofactor of

2 3

5 3

0 8

= 5X8 - 3X0=40

C11=(-1)i+jMij=(-1)2M11=M11=40
M23=

= 1X0 2X1=-2

C23=(-1)i+jMij=(-1)5M23 =-M23 =2

Finding determinant using the cofactor


a11 a12 a13
a21 a22 a23
a31 a32 a33
C11= a22
a32

a23

C12= -

a33a11 a12 a13


a21 a22 a23

a21
a23
a31

C13
=

a21
a22
a31

a33
= a11C11 +a12C12 +a13C13

a31 a32 a33


And for nxn matrix: = a11C11 +a12C12 +..
+a1nC1n

a32

Example :
You can use any row or column to get the value of the
determinant
A=

1 0

2 -3

3 4

-1 5

det(A) = a11C11 +a12C12 + a13C13


+a14C14

2 -2

0 1

1
4

det(A)=(1 5
)
1

3
0

2 -2

- (0) -1

- (-3) -1

2 -2
1

3
+2

-1

= (1)(35)-0+(2)(62)-(-3)
(13)=198

5 -2
1

Properties of Determinants

Determinants have several mathematical


properties which are useful in matrix
manipulations.
1 |A|=|AT|.
2. If a row or column of A = 0, then |A|= 0.
3. If every value of a row or column in a matrix
A is multiplied by k, then |new matrix| = k|
A|.
4. If two rows (or columns) are interchanged
the sign, but not value, of |A| changes.
5. If two rows or columns are identical, |A| = 0.
6. If two rows or columns are linear
combination of each other, |A| = 0

Properties of Determinants
7. |A| remains unchanged if each element of
a row or column is multiplied by a constant
and added to any other row.
8. |AB| = |A| |B|
9. Det of a diagonal matrix or upper
triangular (lower triangular) = product of
the diagonal elements

The Inverse of a Matrix A (A


1
)
For an n n matrix A, there may be a
Matrix B such that
AB = I = BA.
The inverse is analogous to a reciprocal
A matrix which has an inverse is
nonsingular.
A matrix which does not have an inverse
A 0
is singular.
A1
(1) The inverse of A is
Note:
An inverse exists only if
denoted by

(2) AA1 A1 A I

Theorem : (The inverse of a matrix is unique)


50/61

If B and C are both inverses of the matrix A, then


B = C.
AB I
Pf:
C ( AB ) CI
(CA) B C
IB C
BC
Consequently, the inverse of a matrix is unique.

How to find inverse matrixes?

If

a b
A

c d

-1

1
det( A)

and |A| 0

d b
c a

Properties of inverse
matrices

AB

T 1

-1 1

B A
-1

A
-1

-1

The Inverse of a Matrix


The transpose of the matrix of cofactors from A is
called the adjoint of A, and it is denoted by
Adj(A).

c11 c12
Cofactor Matrix c21 c22
c31 c32
c11
Adj ( A) C T c12
c13

c21
c22
c23

c13
c23
c33

c31
c32
c33

How to Find A-1 Using the Adjoint of a


Matrix?
If A is an invertible matrix, then

1
A
Adj(A)
det(A)
1

Note:
1.The square matrix A is invertible if and only if det(A)
is not zero.
2. If A is an n x n triangular matrix, then det(A) is the
product of the entries on the main diagonal of the
matrix.

Find the inverse of a matrix by Gauss-Jordan


Elimination:
55/61

| I Gauss
-Jordan
Eliminatio
n I | A1

Elementary Row Operations


1.
2.
3.

Interchange any two rows.


Multiply a row by a nonzero constant.
Replace a row with itself and a multiple
of another row.

Example : Find the inverse of the following


matrix.

1 1 0
1 0 1
6 2 3

Solution:

1 1 0 1 0 0
A I 1 0 1 0 1 0
6 2 3 0 0 1

1 1

r '2 r 2 (1 ) r1

0
6

1 0 0
1 1 1 1 0

0
3

0 0 1

Ex : (Find the inverse of the following matrix)


58/61

1 1 0 1 0 0

r3 ' r3 6 r1
0
1 1 1 1 0
0 4
3 6 0 1

Solution
59/61

1 1 0 1 0 0

r3 ' r3 4 r2
0
1 1 1 1 0
0 0 1 2 4 1

60/61

0 0
1 1 0 1

r3 ' ( 1) r3
0
1 1 1
1 0
0 0
1 2 4 1

61/61

0 0
1 1 0 1

r2 ' r2 r3
0
1 0 3 3 1
0 0 1 2 4 1

62/61

1 0 0 2 3 1

r1 ' r1 r2
0 1 0 3 3 1
0 0 1 2 4 1
[ I A1 ]

63/61

So the matrix A is invertible, and its inverse is


2 3 1
A1 3 3 1
2 4 1

Check to
verify1:
AA A1 A I

Ex : Find the inverse of the following matrix


64/61

1 2 3
A 2 5 3
1 0 8

Sol:

1 2 3 1 0 0
A I 2 5 3 0 1 0
1 0 8 0 0 1

3 1 0 0
1 2
r '2 r 2 (2 ) r1 0 1 3 2 1 0
1 0
8 0 0 1
2
3 1 0 0
1
r '3 r 3 ( 1 ) r1 0
1 3 2 1 0
0 2
5 1 0 1

65/61

3 1 0 0
1 2
r '3 r 3 ( 2 ) r2 0 1 3 2 1 0
0 0 1 5 2 1

3 1
0 0
1 2
r '3 1 r3 0 1 3 2
1 0
0 0
1 5 2 1

0
0
1 2 3 1
r '2 r 2 3r3 0 1 0 13 5 3
0 0 1 5 2 1

66/61

6
3
1 2 0 14
r '1 r 1 3 r3 0 1 0 13 5 3
0 0 1
5 2 1
9
1 0 0 40 16

r '1 r1 2 r2
0 1 0 13 5 3
0 0 1
5 2 1
9
40 16
A1 13 5 3

5 2 1

Power of a square matrix:


67/61

(1) A0 I

(2) Ak AA

A

(k 0 positive integer)

k factors

(3) Ar A s Ar s

r , s : posivite integers

( Ar ) s Ars
d1 0
0 d
2
( 4) D

0 0

0
d1k

0
0
Dk

d n
0

0 0

d 2k 0

k
0 dn

Rank

The rank of a matrix is defined as


rank(A) = number of linearly
independent rows
= the number of linearly
independent columns.

A set of vectors is said to be linearly


dependent if scalars c1, c2, , cn (not all
zero) can be found such that
c1a1 + c2a2 + + cnan = 0

Linear System
3x 2 y 5 z 3
2 x y 4 z 2
x 4 y 7z 1

If you have a system of


equations and just pick off
the coefficients and put
them in a matrix it is
called a coefficient matrix.

3 2 5

A 2 1
4
1
4 7

Coefficient matrix

Augmented matrix

3x 2 y 5 z 3
2 x y 4 z 2
x 4 y 7z 1

If you take the coefficient


matrix and then add a last
column with the constants,
it is called the augmented
matrix. Often the
constants are separated
with a line.

3
3 2 5

A 2 1
4 2
1
4 7 1

Row Echelon Form


We use elementary row operations to make the matrix look
like the one below. The # signs just mean there can be any
number here---we dont care what.

1
0

#
1
0

#
#
1

#
#

"The Goal"

After we get the matrix to look like our goal, we put


the variables back in and use back substitution to
get the solutions.

This is one example only. You can find so many


row echelon forms like one below.

Recall

Use row operations to obtain


echelon form:
We already
have 1
where we
need it.

1 2 1 1
3 5 1 3

2 6 7 1
The augmented matrix

Well take row 1 and multiply it by


3 and add to row 2 to get a 0.
The notation for this step is
r2 +(3)r1 we write it by the row
we replace in the matrix.

x 2y z 1
3x 5 y z 3
2x 6 y 7z 1
Work on this column first.
Get the 1 and then use it
as a tool to get zeros
below it with row
operations.

1
0

#
1
0

#
#
1

#
#

r2= r2+(-3)r1

3r1
+ r2

1 1
1 2
0 1 2 0

2 6
7 1

6 3

0 1 2

Now well use 2 times row 1 added to row 3 to get a 0 there.

1
1 2
0 1 2

r3= r3 + (-2)r1

2r1
Now our
first column
is like our
goal.

1
0

2 4

+ r3 2

6
2

2 2

7 1
5 1

We need a 1 in the second row second column


so well multiply row 2 by 1

r2=(-1)r2

1
1
1 2
0 1 2 0

0 2
5 1

Well use row 2 with the 1 as a tool to get a 0


below it by multiplying it by 2 and adding to
row 3

1 2 1 1
0 1 2 0
r3= r3 + (2)r2

0 0 1 1
2r2

0 2 4

+ r3 0

2
0

5 1
1 1

the second column is


like we need it now

1
0

#
1
0

#
#
1

#
#

z column

y column

x column

1 2 1
0 1 2

equal signs

0 0 1 1

x 2

x x22 2y z11 1
y y
2 2z100
y2
z 1
Substitute 1 in for z in
second equation to find y

Substitute 1 in for z and 2


for y in first equation to find
Now well move to the third
x.
column and we see for our goal Solution is: (2 , 2 ,
we just need a 1 in the third row 1)
of the third column. We have it so
1
#
#
#

weve achieved the goal and its


0 1 # #
time for back substitution. We

put the variables and = signs


0 0 1 #
back in.

x 2y z 1
3x 5 y z 3
2x 6 y 7 z 1

Solution is: (2 , 2 ,
1)

This is the only (x , y , z) that


make ALL THREE equations
true. Lets check it.

2 2 2 1 1
3 2 5 2 1 3
2 2 6 2 7 1 1

x 2y z 1
3x 5 y z 3
2x 6 y 7 z 1

Solution is: (2 , 2 ,
1)

Geometrically this means we have three planes that


intersect at a point, a unique solution.

The process of reducing the augmented matrix to echelon


form or reduced echelon form, and the process of
manipulating the equations to eliminate variables, is called:

Gaussian Elimination

Lets try another one:

3x 2 y 2 z 6
2x 3 y 4z 0
7 x 3 y 2 z 1

Echelon form

1 1

2
6

8 12
0 1 5

5
0 0 0 19

If you put variables and = signs back in the


bottom equation then 0 = 19
a false statement!
INCONSISTENT - NO SOLUTION

Example:

5x 6 y z 4
2x 3y z 1
4x 3y z 5

Echelon form

1 3 2 1
0 1 1 1

0 0
0 0

put variables
back in
solve for x & y

x 3 y 2 z 1
y z 1

x t2
y t 1
z t

Infinitely many solutions where t is any real number

Lets try another one:

5x 4 y 2 z 6
3x 2 y 4 z 0

5 - 4 2 6
3 - 2 4 0

1 - 4/5 2/5 6/5




4 0
3 -2

r '1 (1 / 5 ) r1

1 - 4/5 2/5 6/5


0 2/5 14/5 - 18/5

r '2 r2 ( 3) r1

1 - 4/5 2/5 6/5




1
7 -9
0

r '2 ( 5 / 2 ) r2

Corresponding equations are

4
2
6
x y z
5
5
5
y 7 z 9

Let z = t t is any real number


then y = -9-7t
x=(4/5)(-9-7t)-(2/5)t+(6/5)=(-6)t+(-6)

1 2 3 1 2
3 1 2 4 1

2 3 5 1 3

r '2 r2 3 r1

r '3 r3 2 r1

r '2 1 / 7 r2

1 2 3 1 2
0 7 7 7 7

0 1 1 1 1
1
0

2
1

0 1

3
1
1

1 2
1 1
1 1

r '3 r3 r2

1 2 3 1 2
0 1 1 1 1

0 0 0 0 0

Let s take two parameters called s and t

x t 3s 4
y t s 1
z t
ws

Few techniques to find the solutions of a linear


system if the linear system has a unique
solution

Cramers Rule

If a system of n linear equations in n variables


has a coefficient matrix with a nonzero
determinant,
A
then thedet(
solution
of det(
theAsystem
is given
by
A1 )
det( A
2)
n)
x1
, x2
, , xn
,
det( A)
det( A)
det( A)
where the ith column of Ai is the column of
constants in the system of equations.

a11
a11 x1 a12 x2 a13 x3 b1
A3

a
x

a
x

a
x

a21
21 1 22 2
23 3
2
3
A
a x a x a x b
a31
3
31 1 32 2 33 3

a12
a22
a32

b1
b2
b3

a11
a21
a31

a12
a22
a32

a13
a23
a33

Example
3-100

Use Cramers Rule to solve the system of linear


equation
x 2 y 3z 1
2x
z 0
3x 4 y 4 z 2
Sol:

1
2 3
A 2
0
1 10 0 (the system has an unique solution)
3 4
4
3
8
1
2 3
y , z
2
5
0
0
1
A1
2 4
4 (2)(1)(2) (4)(1)(1) 8 4
x

A
10
10
10 5