/

# FP1: Chapter 4 Matrix Algebra - PowerPoint Presentation

## FP1: Chapter 4 Matrix Algebra - PPT Presentation

Dr J Frost jfrosttiffinkingstonschuk Last modified 29 th August 2015 Introduction A matrix plural matrices is simply an array of numbers eg But the power of matrices comes from being able to multiply matrices by vectors and matrices by matrices and invert them ID: 702618

#### Embed:

Presentation Transcript

Slide1

FP1: Chapter 4 Matrix Algebra

Dr J Frost (jfrost@tiffin.kingston.sch.uk)

29

th

August 2015Slide2

Introduction

A matrix (plural: matrices) is

simply an ‘array’ of numbers

, e.g.

But the power of matrices comes from being able to multiply matrices by vectors and matrices by matrices and ‘invert’ them: we can:

represent

linear transformations

using matrices (e.g. rotations, reflections and enlargements)

Use them to

solve linear simultaneous equations.

The first of these means matrices are particularly useful in 3D graphics/animation, since they allow us to rotate the camera and project 3D data onto a 2D viewing plane. But matrices are used everywhere, including robotics, computer vision, optimisation, classical and quantum mechanics, electromagnetism, optics, graph theory, statistics, ...

On a simple level, a matrix is simply a way to organise values into rows and columns, and represent these multiple values as a single structure

.Slide3

Using matrices to represent data

This is a scene from the film

Good Will Hunting

.

Maths professor

Lambeau

poses a difficult* problem for his graduate students from algebraic graph theory, the first part asking for a matrix representation of this graph. Matt Damon anonymously solves the problem while on a cleaning shift.

* It really isn’t.

?

In an adjacency matrix, the number in the

i

th

row and

j

th

column is the number of edges directly connecting node (i.e. dot)

i

to dot j

?Slide4

Using matrices to represent data

In my 4

th

year undergraduate dissertation, I used matrices to help ‘learn’ mark schemes from GCSE biology scripts. Matrix algebra helped me to initially determine how words (and more complex semantic information) tended to occur together with other words.Slide5

Using matrices to represent data

In S1, you learnt how we could extend the idea of

variance

(i.e. how much a variable varies) to that of

covariance

(i.e. how much two variables vary with each other).

A

covariance matrix

allows us to store the covariance between variables all in one convenient structure.

This allows us for example to extend a Normal Distribution from one dimension (i.e. involving just one variable) to multiple dimensions.

1D

2DSlide6

ζ

Matrix Fundamentals

Matrix Algebra

Understand the dimensions of a matrix, and operations on matrices, such as addition, scalar multiplication and matrix multiplication.Slide7

Matrix Fundamentals

#1 Dimensions of Matrices

The dimension of a matrix is its size, in terms of its number of rows and columns.

Matrix

Dimensions

2

3

3

1

1

3

?

?Slide8

Matrix Fundamentals

#2 Notation/Names for Matrices

A matrix can have square or curvy brackets*.

* The textbook only uses curvy.

Matrix

Column Vector

(The vector you know

and love)

Row Vector

So a matrix with one column is simply a vector in the usual sense.Slide9

Matrix Fundamentals

#3 Variables for Matrices

If we wish a variable to represent a matrix, we use bold, capital letters.

Slide10

Matrix Fundamentals

#4 Elements

Each value within a matrix is known as an

element

.

If

A

is a matrix, then we can refer to the element in the

i

th

row and jth column as

.

Note that you do not need to know this notation for referencing elements for the purposes of FP exams, but it’s worthwhile knowing.

?

?

?Slide11

Matrix Fundamentals

Simply add/subtract the corresponding elements of each matrix.

They must be of the same dimension.

?

?Slide12

Matrix Fundamentals

#6 Scalar Multiplication

A scalar is a number which can ‘scale’ the elements inside a matrix/vector.

?

?

?

1

2

3Slide13

Matrix Fundamentals

#7 Matrix Multiplication

This is where things get slightly more complicated...

1 0 3 -2

2 8 4 3

7 -1 0 2

5 1

1 7

0 3

8 -3

-11

We start with this row and column, and sum the products of each pair.

(1 x 5) + (0 x 1) + (3 x 0) + (-2 x 8) = -11

You will see in C4 that this is known as finding the “dot/scalar product” of the two vectors.

16

Now repeat for the next row of the left matrix...

42

61

50

-6Slide14

=

Matrix Fundamentals

#7 Matrix Multiplication

Now you have a go...

?

?

?

?

?

?

a

b

c

d

e

fSlide15

Matrix Fundamentals

#7 Matrix Multiplication

Matrix multiplications are not always valid: the dimensions have to agree.

Note that only

square matrices

(i.e. same width as height) can be raised to a power.

Dimensions of A

Dimension of B

Dimensions

of AB (if valid)

2

3

3

4

2

4

1

 32  3Not valid.

6

2

2

4

6

4

1

3

3

1

1

1

7

5

7

5

Not

valid.

10

10

10

9

10

9

3

3

3

3

3

3

?

?

?

?

?

?

?Slide16

Exercise 4C

Q1, 3, 5, 6, 8, 9Slide17

ζ

Linear Transformations

Matrix Algebra

Appreciate what linear transformations are, and how we can use matrices to represent them.Slide18

Position vectors

You should be familiar with the difference between a vector and a point:

Point:

represents a position in space.

Vector:

represents a movement.

A position vector allows us to treat a point as a vector.

A position vector [x y] represents the movement from the origin (0,0) to the point (

x,y

).

?

?

x

y

Point (5,3)

Position vector [5 3]

For the remainder of the chapter, when I say ‘point’, I really mean ‘position vector’.Slide19

Linear Functions

From GCSE, you are used to a linear function looking like the equation of a straight line:

More generally, if we had multiple inputs, a linear function is:

When the inputs and outputs of the function are

vectors

however, then we have a

linear map/transformation

if:

The first condition ensures that if we scale the original point x, then this scales the transformed point too. The second says that if we add two vectors, then resulting vector will be the same then if we transformed each of the vectors individually then added them – we say that the transformation ‘preserves vector addition and scalar multiplication’.

and

represent vectors here not the

and

value of a vector.

Slide20

Linear Transformations

This follows by letting the scalar

in

This means that the origin is unaffected by a linear transformation.

Suppose that

0

is the

0-vector

, i.e. The position vector (0,0) in 2D, (0,0,0) in 3D, etc.

Then for a linear transformation f:

?

Can you express the following transformations as functions?

If linear, prove it, otherwise find a counterexample.

Example 1

Reflects a 2D point in the y-axis.

Proof of linearity:

?

?Slide21

Linear Transformations

Example 2

Rotates a 2D point 90

Linear?

Yes (proof similar to before)

?

?

Example 3

Enlarges by a scale factor of 3 with the origin as the centre of enlargement.

Linear?

Yes. Proof:

?

?Slide22

Linear Transformations

Example 4

Projects a 3D coordinate onto the

xy

-plane, almost as if you were observing a 3D point where your viewing window/eyes are the

xy

-plane.

Linear?

Yes (proof left as exercise)

?

?

This is useful in 3D graphics, because you need to turn 3D data into a 2D image by projecting onto a viewing plane.

Example 5

Translate a 2D point 1 unit to the right.

?

Linear?

No! The origin is not preserved.

?Slide23

Linear Transformations

As we have seen, the following transformations are linear and not linear:

Reflection

(where line of reflection goes through the origin)

Rotation

(with centre at the origin)

Enlargement

(with centre at the origin)

Linear

Non-Linear

Translation.

!

A linear transformation in general is when each output is a linear combination of the inputs

,

e.g

:

While a transformation can create or destroy dimensions, in FP1 we’ll just be dealing which transformation which transform 2D points to 2D points. Slide24

Affine Transformations

(Not mentioned in FP1)

Affine transformations extend linear transformations by

allowing a constant term

. This hence allows us to represent translations.

Linear

Affine

Linear Transformations

The following examples are

NOT

linear transformations:

(can you prove it?)

Slide25

Using Matrices for Linear Transformations

Matrices allow us to represent all possible linear transformations.

Reflection in

-axis:

?

Rotation 90

?Slide26

Using Matrices for Linear Transformations

Matrices allow us to represent all possible linear transformations.

?

?

?

?

?Slide27

Basis Vectors and Vector Spaces

(Not mentioned in FP1)

Basic vectors

are usually (but not necessarily) the unit vectors along each axis.

A

vector space

is all possible points that can be obtained by some linear combination of the basis vectors.

Example: 2D space

Basic vectors:

Vector space:

All position vectors

since

Intuitively this is obvious: any point in 2D space can be obtained by some movement along the

axis and some movement along the

axis.

Our basis vectors could have been any non-parallel vectors.

?

?Slide28

Using Matrices for Linear Transformations

There’s a groovy trick that allows us to work out what matrix to use for a particular transformation. Observe:

Thus, each column of the matrix tells us how the unit vectors are transformed. These transformed basis vectors form the new vector space.

x

y

x

y

Example: Reflection in

-axis.

?

First column is first basis vector transformed.

?

?Slide29

Using Matrices for Linear Transformations

x

x

Rotation

?

x

x

Rotation

?

?

?Slide30

Rotation for multiples of

In the FP1 specification, you are only required to identify rotations for multiples of

, although the rotation matrix for

anticlockwise in general is in your formula booklet.

Rotation of

anticlockwise

Rotation of

clockwise

Rotation of

anticlockwise

Bro Tip

: To remember these without having to plug in your

in the above matrix, just remember the

scaling, and then just visually think how each basis vector is transformed to get the signs of the 1s correct.

?

?

?Slide31

Using Matrices for Linear Transformations

x

x

Enlargement by scale factor 2 about the origin.

?

x

x

No change.

?

?

?

This is known as the identity matrix, and is denoted by

.

Slide32

A quick digression…

An identity element in general is a special type of element on a set (e.g. the set of integers, or real numbers, or matrices) with respect to a binary operator on the set.

An element

is an identity element if for all

in the set and some operator

then:

Set

Operation

Identity Element

0 (since

)

1 (since

)

square matrices

Matrix multiplication

(since

)

(

e.g

, but you tend to just see

)

Set

s

(since

)

Boolean Algebra

(since

)

matrices

The

“0-matrix”

.

Vectors

The “0-vector”

.

Set

Operation

Identity Element

Matrix multiplication

Set

s

Boolean Algebra

Vectors

(Not mentioned in FP1)

?

?

?

?

?

?

?Slide33

Using Matrices for Linear Transformations

x

x

Reflection in the line

?

?

Since for any line of length

and inclination

, the

component is

and

component

, i.e.

must be the angle between the

axis and line of reflection.

We can see from the diagram above that when we reflect

we can form the following triangle:

1

Thus the vector gets transformed to

We can do something similar to transform

Slide34

Jan 2011 Q2

June 2011 Q3

Reflections in the

-axis.

Enlargement by scale factor 3 about the origin.

A reflection in the line

?

?

?Slide35

Exercise 4E

Describe the transformations represented by the matrix:

a)

Reflection in

-axis.

b)

Rotation

anticlockwise

.

c)

Rotation

clockwise

.

And for these:

a)

Rotation

clockwise

.

b)

Enlargement scale

factor 4, centre

.

c)

Rotation

.

1

3

4

Find the matrix that represents these transformations.

Rotation of

.

Reflection in the

-axis.

Enlargement centre

scale factor 2.

5

Find the matrix that represents these transformations.

Enlargement scale factor -4 centre (0,0).

Reflection in the line

.

of

clockwise.

?

?

?

?

?

?

?

?

?

?

?

?Slide36

Combined Transformations

We know that for a position vector

and a matrix

representing some transformation, then

is the transformed point.

If we wanted to apply a transformation represented by a matrix

followed by another represented by

, what transformation matrix do we use to represent the combined transformation?

This is because to apply the effect of

followed by

, we have:

(

because matrix multiplication is ‘associative’*)

Bro Tip: Ensure that you put these matrices in the right order – the first that gets applied is on the right!

* A binary operator

is

associative

if

, i.e. when we multiply matrices, the order in which we multiply them doesn’t matter.

?Slide37

Combined Transformations

Represent as a single matrix the transformation representing a reflection in the line

followed by a stretch on the

axis by a factor of 4.

=

?

?

?

Represent as a single matrix the transformation representing a rotation

anticlockwise

followed by a reflection in the line

.

=

?

?

?

What single transformation is this?

Reflection in the

axis.

?Slide38

Exercise 4F

Page 93

Q1, 3, 5, 7Slide39

