You are on page 1of 14

Vectors

We represent points in space by giving them co-ordinates. In 2D


space, we need two co-ordinates (x and y), and in 3D space we
need three (x , y and z ).

When we do arithmetic with spatial data, it becomes convenient to


represent these co-ordinates together as a single mathematical
object, a vector. (We will call individual numbers scalars.)

  0
3
We usually use column vectors, such as or 3.
4
5

There are different notations for vector variables - I use bold for
print (e.g. v) and underlined for writing by hand (e.g. v ). Some
people use an arrow (e.g. ~v ).
Vector Arithmetic

I To add (or subtract) vectors, add (or subtract) the components.


       
3 1 3 + 1 2
E.g. + = =
4 7 4+7 11
I To multiply a vector by a scalar, multiply its components.
     
3 5 3 15
E.g. 5 = =
4 54 20
I To find the scalar product (or dot product) of two vectors,
multiply the components and add the results.
   
3 2
E.g. = (3 2) + (4 5) = 6 + 20 = 14
4 5

The vectors must always have the same number of components.


Visualising Vectors
y
I A position vector ( xy )
10 defines a point with
a co-ordinates (x , y),
a+b
starting at the origin.
5 b I Sometimes its useful to
a imagine vectors which
x begin elsewhere.
5 5
I Adding two vectors
corresponds to placing
a 5 2a the start of one at the
end of the other.
a
10 I Multiplying a vector by a
scalar changes its length.
Magnitude and Direction

A scalar represents one quantity. In contrast, a vector has a


magnitude and a direction.

The magnitude of a vector is its The direction of a 2D vector is


length. We can find it using usually measured as an angle,
Pythagoras Theorem: anti-clockwise from East.

a a 3
3

4 4
p Using SOH CAH TOA,
|a| = 32 + 4 2
3
= 25 = 5 = tan1 36.9
4
Matrices

A matrix is a grid of numbers. (A vector is a matrix with only one


column.) The dimensions of a matrix are the numbers of rows and
columns.

5 1  
0 0 1 3
E.g. 2 4 is a 32 matrix, while is 24.
8 0 9 0
0 5

Matrix variables are usually given capital letters (e.g. A, B , M ).


Matrix Arithmetic
Matrix addition (and subtraction) and scalar multiplication are
component-wise, as with vectors. For example,

5 1 0 1 5 1 0 4 5 5
2 4 + 4 3 3 = 2 4 + 12 12 = 14 8
0 5 1 10 0 5 4 40 4 45

Addition is undefined for matrices with different dimensions.

For some purposes its useful to transpose a matrix:


T
5 1  
2 4 = 5 2 0
1 4 5
0 5

The transpose of an mn matrix is an nm matrix.


The transpose of a column vector is a row vector.
Matrix Multiplication

Matrix multiplication is not just done component-wise.

Firstly we define multiplication of a row vector and a column


vector to be their scalar product (i.e. a b = aT b):

 2 3 2
3 4 1 7 = + 4 7 = 6 28 10 = 32
10 + 1 10

Then to multiply matrices A and B , we multiply each row of A by


each column of B .

If A is a pq matrix and B is qr , then AB will be pr .

(Note that A must have as many columns as B has rows.)


Matrix Multiplication: Example



1 2



3 4


5 6
72 14
+04 = + 0
+26 + 12
0 4 2 2 4







= 26

1 8 3


38 48


7 0 2 17 26
Visualising Matrices
A 22 matrix multiplied by a 21 vector gives another 21
vector. Therefore, 22 matrices can represent transformations in
2D space. For example,
         
0 1 0 1 3 1
a= ,b= ,c= ,d= and M =
0 0 1 1 2 1

y y
Md

Mb
c d Mc
x x
a b Ma
Determinants: 22
Matrices are used for many different purposes. One important
feature of a square matrix is its determinant, a scalar value which
gives information about it. The relevance depends on the context:
for example, if a matrix represents a 2D transform, we can multiply
an area by the determinant to find the resulting area.
 
a b
For 22 matrices, det = ad bc.
c d
For example,
+

3 1
det = (3 1) (1 2) = 3 + 2 = 5

2 1
Determinants: 33

The determinant of a 33 matrix is more difficult to calculate.


(If the matrix represents a 3D transform, the volume of a
transformed shape is multiplied by the determinant.)

a b c
aek + bfg + cdh
The formula: det d
e f=
afh bdk ceg
g h k

This is not an easy formula to remember.


Determinants: 33 Example

+ + +
1 5 9 = 45
1 2 3 1 2 + 2 6 7 = 84 225
3 4 8 = 96


=
det 4 5 6 4 5


3 5 7 = 105


7 8 9 7 8
1 6 8 = 48 225
2 4 9 = 72

So the determinant is 225 225 = 0.

(This shows one method for applying the formula for the
determinant of a 33 matrix. If you find this difficult after trying a
few times, there are other methods which you could investigate.)
Matrix Algebra
Matrix multiplication is not commutative: for example, if
   
1 2 3 0
A= and B =
3 4 5 1

then    
13 2 3 6
AB = but BA =
29 4 8 14

However, it is associative, meaning A(BC ) = (AB )C .


It is always the case that det(AB ) = det(A) det(B ).
Also, it is possible to divide by A, when det(A) 6= 0:
    
3x + 4y = 11 3 4 x 11
=
2x 5y = 8 2 5 y 8
Undefined Operations

The following operations are not defined:


I Adding a vector and a scalar (or a matrix and a scalar).
I Adding/subtracting vectors/matrices of different dimensions.
I Scalar product of vectors of different dimensions.
I Multiplying a vector by another vector, and getting a vector
result (except for 3D vectors. . . )
I Dividing by a vector.
I Multiplying matrices of incompatible dimensions.
I The determinant of a non-square matrix.

You might also like