Vectors

Vectors

A vector is something that has both magnitude and direction.

5mph is not a vector, it's a scalar quantity. 5mph due east is a vector, velocity.

Vectors can be in any dimension. A simple example is R^2, which is the set of all tuples (read 2d coordinate plain). R^n refers to an n-dimensional real coordinate space.

Notation

You might see a few different notations:

v = (5, 0)

v = [5]
    [0]

Operations

Addition

You add vectors by adding the magnitude and direction separately:

(6, -2) + (-4, 4) = (2, 2)

Graphically this is like walking both vectors.

Multiplication by a scalar

3 * (2, 1) = (6, 3) // Graphically, the vector will have the same direction but a larger magnitude.
-1 * (2, 1) = (-2, -1) // same magnitude but flipped direction