0% found this document useful (0 votes)
48 views22 pages

Matrix Algebra Slides Class Notes V5 S010 Week 13 B Apr 8

Matrices are used to represent transformations in computer graphics by moving points that make up objects. A matrix is an array of numbers with rows and columns. Vectors can be represented as column matrices. To add or subtract matrices, they must have the same dimensions. To multiply a matrix by a scalar, each element is multiplied by the scalar. Two matrices are equivalent if their corresponding elements are identical. Matrix multiplication follows specific rules - the number of columns of the first matrix must equal the number of rows of the second. Matrix multiplication is not commutative.

Uploaded by

Taylor Beautrand
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
48 views22 pages

Matrix Algebra Slides Class Notes V5 S010 Week 13 B Apr 8

Matrices are used to represent transformations in computer graphics by moving points that make up objects. A matrix is an array of numbers with rows and columns. Vectors can be represented as column matrices. To add or subtract matrices, they must have the same dimensions. To multiply a matrix by a scalar, each element is multiplied by the scalar. Two matrices are equivalent if their corresponding elements are identical. Matrix multiplication follows specific rules - the number of columns of the first matrix must equal the number of rows of the second. Matrix multiplication is not commutative.

Uploaded by

Taylor Beautrand
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 22

Module: Matrix Algebra

Matrices
Matrices are used to perform transformations, rotation and scaling of objects in computer graphics.
This allows us to take any points in space (an object is made up of many points), and move these
points (in turn moving the object) by rotating it, shrinking it, stretching it, whatever we’d like. We
will talk more about this in the module Matrix Transformations.

What is a matrix?

An n × m matrix is an array of numbers (each called an element) with n rows and m columns. For
example, a 2 ×3 matrix (let’s call it matrix A) is set up in the following way:

A=
[ a11 a12 a13
a 21 a22 a23](a a a
= 11 12 13
a21 a22 a23 )
Example 1: What are the dimensions of the following matrices?

[]
1
a) A= [
1 2 3 4
2 −1 5 2 ] b) B=[1 −1
2 −3 ] c) C=
−2
3
4

[ ] [ ]
1 0 0 5 2 0
d) D= 0 1 0 e) E= 2 1 −1 f) F=[ 1 0 0 0]
0 0 1 0 0 1

g) Square Matrix definition: A square matrix has the same number of rows and columns

Which matrices are square matrices?

h) Which matrices have the same dimensions?

i) Row Matrix definition: If the matrix has only one row, then it’s a row matrix.

Which matrix is a row matrix?

j) Column Matrix definition: If the matrix has only one column, then it is a column matrix.

Which matrix is a column matrix?


Module: Matrix Algebra

k) Zero matrix definition: If all the elements of a matrix are zeros, then it’s a zero matrix.

What is a 3 ×2 zero matrix?

Define a Vector as a Matrix


A column matrix

[]
a1
a2
A= a 3
a4

an

is often used to represent a vector. If we have a vector, say ⃗v , in 2 dimensions where the vector has
its tail at the origin and the head at the point (x , y ), we know that this vector can be represented by
⃗v =[ x , y ]. This vector is being represented as a row matrix. More often you will see a vector being

represented as a column matrix, in this case, ⃗v = [ xy ] .


Example 2: Write the vector starting at the origin and ending at any point in the 3-dimensional
space; or in 4 dimensions.

2
Module: Matrix Algebra

Add and Subtract Matrices


In order to add or subtract matrices, the dimensions of each matrix must be EQUAL. The answer
matrix will also be the same dimension.

Example 3: Can we add a 2 ×2 matrix with a 3 ×3 matrix? They are both square matrices!

Example 4: Can we add/subtract the following matrices?

[ ]
1 0 0
a) [ 1 2 3 4
2 −1 5 2 ]
and 0 1 0
0 0 1

[ ] [ ]
5 2 0 1 0 0
b) 2 1 −1 and 0 1 0
0 0 1 0 0 1

c) [ 21 −21 ] [ 12 −1
and
−3 ]

[]
1
−2
d) and [ 1 0 0 0 ]
3
4

How do we add/subtract matrices? The sum is defined as the matrix consisting of the sums of the
corresponding elements.

Example 5: Add/Subtract the following matrices.

a) [ 21 −21 ] [ 12 −1
+
−3 ]
b) [ 21 −21 ]−¿ [ 10 −3
−1
]

3
Module: Matrix Algebra

[ ][ ] [ ][ ]
5 2 0 1 0 0 5 2 0 1 2 0
c) 2 1 −1 + 0 1 0 d) 2 1 −1 −¿ 0 −1 0
0 0 1 0 0 1 0 0 1 0 3 1

[ ][ ]
1 0
e) [ 22 ][
1 0+1 2 3 4
3 1 2 −1 5 2 ] f)
−2 − 0
3 3
4 −2

4
Module: Matrix Algebra

Multiply and Divide a Matrix by a Scalar


When we multiply a single number (a scalar) with a matrix, we have to multiple EVERY element of
the matrix by that scalar.

Example 6: For the following matrices,

[
A= 2 −1 , B= 0
1 3 ] [ ] [
2 , C= 1 −2
−2 −4 −1 −4 ]
find the following:

a) 2A b) ½ B

[
A= 2 −1 , B= 0
1 3 ] [ ] [
2 , C= 1 −2
−2 −4 −1 −4 ]
c) 3C

5
Module: Matrix Algebra

[ ] [
A= 2 −1 , B= 0
1 3 ] [
2 , C= 1 −2
−2 −4 −1 −4 ]
d) 2A−3 C

6
Module: Matrix Algebra

A=
[ 21 −13 ] , B=[−20 −42 ] , C=[−11 −2
−4 ]

e) 2(A+B−C ¿

Step 1 first solve: (A+B−C ¿

Step 2 then solve: 2(A+B−C )

7
Module: Matrix Algebra

Equivalent Matrices
Two matrices are said to be equal if every corresponding element is identical.

Example 7:

a) Can a 2 ×3 and a 3 ×2 matrix be equivalent matrices?

b) Are the following matrices equivalent? Why or why not?

[ 12 2 3 4
−1 5 2
and ] [
1 2 3 4
2 −1 5 1 ]
Example 8: Find the value of each variable such that the equation is true.

a) [ x+x y]=[25] b) [−2x+ yy 36 xz ]=[12 61]

8
Module: Matrix Algebra

Find the value of each variable such that the equation is true.

c) [ 2a 31]+[ a+bb 31]=[−12 c2] d) [ 1a −1e ]+k [23 01]=[ 91 −13 ]

9
Module: Matrix Algebra

You should now be able to complete:

Matrix Algebra Homework


Questions 1-8

10
Module: Matrix Algebra

Multiply Matrices
There is a special way to multiply matrices. Note that we do NOT just multiply each corresponding
element.

We can only multiply two matrices where the number of columns of the first matrix is EQUAL to the
number of rows of the second matrix.

Multiplying a m× n matrix by a n × p matrix results in a m× p matrix.

Procedure for finding the matrix product:

1. Make sure the # of columns in the first matrix = # of rows in the second matrix
2. Multiply the elements of each row of the first matrix by the elements of each column in the
second matrix.
3. Add the products.

Example 9: Can we multiply the following matrices? What size of matrix do we end up with?

a) 4 ×2 and 3 ×2 b) 4 ×2 and 2 ×3 c) 2 ×2 and 2 ×3 and 3 × 4

Example 10: Multiply the following matrices

a) [ 25 −10 ][−11 35] b)[ 13 02 ][−12 −21 ]

11
Module: Matrix Algebra

][ ]
2 2
c) [ 1 −1 2
0 2 −2
3 −1
−2 4

][ ]
2 2
d) [
1 2 3 4
2 −1 5 1
3 −1
−2 4

[ ][ ]
1 2 0 1
e) 0 −1 0 −3
0 3 1 2

12
Module: Matrix Algebra

Note: Matrix multiplication is NOT commutative. What does that mean? If A and B are matrices
where the product can be taken, in most cases, AB≠ BA .

Example 11: Show why the following matrices do not commute (explain why AB≠ BA ).

[ ] []
1 2 0 1
a) A= 0 −1 0 , B= −3
0 3 1 2

b) A= [ 13 02] , B=[−12 −21 ]

AB=
[13 02][−12 −21 ]
[ 4 −4 ]
AB= 2 −2

[ ][ ]
BA= 2 −2 1 0
−1 1 3 2

BA=[
2 ]
−4 −4
2

13
Module: Matrix Algebra

Transpose of a Matrix

Finding the transpose of a matrix means taking each column of a matrix and turning it into the row
of a new matrix, or vise-versa. This can sometimes be used to calculate, for example, the dot
product a different way.

Example 13: If A= [ 23 14 ] T
, then A = [21 34 ] .

Example 14:

[ ]
2 3
a) If A= 4 −1 , then find AT
7 6

