01. Matrices

Matrices

Vectors in the plane

A vector is an arrow in the plane (later we'll deal with vectors in higher-dimensional spaces). We encode this arrow as a pair of numbers ( x y ) . The number x tells us how far to the right the arrow points; the number y tells us how far upwards it points. If the arrow points to the left then x is negative; if it points downwards then y is negative.

Can you match up the vectors ( x y ) with those in the diagram? (Some of the vectors are not depicted).

Vectors in the plane: (A) points 1 left 1 down, (B) points 1 horizontally right, (C) points 1 vertically up (D) points 2 right and 1 up

( 1 2 ) , ( 0 1 ) , ( 1 1 ) , ( 1 0 ) , ( - 1 - 1 ) , ( 2 1 ) .

(answers at ).

A lot of this module will focus on the interplay between algebra (like column vectors) and geometry (like arrows in the plane).

A vector in the plane

Suppose v = ( x y ) is a vector. What is it's length? By Pythagoras's theorem, it's x 2 + y 2 . I'll write this as | v | , which you can read out loud as "norm v ". The angle that v makes with the horizontal is θ = arctan ( y / x ) (by trigonometry). If we want to write x and y in terms of | v | and θ , we get (again, using trigonometry): x = | v | cos θ , y = | v | sin θ . So v = ( | v | cos θ | v | sin θ ) .

2-by-2 matrices

What happens if I rotate v by an angle ϕ anticlockwise? We get a new vector w , which we can express in terms of v and ϕ .

A vector v making an angle theta with x-axis and w (rotated anticlockwise) by phi

Rotation preserves lengths, so | w | = | v | .

The angle that w makes with the horizontal is θ + ϕ . Therefore w = ( | v | cos ( θ + ϕ ) | v | sin ( θ + ϕ ) ) .

We can expand this using the trigonometric addition formulae: w = ( | v | cos ( θ + ϕ ) | v | sin ( θ + ϕ ) ) = ( | v | cos θ cos ϕ - | v | sin θ sin ϕ | v | sin θ cos ϕ + | v | cos θ sin ϕ ) .

Using x = | v | cos θ and y = | v | sin θ , we get w = ( x cos ϕ - y sin ϕ x sin ϕ + y cos ϕ ) .

This expresses w in terms of the original vector v = ( x y ) and the angle ϕ of rotation. We now invent a piece of notation which separates out the dependence of w on v from its dependence on ϕ : we write w = ( cos ϕ - sin ϕ sin ϕ cos ϕ ) ( x y ) . You can just think of this as a shorthand for ( x cos ϕ - y sin ϕ x sin ϕ + y cos ϕ ) , keeping track of where all the coefficients sit.

More generally, given a 2-by-2 array of numbers M = ( a b c d ) and a vector v = ( x y ) , we define the product M v = ( a b c d ) ( x y ) := ( a x + b y c x + d y ) . This defines the action of a matrix on a vector. This notation completely separates out the rotation ( M ) from the vector we started with ( v ).

Now we don't have to limit ourselves to rotations: any matrix ( a b x d ) defines a geometric transformation of the plane. This is the transformation ( x y ) ( a x + b y c x + d y ) . We'll see lots of examples in the next video (rotations, reflections, shears,...).

Mnemonic

How do you remember the formula for a matrix acting on a vector? The mnemonic I like is as follows. To get the first entry of M v , you ``multiply the top row of M into v '', that is you perform the multiplications a x and b y (working across the top row of M and down the column of v ) and sum them.

Diagram illustrating the mnemonic for the first entry

To get the second entry, you multiply the second row of M into v .

Diagram illustrating the mnemonic for the second entry

In the next video, we'll see lots of examples of transformations of the plane coming from 2-by-2 matrices.