Sequences & Vectors

Vectors: Direction + Magnitude

A vector is a quantity that has both a size (magnitude) and a direction. Velocity, force, and displacement are all vectors — they tell you not just “how much” but also “which way.” A number alone (like temperature or mass) is a scalar. Vectors are the language of physics, engineering, and computer graphics.

What a Vector Looks Like

A vector in two dimensions can be described two ways:

Magnitude2
0.54
Angle (radians)0.79
06.28
0=20.79 rad=(2cos0.79,  2sin0.79)\vec0 = 2\,\angle\,0.79 \text{ rad} = (2\cos0.79,\; 2\sin0.79)

We can visualize the vector by plotting the line from the origin to the point (mag * cos(angle), mag * sin(angle)):

-5-4-3-2-112345-5-4-3-2-112345vector directiony-componentx-axis

The purple line shows the direction of the vector. The red horizontal line shows the y-component (how far up or down). The x-component is the horizontal distance from the origin to where the vector points.

Try This

Set the angle to 0 radians. The vector points purely to the right — it has an x-component equal to the magnitude and a y-component of 0. Now set the angle to pi/2 (about 1.57). The vector points straight up — all y-component, no x-component. The trig functions decompose the vector into horizontal and vertical parts.

Component Form

The most common way to work with vectors is in component form: v = (v_x, v_y).

Given magnitude |v| and angle theta:

Going the other direction:

v_x (horizontal)3
-44
v_y (vertical)2
-44
0=(3,  2),0=32+22\vec0 = (3,\; 2), \quad |\vec0| = \sqrt{ 3^2 + 2^2 }
-5-4-3-2-112345-5-4-3-2-112345vector linev_y levelx-axis

Vector Addition: The Parallelogram Rule

When you add two vectors, you place them tip-to-tail. The resultant vector goes from the start of the first to the end of the second. In components, it is beautifully simple:

(a_x, a_y) + (b_x, b_y) = (a_x + b_x, a_y + b_y)

a_x2
-33
a_y1
-33
b_x1
-33
b_y2
-33
0+0=(2+1,  1+2)\vec0 + \vec0 = (2 + 1,\; 1 + 2)
-5-4-3-2-112345-5-4-3-2-112345vector avector bresultant a+b

The purple line is vector a, the red line is vector b, and the green line is the resultant (a + b). The resultant always falls between the two original vectors, like a compromise of their directions.

Connection

In physics, vector addition is how forces combine. If two people push a box in slightly different directions, the box moves along the resultant vector. This is why a boat crossing a river at an angle ends up somewhere downstream — its velocity and the river’s current add as vectors.

Scalar Multiplication

Multiplying a vector by a scalar k scales its magnitude by |k| and reverses its direction if k is negative:

k * (v_x, v_y) = (k * v_x, k * v_y)

Scalar k1
-33
k0=1(2,1)=(12,  11)k \cdot \vec0 = 1 \cdot (2, 1) = (1 \cdot 2,\; 1 \cdot 1)
-5-4-3-2-112345-5-4-3-2-112345v = (2,1)k * v direction

The Dot Product

The dot product of two vectors produces a scalar:

a . b = a_x * b_x + a_y * b_y = |a| |b| cos(theta)

where theta is the angle between the vectors. The dot product tells you how much two vectors “agree” in direction.

Angle of a0.5
06.28
Angle of b1.2
06.28
00=00cos(θbθa)\vec0 \cdot \vec0 = |\vec0||\vec0|\cos(\theta_b - \theta_a)
-4-3-2-11234-4-3-2-11234vector avector bcos(angle between)
Try This

Set the angles so the two vectors are perpendicular (differ by about 1.57 radians). The yellow line showing cos(angle between) drops to zero. This is the geometric test for perpendicularity: two vectors are perpendicular if and only if their dot product is zero.

Unit Vectors

A unit vector has magnitude 1. To turn any vector into a unit vector, divide by its magnitude:

u = v / |v|

Unit vectors are useful because they capture only direction, with no magnitude information. The standard unit vectors are i = (1, 0) and j = (0, 1), so any vector (a, b) can be written as ai + bj.

Challenge

Challenge: A plane is flying at 300 mph heading north (angle = pi/2). A crosswind blows east at 40 mph (angle = 0). Write both as vectors in component form, add them, and find the actual speed and direction of the plane. How many degrees off course is the plane blown?

Take the Quiz