Vectors
☰ Contents
A vector is a quantity with both a size and a direction. A distance of 5 km is a scalar. A move of 5 km north-east is a vector. In three dimensions, lines, planes and the angles and distances between them all come from two products: the dot product and the vector product.
What is a vector?
A vector has a size and a direction, while a scalar has size alone: a speed of 20 km/h is a scalar, but a wind of 20 km/h from the northwest is a vector. Drawn as an arrow, its length is the size and its head shows the direction. To calculate, write the step across and the step up as components: (4, 1) means 4 across and 1 up. The arrow from (2, 5) to (6, 6) is that vector, because 6 − 2 = 4 and 6 − 5 = 1. A vector records a movement, not a place, so arrows with the same components are the same vector wherever they start. A negative component points the other way: (−4, 1) goes 4 to the left. Check by components: the arrow from (0, 0) to (4, 1) has components 4 − 0 = 4 and 1 − 0 = 1, so it is the same vector.
A column vector writes the step across on top.
The arrow from (1, 1) to (4, 3) and the arrow from (0, 0) to (3, 2) are the same vector too, because both mean 3 across and 2 up.
See Vectors and Column vectors.
How do you add and subtract vectors?
To add two vectors, add their matching components, across with across and up with up. For (3, 1) and (1, 2), the sum is (4, 3), since 3 + 1 = 4 and 1 + 2 = 3. On a diagram, start the second arrow where the first ends; the sum, called the resultant, runs from the first start to the last finish. This works because across and up moves never affect each other, so the order does not matter either. Subtraction changes one step: subtract the matching components, which is the same as adding the negative of the second vector, the arrow turned around. So (3, 1) − (1, 2) is (2, −1), because 3 − 1 = 2 and 1 − 2 = −1. Check a difference by adding it back: (2, −1) + (1, 2) should return (3, 1), and 2 + 1 = 3 with −1 + 2 = 1 confirms it.
b = (−1, 2)
Make the resultant lie along the y-axis
If a and b are the position vectors of two points, then b − a is the arrow from the first point to the second: destination minus start.
Multiplying a vector by a number is scalar multiplication. Multiplying by 3 makes the arrow three times as long in the same direction. A negative number reverses it as well. Two vectors are parallel exactly when one is a scalar multiple of the other.
See Adding vectors, Subtracting vectors and Scalar multiplication.
Now you
The drawing chains a then b. Where does the journey end?
(-4, -2) + (-2, 2) is what?
What is the magnitude of a vector, and what is a unit vector?
The magnitude of a vector is the length of its arrow, written |a|, and a unit vector has length 1. The components are the shorter sides of a right triangle with the vector as hypotenuse, so Pythagoras gives the length: , since 9 + 16 = 25. For a unit vector in the same direction, divide each component by the magnitude: (3, 4) becomes . Both components shrink by the same factor, so the arrow gets shorter without turning. Signs do not affect the length, because each component is squared: |(−5, 12)| is 13, since 25 + 144 = 169. In three dimensions a third square joins the sum. The zero vector has no unit vector, because it has no direction and dividing by 0 is undefined. Check a unit vector by finding its length: the squares of and are and , and .
at 60° the term −2ab cos θ is −12, so a² + b² and c² are not equal
Find the angle where a² + b² = c²
Any vector is its length times its unit vector, so (3, 4) is 5 lots of .
i is one step along the x-axis and j is one step along the y-axis, so 3i + 4j is the vector (3, 4). The position vector of a point is the vector from the origin O to that point, and the vector from A to B is AB = OB − OA.
See Magnitude of a vector, Unit vectors, The unit vectors i and j and Position vectors.
Now you
How long is the vector (5, 12)?
A is at (3, 3) and B at (9, 11). How long is AB?
How do you prove a geometry result with vectors?
Write each point as a position vector from an origin O, express the lines in those vectors, and read the result from the algebra, where parallel lines appear as scalar multiples. For the midpoint M of AB, walk to A and then half of the gap: OM = a + ½(b − a) = ½(a + b). With A at (2, 6) and B at (8, 2), M is at (5, 4), since 2 + 8 = 10 and 6 + 2 = 8, each then halved. The method works because a vector carries length and direction, so one equation can prove two facts. Points on one line need a different step: show that AC is a multiple of AB, with one multiplier for every component. For A(1, 1), B(3, 2) and C(7, 4), AB is (2, 1) and AC is (6, 3), three times AB. Check AC: 7 − 1 = 6 and 4 − 1 = 3.
In triangle OAB, let P and Q be the midpoints of OA and OB. Then PQ = ½b − ½a = ½AB. Because PQ is a multiple of AB, this one line proves that PQ is parallel to AB and half its length.
Parallel vectors pass the same test, and the multiplier also gives the ratio of their lengths.
See Vector proofs with midpoints and Collinear vectors.
Now you
Are (2, 3) and (7, 9) along the same line?
Are (4, 4) and (12, 12) along the same line?
What does the dot product actually measure?
The dot product measures how far two vectors point the same way. Multiply the matching components and add: , a number, not a vector. For (3, 4) and (2, 1), it is 10, since 3 × 2 + 4 × 1 = 6 + 4 = 10. The same number equals , with the angle between the arrows: |a| times the length of the shadow of b on a. So it is positive for an acute angle, zero for a right angle, and negative for an obtuse one. A vector dotted with itself has and cos 0 = 1, giving its length squared: (3, 4) · (3, 4) is 25, the square of 5. Check a dot product both ways: for (1, 0) and (1, 1), the components give 1 × 1 + 0 × 1 = 1, and is also 1.
past 90° the shadow points against a, so a · b = |a| × shadow is negative: −9.19
Swing b until a · b = 0
Among vectors of fixed lengths, it is largest when they point exactly the same way.
To find the angle, divide the dot product by both lengths: . Perpendicular vectors have a dot product of zero, because cos 90° = 0.
See The dot product and The angle between vectors.
Now you
Which pair is perpendicular? Check the dot products.
Two vectors have a dot product of 0. What is the angle between them?
How do vectors work in three dimensions?
A vector in three dimensions has a third component, for depth: (2, 3, 6) means 2 across, 3 up and 6 out, also written 2i + 3j + 6k, where k is one step along the z-axis. Addition, scalar multiplication and the dot product work as in two dimensions, one component at a time. For (2, 3, 6) and (1, −2, 4), the sum is (3, 1, 10), and the dot product is 2 − 6 + 24 = 20. The rules carry over because the three axes are perpendicular, so a move along one leaves the other coordinates alone. The magnitude changes form. It needs Pythagoras twice, across the floor and then up to the tip, so three squares sit under the root: . The cross product is new. Check the sum component by component: 2 + 1 = 3, 3 − 2 = 1 and 6 + 4 = 10.
the floor diagonal is √(x² + y²) = 3.61; stand z = 4 on its end and Pythagoras again gives |v| = √(3.61² + 4²) = 5.39, which is √(x² + y² + z²)
Make the box 3 by 4 by 12 and read the diagonal
The length of (2, 3, 6) is .
The distance between two points is the magnitude of the vector between them. The midpoint averages each coordinate on its own, z included.
See Vectors in three dimensions and Distance and midpoint in three dimensions.
What is the vector equation of a line?
A line is fixed by one point on it, with position vector a, and one direction d. Every point of the line is r = a + t d for some number t, the parameter. For the line through (1, 2, 0) with direction (2, −1, 3), t = 2 gives (5, 0, 6), since 1 + 2 × 2 = 5, 2 − 1 × 2 = 0 and 0 + 3 × 2 = 6. It works because any point is reached by walking to a, then t steps along d. Any multiple of d, such as (4, −2, 6), gives the same line. For a line through two points A and B, use a as the point and b − a as the direction. To test a point, solve for t in one component and check the rest: (7, −1, 9) needs t = 3, since 1 + 2 × 3 = 7, and the other two components agree.
λ = 0.5: r = a + λd = (2, 1.5), λ copies of d laid head to tail from A, and sweeping λ through every value traces the whole line
Slide P to λ = 2 and read r = a + 2d
The Cartesian form removes the parameter. Make t the subject of each coordinate equation and set the three expressions equal: . The numerators give the point and the denominators give the direction.
In space, two lines that are not parallel can still miss each other, like a bridge and the road under it. Such lines are skew. Set the two positions equal, solve two of the three component equations for t and s, and substitute into the third. If it holds, the lines meet. If it fails, they are skew.
See The vector equation of a line, The Cartesian form of a line and Intersecting and skew lines.
What is the cross product for?
The cross product, or vector product, a × b is a vector at right angles to both a and b: . For (1, 0, 0) and (0, 1, 0) it gives (0, 0, 1), since the last component is 1 × 1 − 0 × 0 = 1: two steps across the floor give one straight up. It makes a normal to a plane from two directions in it. Its dot product with a, and with b, is zero, which is what perpendicular means. Order matters: b × a = −(a × b), and parallel vectors give the zero vector. Its length is the area of their parallelogram. Check with a dot product: for a = (1, 2, 0) and b = (0, 1, 3), a × b is (6, −3, 1), and 1 × 6 + 2 × (−3) + 0 × 1 = 0.
a × b stands perpendicular to both, as long as the parallelogram's area |a||b| sin θ
Swing b until it is parallel to a
That length is . Half of it is the area of the triangle with the same two sides.
See The vector product and Parallelogram area from the vector product.
How do you write the equation of a plane?
A plane is written from a point a and two directions b and c in it, as , or from a point a and a normal n, a vector at right angles to the plane. For any point r in the plane, r − a lies in the plane, so (r − a) · n = 0, which rearranges to r · n = a · n; call that constant d. For the plane through (1, 2, 3) with normal (2, 1, −1), d is 1, since 2 + 2 − 3 = 1, so the plane is 2x + y − z = 1. The dot product is zero because the normal is perpendicular to every line in the plane. Given three points instead, find the normal first, as the cross product of two directions between them. Check the given point in the final equation: 2 × 1 + 2 − 3 = 1.
tilt n and the plane tilts to stay perpendicular to it: every r − a lying in the plane has (r − a) · n = 0, so one normal fixes the plane's direction and d = 1 fixes which of the parallel planes it is
Make n vertical and set d = 1
Writing r as (x, y, z) opens the dot product out into ax + by + cz = d, and the coefficients are the components of the normal. The plane 2x + 3y + z = 7 has normal (2, 3, 1).
The angle between two planes is the angle between their normals.
The angle between a line and a plane is 90° minus the angle between the line and the normal. Complementary angles swap cosine for sine, so . The common mistake is to stop at , which is the angle to the normal.
See The vector equation of a plane, The Cartesian equation of a plane, The angle between two planes and The angle between a line and a plane.
How do you find where things meet, and how far apart they are?
To find where a line meets a plane, write the line's x, y and z in terms of t, substitute them into the plane's equation, solve for t, and put that t back into the line. For r = (1, 0, 2) + t(1, 1, 1) and the plane x + y + z = 9, substituting gives (1 + t) + t + (2 + t) = 9, so 3t = 6, t = 2, and the point is (3, 2, 4). Substituting works because the meeting point is the one point of the line that satisfies the plane. If the t terms cancel, the line is parallel: it misses the plane when the leftover equation is false, and lies in it when that is true. A distance runs along the normal: substitute the point into the left side, subtract the constant, take the size, and divide by the normal's length |n|. Check the meeting point: 3 + 2 + 4 = 9.
m₁ ≠ m₂: the two lines share exactly one point, and its coordinates are the one pair (x, y) that satisfies both equations
Make the gradients equal with different intercepts
Two planes that are not parallel meet along a line. The line lies in both planes, so its direction is the cross product of the two normals. For a point on it, set z = 0 and solve the two plane equations for x and y.
For the point (1, 1, 1) and the plane 2x + y + 2z = 14, the normal has length 3, and |2 + 1 + 2 − 14| ÷ 3 = 3.
See The intersection of a line and a plane, The intersection of two planes and The distance from a point to a plane.
Now you
P is (6, 6, 4) and sits 3 from a plane with normal (2, 1, 2), which has length 3. Where is the foot of the perpendicular?
Which direction gives the shortest route from a point to a plane?
How do vectors describe motion?
An object that starts at position and moves with constant velocity v has position after time t. The speed is the magnitude of v. A boat that starts at (2, 1) km with velocity (3, 4) km/h is at (8, 9) after 2 hours, since 2 + 3 × 2 = 8 and 1 + 4 × 2 = 9, and its speed is 5 km/h, the length of (3, 4). This is the vector equation of a line with time as the parameter, because each hour adds one copy of v. Meeting problems change the steps: two objects collide only if their positions are equal at the same time, so solve one component for t and test that t in the other. Check the distance covered: 2 hours at 5 km/h is 2 × 5 = 10 km, and |(6, 8)| is 10, because 36 + 64 = 100.
v = (4, 3): each second adds one copy of v to the position, so the dots are equal steps along a line, and the speed is |v| = 5, the length of the arrow
Turn v to (−3, 4) and read the speed
In three dimensions the same t must satisfy all three components.
For the closest approach, subtract one position vector from the other to get the gap as a vector in t. The square of its length is a quadratic in t. Differentiate, set the derivative to 0 to find t, then take the square root for the distance.
When the velocity varies, differentiate the position vector coordinate by coordinate for the velocity, and again for the acceleration. An object that sets off k seconds later has position r(t − k).
See Position and velocity as vectors, Meeting points and travel times, The closest approach of two objects, Velocity that varies with time and Motion that starts later.
The mistakes worth naming
- Adding magnitudes instead of vectors. A move of 3 then a move of 4 at right angles is a move of 5, not 7.
- Getting b − a backwards. The vector from A to B is b − a, destination minus start.
- Using cosine for a line and a plane. The dot product with the normal gives the angle to the normal. The angle to the plane is 90° minus that.
- Assuming crossing paths mean a collision. Two objects can share a route without being at the same point at the same time.
- Skipping the division by the normal's length. Substituting a point into the plane equation gives a distance in lengths of n. Divide by |n|.
Lines, angles and Pythagoras covers the right triangle behind the magnitude formula, matrices and determinants write the same geometry another way, and triangle trigonometry and bearings solves the same problems without vectors. Related guides: Partial Differentiation.
Your turn
Three to try — tap what you get.
(2, 3) + (4, −1)
3 × (1, −2)
The magnitude of (3, 4)
Questions and answers
- What is the difference between a vector and a scalar?
- A scalar is a size on its own, like 5 meters or 3 kilograms. A vector is a size together with a direction, like 5 meters north-east. The practical consequence is that vectors do not add like numbers: walking 3 km east then 4 km north leaves you 5 km from where you started, not 7 km, because the directions disagree.
- How do you add two vectors?
- Add the components separately. In column form, add the top numbers to get the top of the answer and the bottom numbers to get the bottom. Geometrically this is the triangle rule: draw the first vector, start the second one where the first finished, and the sum is the single arrow from the very start to the very end.
- What does the dot product tell you?
- It measures how much two vectors point the same way. The dot product equals the product of the two magnitudes times the cosine of the angle between them, so it is largest when they are parallel, zero when they are perpendicular, and negative when they point roughly opposite ways. A dot product of zero is the standard test for a right angle in space.
- What is the difference between the dot product and the cross product?
- The dot product of two vectors is a number and the cross product is a vector. The dot product measures alignment and is used for angles and projections. The cross product produces a vector perpendicular to both inputs, whose length equals the area of the parallelogram they span, which makes it the tool for normals to planes and for areas in three dimensions.
- How do you find the equation of a plane?
- Find a vector perpendicular to the plane, called the normal, and one point that lies on it. If the normal is n and the known point has position vector a, then every point r on the plane satisfies r dotted with n equals a dotted with n. Written out in coordinates this becomes the familiar form ax + by + cz = d, where a, b and c are the components of the normal.
- How do you find the shortest distance from a point to a plane?
- Measure along the normal, because the shortest route from a point to a plane is always perpendicular to it. Substitute the point into the left-hand side of the plane equation, subtract the right-hand side, take the size of the result, and divide by the length of the normal vector. The division is what converts the answer from normal-lengths into ordinary distance.