A point tells you where you are. A vector tells you how to get somewhere else. In three dimensions, it gives you three changes: one along each axis.
v=⟨x,y,z⟩
The numbers x, y, and z are the components. Each says how far to move along one axis, and its sign says which way. Together, they describe the change from start to finish. They don't tell you which route you took.
To find the length of the vector, use the Pythagorean theorem: square the components, add them, and take the square root. We call this length the norm:
∥v∥=x2+y2+z2
What if you only care about the direction? For v=0, divide by its length. The new vector points the same way, but its length is 1.
u=∥v∥v
This u is a unit vector. Think of it as keeping the direction separate from the length. We can multiply it by a number later to get the length we need; a negative number points it the other way.
The dot product: connecting algebra to geometry
Suppose you know two vectors' components and want to find the angle between them. You don't have to draw them. Start with their dot product: multiply matching components and add. For v=⟨x1,y1,z1⟩ and w=⟨x2,y2,z2⟩, that's
v⋅w=x1x2+y1y2+z1z2
Notice that the answer is a number, not a vector. We call a single number like this a scalar.
Why does that calculation help with angles? The dot product is also equal to this:
v⋅w=∥v∥∥w∥cosθ
Here θ is the angle between the nonzero vectors v and w. We already know their lengths from their components. Divide by those lengths, and we get
cosθ=∥v∥∥w∥v⋅w
Notice what happens when two nonzero vectors are perpendicular (θ=π/2). Because cos(π/2)=0, their dot product must be zero:
v⋅w=0⟺v and w are orthogonal
So if you just need to check for a right angle, stop at the dot product. You don't need to find the angle itself. Orthogonal is the mathematical word for perpendicular here.
Measuring along a direction: scalar and vector projection
Now ask a slightly different question: how much of v lies along the direction of w? We need w=0, since the zero vector doesn't give us a direction.
Draw both vectors from the same starting point. From the tip of v, draw a perpendicular to the line through w. The vector from the starting point to where that perpendicular lands is the projection. We can describe it as a signed length or as a vector:
Scalar projection (compwv): This is a number: the signed distance along that line.
compwv=∥w∥v⋅w
If v=0 as well and θ is the angle between the vectors, this also equals ∥v∥cosθ.
A positive result means the projection points along w; a negative result means it points the other way. Zero means there is no component along that line.
Vector projection (projwv): This is a vector, so it needs both length and direction. Multiply the signed length by the unit vector along w:
projwv=(∥w∥v⋅w)(∥w∥w)=∥w∥2v⋅ww
The two formulas answer different questions: do you need a number or a vector? For the vector answer, check that projwv is a scalar multiple of w. It can't point off the line you're projecting onto.
The cross product: a perpendicular vector
The dot product turns two vectors into a number. In R3, the cross product turns them into a new vector:
v×w
This vector is perpendicular to both v and w. When the cross product is nonzero, there are two possible perpendicular directions, and the right-hand rule chooses one. Point the fingers of your right hand along v and curl them toward w; your thumb points along v×w. The order matters:
w×v=−(v×w)
Its length has a separate job. If θ is the angle between two nonzero vectors, then
∥v×w∥=∥v∥∥w∥sinθ
That is base times perpendicular height, so it gives the area of the parallelogram spanned by the two vectors. If the vectors point along the same line, the height is zero and so is the cross product. The zero vector is another zero-cross-product case, even though it has no direction and no angle.
Magnitude gives area; order gives direction
The magnitude ∥v×w∥ is the parallelogram's area. The right-hand rule chooses the perpendicular direction, so reversing the order reverses the result.
Turning vectors into lines and planes
A line in space needs a starting point and a direction. If p is the position vector of a point on the line and v is a nonzero direction vector, then
ℓ(t)=p+tv,t∈R
At t=0 you are at p. Positive and negative values of t move in opposite directions along the same line.
A plane needs a different kind of direction information: a vector perpendicular to the whole plane. This is its normal vector. If the plane passes through the point with position vector p and has nonzero normal vector n, then a point with position vector r lies in the plane exactly when the displacement r−p is perpendicular to n:
n⋅(r−p)=0
This is why dot and cross products work together when three noncollinear points define a plane. Two displacement vectors between the points lie in the plane. Their cross product is perpendicular to both, so it gives a normal vector for the plane equation.
Vectors in three dimensions
Write a vector by listing the changes along the three axes:
v=⟨x,y,z⟩,
where x, y, and z are the vector's components. The symbol v is read “vector v.”
If you start at the origin O=(0,0,0) and end at P=(x,y,z), the vector has the same numbers as the point. This is the position vector of P:
OP=⟨x,y,z⟩.
If you start somewhere else, say at the first of these two points,
P=(x,y,z),Q=(a,b,c),
subtract the coordinates of P from those of Q to find the change:
PQ=⟨a−x,b−y,c−z⟩.
Subtract in that order: endpoint minus starting point. Reversing the order describes the return trip, so it reverses the vector.
Vector arithmetic
Adding two vectors combines their displacements. Add the changes along each axis separately:
⟨x,y,z⟩+⟨a,b,c⟩=⟨x+a,y+b,z+c⟩.
To scale a vector, multiply every component by the same real number α:
α⟨x,y,z⟩=⟨αx,αy,αz⟩.
When α>1, the vector gets longer. When 0<α<1, it gets shorter. Neither changes its direction. A negative multiplier reverses the direction as well; its absolute value tells you how much to scale the length.
Length, distance, and unit vectors
The norm is just the length. For the vector
v=⟨x,y,z⟩
apply the Pythagorean theorem:
∥v∥=x2+y2+z2.
If the vector starts at the origin, this is the distance to its endpoint. When you multiply the vector by a number, its length changes like this:
∥αv∥=∣α∣∥v∥.
The absolute value matters: a negative multiplier reverses the vector, but doesn't give it a negative length.
To find the distance between two points, first find the vector between them, then take its length:
d(P,Q)=∥PQ∥=(a−x)2+(b−y)2+(c−z)2.
A unit vector has length 1. If v=0, dividing by its norm keeps its direction and changes its length to 1:
u=∥v∥v.
That's what normalizing a vector means: keeping its direction and making its length one.
The standard basis
We only need three directions to describe any vector in space: one along each axis. Give each of those vectors length one. These are the standard basis vectors in R3, read “R three”:
i=⟨1,0,0⟩,j=⟨0,1,0⟩,k=⟨0,0,1⟩.
They point along the positive axes. To build any other vector, multiply each one by the component along that axis, then add:
⟨x,y,z⟩=xi+yj+zk.
The same coordinate ideas work in R2 and, more generally, in Rn.
The dot product
For
v=⟨x1,y1,z1⟩,w=⟨x2,y2,z2⟩,
the dot product is
v⋅w=x1x2+y1y2+z1z2.
The answer is a real number, not another vector. You can work with dot products using these rules. First, the dot product of a vector with itself is its squared length:
v⋅v=∥v∥2,
Distribute over a sum:
u⋅(v+w)=u⋅v+u⋅w,
Switching the order doesn't change the result:
v⋅w=w⋅v,
You can pull a scalar multiplier outside the dot product:
(αv)⋅w=α(v⋅w)=v⋅(αw).
Angles between vectors
Let θ be the angle between two nonzero vectors v and w. The dot product connects their lengths to this angle:
v⋅w=∥v∥∥w∥cosθ.
Therefore,
cosθ=∥v∥∥w∥v⋅w.
Calculate the dot product, then divide by the product of the two lengths. That gives the cosine of the angle, not the angle itself. Use inverse cosine to finish.
Why the angle formula works
To see why the dot product contains angle information, place v and w at the same starting point. The vector between their tips is w−v. We can calculate its squared length in two ways. First, the law of cosines gives
∥w−v∥2=∥v∥2+∥w∥2−2∥v∥∥w∥cosθ.
The dot product gives another expression for the same squared length:
∥w−v∥2=(w−v)⋅(w−v)=∥w∥2−2v⋅w+∥v∥2.
These are two ways of calculating the same squared length, so set them equal. Cancel the squared lengths that appear on both sides and divide by the common coefficient. What remains is
v⋅w=∥v∥∥w∥cosθ.
Orthogonal vectors
For nonzero vectors, orthogonal means perpendicular. At a right angle, θ=π/2, so
cos(2π)=0.
Thus,
v⋅w=0⟺v and w are orthogonal.
For example,
⟨2,2,−1⟩⋅⟨5,−4,2⟩=2(5)+2(−4)+(−1)(2)=10−8−2=0.
The answer is zero, so these two nonzero vectors are perpendicular.
There's one convention to keep in mind. The zero vector has dot product zero with every vector, so we call it orthogonal to every vector too. But it has no direction, so we can't assign it an angle.
Scalar and vector projection
A projection answers this question: how much of v points in the direction of w? Assume w=0.
The scalar projection, or component of v along w, is
compwv=∥w∥v⋅w=∥v∥cosθ.
The cosine version needs two nonzero vectors, because otherwise there's no angle to use. If the vector you're projecting is zero, use the dot-product version instead. It gives zero.
The sign tells you which way the projection points: positive along w, negative the other way. This answer is still just a number.
To turn that signed length into a vector, multiply by the unit vector in the w direction:
projwv=compwv(∥w∥w)=(∥w∥v⋅w)(∥w∥w).
Therefore,
projwv=∥w∥2v⋅ww.
If w is already a unit vector, then ∥w∥=1 and the formula simplifies to
projwv=(v⋅w)w.
A projection keeps only the part in one direction
The projection is parallel to w. The dashed remainder is perpendicular to w, so the original vector splits into a parallel part and a perpendicular part.
Example: projecting one vector onto another
Let
v=⟨1,1,2⟩,w=⟨−2,3,1⟩.
We're projecting the first vector onto the second, so the answer must be a multiple of the second. To find that multiple, we need the dot product and the squared length of the second vector. Start with the dot product:
v⋅w=−2+3+2=3.
Now find the squared length of w. Use the vector you're projecting onto, not the one you started with:
∥w∥2=(−2)2+32+12=14.
Put those two numbers into the projection formula:
projwv=143w=143⟨−2,3,1⟩=⟨−73,149,143⟩.
The answer is a scalar multiple of w, as it should be. This check won't catch every arithmetic error, but it will catch an answer that points off the line you're projecting onto.
The cross product
The cross product is the standard two-vector product used here in R3. Unlike the dot product, its output is a vector. For
v=⟨a1,a2,a3⟩,w=⟨b1,b2,b3⟩,
compute it component by component:
v×w=⟨a2b3−a3b2,a3b1−a1b3,a1b2−a2b1⟩.
A useful memory aid is to expand this formal determinant across its first row:
v×w=ia1b1ja2b2ka3b3.
The cofactor signs are +, −, +. That middle minus is already built into the component formula above.
Example: computing a cross product
Let
v=⟨1,2,3⟩,w=⟨2,−1,1⟩.
Apply the component formula in the same order each time:
The last line is anticommutativity: switching the order reverses the vector instead of leaving it unchanged. In particular, v×v=0.
The cross product is orthogonal to both inputs:
v⋅(v×w)=0,w⋅(v×w)=0.
If θ∈[0,π] is the angle between two nonzero vectors, its magnitude is
∥v×w∥=∥v∥∥w∥sinθ.
This is the area of the parallelogram with sides v and w: ∥v∥ is the base and ∥w∥sinθ is the perpendicular height.
For two nonzero vectors,
v×w=0⟺v∥w.
Here parallel includes vectors that point in opposite directions. If either input is the zero vector, the cross product is also 0, but there is no angle or direction to compare.
Lines in space
A line needs a point and a nonzero direction vector. Let
P=(x0,y0,z0),p=⟨x0,y0,z0⟩,
and let v=⟨a,b,c⟩=0. The line through P in the direction of v is
ℓ(t)=p+tv,t∈R.
Writing the same equation one component at a time gives the parametric equations
x(t)y(t)z(t)=x0+at,=y0+bt,=z0+ct,t∈R.
The same value of t belongs in all three coordinates. At t=0 the line passes through P; changing t adds a scalar multiple of one fixed direction vector.
Parallel or coincident lines
Suppose
ℓ1(s)=p1+sv1,ℓ2(t)=p2+tv2,
where both direction vectors are nonzero. If v2=cv1 for some c=0, the lines have parallel directions. That still leaves two possibilities:
If p2−p1 is also a scalar multiple of v1, then the second base point lies on the first line, so the lines are coincident: they are two descriptions of the same line.
Otherwise, they are distinct parallel lines.
If the direction vectors are not scalar multiples, the lines are not parallel. In three dimensions they may intersect, or they may be skew, meaning they neither intersect nor run parallel.
Planes in space
A plane through P=(x0,y0,z0) is determined by a nonzero normal vector n=⟨a,b,c⟩. For a variable point R=(x,y,z), write
p=⟨x0,y0,z0⟩,r=⟨x,y,z⟩.
The displacement r−p lies in the plane, so it must be perpendicular to the normal. This gives the point-normal equation
n⋅(r−p)=0.
In coordinates,
a(x−x0)+b(y−y0)+c(z−z0)=0.
Expanding gives another common form:
ax+by+cz=d,d=ax0+by0+cz0.
The coefficients tell you a normal vector immediately: the plane ax+by+cz=d has normal vector ⟨a,b,c⟩. Requiring this vector to be nonzero prevents the equation from collapsing to either every point or no points.
Example: the plane through three points
Three noncollinear points determine one plane. Let
P=(1,3,2),Q=(3,−1,6),R=(5,2,0).
First form two vectors that lie in the plane. Subtract the common starting point P:
PQ=⟨2,−4,4⟩,PR=⟨4,−1,−2⟩.
Because the points are noncollinear, these vectors are not parallel, so their cross product is a nonzero normal vector: