Chapter 7: Vectors


A 2D point:

represents a location w/ respect to some coordinate system.

A 2D vector:

represents a displacement from a position.

Vectors have length and direction - but no inherent location. Can represent a displacement or motion.

Consider that one step north while standing in NYC is the same as one step north while standing in SLO - in terms of displacement/motion.


We write vectors as lists of components:

We write vectors as a column matrix:



Multiplication by a scalar:

Multiplying a vector by a scalar changes its length, but not its direction.


(this is component-wise)

Vector additional can be visualized by placing the vectors head-to-tail.


Geometric of is a vector in the opposite direction.

So, subtraction is not suprising:

Basis Vectors

Linear Combination

A linear combination of vectors is a vector of the form:

where are scalars.

Barycentric coordinates are an example of a linear combination (of vectors).

Linearly Independant

If two vectors are non-zero and not parallel, they are called linearly independant.

For two given linearly independant vectors and , we can write any vector in terms of the other two.

The two vectors and are then called basis vectors.

Any vector can be expressed as a linear combination of the basis vectors:

Note that the cooeficients and are unique - that is, a different and will give a different vector .

Cartesian Coordinates

If two vectors are at right angles to each other (e.g. they are orthogonal), they form an orthogonal basis.

If the vectors are also both of length , we call this an orthonormal basis.

In 2D, we can use 2 such special vectors and to define the Cartesian basis vectors:

Not surprisingly, the Cartesian basis vectors in 3D are:

(Note that for a 3D coordinate system, we need three basis vectors.)


Depending on where the axis points, we call a basis left or right handed. This will come up again when we talk about other operations on vectors.

The handedness refers to how the third basis is related to the first two. If the first basis vector is along your thumb and the second basis vector is along your index finger, your palm is pointing in the direction of the third basis vector. Note that this is a different direction for your left or right hand.

In OpenGL, we use a right-handed basis.

Coordinate Frame

A Coordinate Frame (or coordinate system) consists of an origin point and a basis of linearly independant vectors .

The standard coordinate system in 3D is:

Any 3D point can be written as: