You can add vectors and multiply them by scalars, but there is also a useful way to multiply two vectors together. The dot product turns two vectors into a single number, and that number tells you how closely the vectors point in the same direction. It gives you the angle between vectors, a quick test for perpendicular lines, and the physics formula for work.
Definition
Definition
Dot product
The dot product of u=⟨u1,u2⟩ and v=⟨v1,v2⟩ is the scalar
u⋅v=u1v1+u2v2.
Multiply matching components, then add.
The result is a number, not a vector. That is why the dot product is sometimes called the scalar product.
Worked example: Computing a dot product
Find ⟨3,4⟩⋅⟨−2,5⟩.
(3)(−2)+(4)(5)=−6+20=14.
The dot product follows familiar-looking rules. For vectors u, v, w and a scalar k:
u⋅v=v⋅u
u⋅(v+w)=u⋅v+u⋅w
(ku)⋅v=k(u⋅v)
v⋅v=v12+v22=∥v∥2
The last rule links the dot product to length, and it is the key to everything that follows.
The angle between two vectors
Place u and v tail to tail. They form two sides of a triangle whose third side is u−v. The law of cosines from the first lesson in this unit says
∥u−v∥2=∥u∥2+∥v∥2−2∥u∥∥v∥cosθ.
Expanding the left side with the dot product rules gives ∥u∥2−2u⋅v+∥v∥2. Compare the two sides and cancel, and you are left with a beautiful formula.
Dot product and angle
If θ is the angle between nonzero vectors u and v (with 0∘≤θ≤180∘), then
u⋅v=∥u∥∥v∥cosθ,socosθ=∥u∥∥v∥u⋅v.
Placed tail to tail, two vectors make an angle θ between 0° and 180°.
Because the lengths are always positive, the sign of the dot product matches the sign of cosθ:
u⋅v
Angle θ
positive
acute (vectors point roughly the same way)
zero
90∘ (perpendicular)
negative
obtuse (vectors point roughly opposite ways)
Worked example: Finding the angle
Find the angle between u=⟨2,1⟩ and v=⟨−1,3⟩, to the nearest tenth of a degree.
The dot product is small and positive, so the angle is acute but close to 90∘, which matches.
Orthogonal vectors
Two vectors are orthogonal when the angle between them is 90∘. Since cos90∘=0, this happens exactly when the dot product is zero.
Orthogonality test
Nonzero vectors u and v are orthogonal if and only if u⋅v=0.
This test needs no angles and no square roots, which makes it a fast way to check for right angles in coordinate geometry.
Worked example: Making vectors orthogonal
Find k so that ⟨k,6⟩ is orthogonal to ⟨3,−2⟩.
Set the dot product to zero: 3k+6(−2)=0, so 3k=12 and k=4. Check: ⟨4,6⟩⋅⟨3,−2⟩=12−12=0.
Common mistake
The dot product of two vectors is a number, so you cannot "dot" three vectors in a row, and u⋅v=0 does not mean either vector is zero. Also, don't confuse the dot product with component-by-component multiplication: ⟨3,4⟩⋅⟨−2,5⟩ is 14, not ⟨−6,20⟩.
Projections
Often you want to know how much of one vector points along another, for example how much of gravity pulls a cart down a ramp. Shine a light perpendicular to v and look at the shadow that u casts on the line of v. That shadow is the projection of u onto v.
The projection of u onto v is the shadow of u on the line through v. The dashed segment meets that line at a right angle.
Projection formulas
The scalar projection (the signed length of the shadow) and the vector projection of u onto v are
compvu=∥v∥u⋅v,projvu=(∥v∥2u⋅v)v.
The scalar projection is ∥u∥cosθ, which is the adjacent side of a right triangle with hypotenuse ∥u∥. The vector projection is that length times the unit vector ∥v∥v.
Worked example: Projecting one vector onto another
Find the vector projection of u=⟨6,2⟩ onto v=⟨3,4⟩.
Check: the leftover piece u−projvu=⟨2.88,−2.16⟩ should be orthogonal to v, and indeed 3(2.88)+4(−2.16)=8.64−8.64=0.
Work
In physics, the work done by a constant force F that moves an object along a displacement d counts only the part of the force in the direction of motion:
W=F⋅d=∥F∥∥d∥cosθ.
Only the horizontal part of the pull, ‖F‖ cos 30°, moves the box along the floor.
Worked example: Pulling a box
You drag a box 20 m across a floor by pulling on a rope with a force of 50 N at 30∘ above the horizontal. How much work do you do?
W=(50)(20)cos30∘=1000⋅23≈866.0 joules.
If you pulled horizontally, the work would be the full 1000 joules. The angled pull wastes some effort lifting instead of moving.
Tip
If you already have components, use W=F1d1+F2d2. If you have magnitudes and an angle, use W=∥F∥∥d∥cosθ. Both compute the same dot product.
Practice
Practice 1
Find ⟨5,−2⟩⋅⟨3,7⟩.
Enter a number. Fractions like 3/4 and sqrt(2) are OK.
Practice 2
Which pair of vectors is orthogonal?
Practice 3
Find k so that ⟨2,k⟩ is orthogonal to ⟨6,−4⟩.
Enter a number. Fractions like 3/4 and sqrt(2) are OK.
Practice 4
Find the angle between ⟨4,−3⟩ and ⟨5,12⟩, to the nearest tenth of a degree.
Enter a number. Fractions like 3/4 and sqrt(2) are OK.
Practice 5
Find the scalar projection of ⟨7,1⟩ onto ⟨3,4⟩.
Enter a number. Fractions like 3/4 and sqrt(2) are OK.
Practice 6
Find the vector projection of ⟨4,6⟩ onto ⟨1,1⟩. Enter it as (a,b).
Enter a point like (2, -3)
Practice 7
A child pulls a wagon 100 ft along a flat path, holding the handle at 35∘ above the horizontal with a force of 40 lb. How much work is done, in foot-pounds, to the nearest tenth?
Enter a number. Fractions like 3/4 and sqrt(2) are OK.
Practice 8
A triangle has vertices A(0,0), B(4,1) and C(1,3). Use the dot product to find angle A, to the nearest tenth of a degree.
Enter a number. Fractions like 3/4 and sqrt(2) are OK.