Matrix Inverses

In maths, we are used to functions having an inverse.

It would seem logical to have some inverse of multiplying something by a matrix, so that we can represent ‘undoing’ the transformation (e.g. the inverse of the matrix representing

rotation clockwise would be a matrix representing a rotation

anticlockwise).

!

If

then

is the ‘inverse’ of

, so that if

,

since the effect of a transformation followed by its inverse has no effect.

Slide40

Determinants

The determinant of a matrix

is

So

If

, then

is a

singular matrix

and

does not exist

(since we can’t divide by 0).

If

, then

is a

non-singular matrix

and

exists.

A

det

(A)

1

-2

3

-2

A

det

(A)

1

-2

3

-2

?

?

?

?

It’s worthwhile reflecting on the significance of the determinant: in the context of transformations, it ‘determines’ whether we can ‘undo’ a transformation. And later, we’ll see that it can tell us whether a series of simultaneous equations are solvable.Slide41

Practicing the Inverse

Divide by determinant.

Swap NW-SE elements.

Make SW-NE elements negative.

Click to

BroinverseSlide42

For what value of

is

singular? Given

is not this value, find the inverse.

?

?

?

?

?Slide43

Using

A matrix multiplied by its inverse is the identity matrix.

If

and

are non-singular matrices, prove that

If

then

The general strategy for solving these kinds of equations is to multiply whatever’s on the front of the multiplication by its inverse, to ‘cancel it out’.

?

If

and

are

non-singular matrices such that

. Prove that

.

?Slide44

Exercise 4G

Page 97

Q1a, c, e

2a, c

4, 6, 8, 10, 11Slide45

Inverse matrices represent inverse transformations

!

Suppose

and

are column vectors. Then if

, then

.

The inverse matrix therefore allows us to retrieve the original point/position vector before a transformation.

The triangle

has vertices at

,

and

. The matrix

transforms

to the triangle

with vertices at

and

.

Sketch the two triangles, and hence show that

So the determinant was the scale factor of the area.

-

1 1

(2,4)

(4,10)

(4,3)

-4 4

?Slide46

Area scale factor

We saw in this example that:

Area of image

Area of object

i.e

. the determinant tells us how the area is scaled under the transformation matrix

.

Area of Object

Transformation Matrix

Area of Image

Area of Object

Transformation Matrix

Area of Image

?

?

?

?Slide47

Exam Question

Edexcel FP1 - Jan 2011

4

Note that we’re given the points on the

image

! So use inverse transformation.

So points are

.

?

?

?

?Slide48

Exercise 4I

The matrix

is used to transform the rectangle

with vertices at the points

,

,

and

.

a) Find the coordinates of the vertices of the image of

.

b) Calculate the area of the image of

.

A rectangle of area 5cm

2

is transformed by the matrix

. Find the area of the image of the rectangle when

is:

a)

c)

e)

The triangle

has area 6cm

2

and is transformed by the matrix

where

is a constant, into triangle

.

Find

in terms of

.

Given that the area of

is 36cm

2

, find the possible values of

.

1

4

5

Area = 40

a) 70 c) 15 e) 90

?

?

?Slide49

Frost Life

Stories

TM

In the game

Assassin’s Creed II

, you encounter a variety of

concentric ring picture puzzles

, which upon successfully completing, you unlock a segment of a secret video.

Rings are

connected in pairs

, and must be rotated together in their pairs. The aim is to form a complete picture. Different possible pairs can be selected, for example, where there just 3 rings, you could rotate A and B together, B and C together or C and A together.

Only certain pairings are available.

Because I’m a massive geek, I formed simultaneous equations and used a matrix inverse to solve them, which therefore told me how many times to rotate each pair.

We’ll see how we can do this.Slide50

Using Matrices For Simultaneous Equations

Turn the following simultaneous equations into a matrix:

Hence, use a matrix inverse to solve these simultaneous equations.

Let

. Then

So

and

.

?

?Slide51

Solve (using matrices) the simultaneous equations:

So

,

.

Explain why the following simultaneous equations have no solution:

The matrix

has no inverse because the determinant is 0.

Q

Q

?

?Slide52

Exercise 4J

Use inverse matrices to solve the following simultaneous equations.

?

?

?

?

1a

1b

2a

2b