[ ]
1 2 0
b) If A= 0 −1 0 , then find AT
0 3 1

14
Module: Matrix Algebra

Define the Identity Matrix


There are a few special matrices and matrix operations that are important, one of them being the
identity matrix.

The identity matrix, I is a square matrix with 1’s for elements on its principal diagonal, with all other
elements being zero.

[ ]
Diagonal is all 1’s
1 0 0 ⋯ 0
0 1 0 ⋯ 0 Every other element is 0
I= 0 0 1 ⋯ 0
0 ⋮ ⋮ ⋱ 0
0 0 0 ⋯ 1

The identity matrix I behaves like 1 in arithmetic multiplication. The identity matrix multiplied by any
other square matrix results in the same matrix.

AI =IA =A

Show that AI =A

A= [ 35 72] I= [10 01]

15
Module: Matrix Algebra

Find the Determinant and the Inverse of a Matrix

Inverse of a Matrix
If we have a square matrix A , then the inverse of that matrix is denoted A−1, and has the following
property

A A−1 =A−1 A=I

One of the reasons we use matrix inverses is to solve equations. The “typical” way of solving
equations doesn’t always apply with matrices. For example, if 2 x=4 , we solve this by dividing by 2,
and the answer is 4/2=2. We can’t do this when the coefficients and variables are matrices.

What do we do?

If A is a square matrix, B is a matrix where AB exists and C is the product of the two matrices,
meaning

AB=C ,

then the following is true

B= A−1 C

This means that if we want to solve for B we need to take the inverse of A in order to move it to the
other side of the equation. Therefore, in order to solve, we need to be able to find the inverse of a
matrix.

How do we compute the inverse of a matrix? We first need to discuss another matrix operation.

Determinant of a 2 ×2Matrix
The determinant of a matrix is used as an indicator whether a matrix has an inverse. If det A=0 ,
then that means the matrix A is NOT invertible (meaning it doesn’t have an inverse). Note that a
matrix MUST be square if want to compute the determinant, and the inverse must exist if we want
to solve for the matrix B in AB=C from above.

16
Module: Matrix Algebra

How do we find the determinant of a 2 ×2 matrix?

det
| || |
a1 a2 a1 a2
=
b1 b2 b1 b2
=a1 b 2−b1 a2

The determinant equals the multiplication of the principal diagonal a 1 b2 minus the multiplication of
the off-diagonals b 1 a2 .

Example 16: Do the following matrices have an inverse (are they invertible)? Compute the
determinant of the 2 ×2 matrices.

a) If A= [ 13 −2
−2 ]
, find ¿ A∨¿. b) If A=[−53 −23 ] , find det A .

c) If B=¿ [ 84 −4
−2 ]
, find ¿ B∨¿ . d) If B=¿ [−10 −4
−2 ]
, find ¿ B∨¿ .

17
Module: Matrix Algebra

The determinant of a 3 ×3 matrix or higher is also possible, but we will only be looking at 2 ×2
systems. Note: the procedure we use to calculate the cross product of vectors is actually doing the
determinant of a 3 ×3 matrix!

Inverse of a 2 ×2Matrix
In order to find the inverse of a 2 ×2matrix, we need to be able to compute the determinant.

How do we find the inverse of a 2 ×2 matrix?

[ ]
If A=
a1 a2
b1 b2
−1
,then A =
1
[b2 −a2
det A −b1 a1 ]
The inverse of a matrix A is the reciprocal of the determinant of A multiplied by a new matrix
where the principal diagonals of A are switched and the off-diagonals of A are changed signs.

Example 17: Why is det A ≠ 0 necessary in order to find the inverse of A ?

Example 18: Find the inverse of the following matrices.

a) A= [ 13 −2
−2 ]
, find A−1 b) If B= [−53 −23 ] , find B−1

18
Module: Matrix Algebra

[ ]
If A=
a1 a2
b1 b2
−1
,then A =
1
det [
A
b2 −a2
−b1 a1 ]
c) C= [ 84 −4
−2 ]
, find C−1 d) D= [−10 −4
−2 ]
find D −1

19
Module: Matrix Algebra

Now we can use the inverse in order to solve for equations involving matrices. Remember:

If AB=C , then B= A−1 C

Example 19: If M = [−10 −4


−2 ] [ 13 −2
and MN =
−2 ]
, find N.

20
Module: Matrix Algebra

21
Module: Matrix Algebra

You should now be able to complete:

Matrix Algebra Homework


Questions 9-27

22

You might also like