Precalculus · Grades 11, 12

The Dot Product and the Angle Between Vectors

Quick answer

The dot product of two vectors multiplies matching components and adds: u · v = u₁v₁ + u₂v₂. The result is a number, not a vector. The law of cosines shows that this number also equals |u||v|cos θ, where θ is the angle between the vectors, so the dot product measures that angle. It is zero exactly when the vectors are perpendicular. Dividing by |v| gives the length of the shadow u casts along v, which is how a projection and the work done by a force are computed.

What you'll learn

  • Compute the dot product of two vectors
  • Find the angle between two vectors
  • Test two vectors for perpendicularity
  • Find a projection and the work done by a force

Multiplying two vectors into a number

Adding vectors gives a vector. Multiplying a vector by a number gives a vector. The dot product does something else: it turns two vectors into a single number.

u⋅v=u1v1+u2v2\mathbf{u} \cdot \mathbf{v} = u_1v_1 + u_2v_2

For u=⟨3,4⟩\mathbf{u} = \langle 3, 4\rangle and v=⟨2,−1⟩\mathbf{v} = \langle 2, -1\rangle,

u⋅v=3(2)+4(−1)=2\mathbf{u} \cdot \mathbf{v} = 3(2) + 4(-1) = 2

That number carries geometric information: it measures how much the two vectors point the same way.

u⋅v=∣u∣ ∣v∣cos⁡θ\mathbf{u} \cdot \mathbf{v} = |\mathbf{u}|\,|\mathbf{v}|\cos\theta

where θ\theta is the angle between them, taken between 0°0° and 180°180°.

The angle between u and v Two arrows from the origin: u to (3, 4) and v to (2, −1). A dashed arrow runs from the tip of v to the tip of u, the third side of the triangle, which is the vector u − v. u v u − v -2246-224xy
The angle between u and v

Why the components know the angle

The three arrows above form a triangle with sides ∣u∣|\mathbf{u}|, ∣v∣|\mathbf{v}| and ∣u−v∣|\mathbf{u} - \mathbf{v}|, and the angle θ\theta sits between the first two. The law of cosines says

∣u−v∣2=∣u∣2+∣v∣2−2∣u∣∣v∣cos⁡θ|\mathbf{u} - \mathbf{v}|^2 = |\mathbf{u}|^2 + |\mathbf{v}|^2 - 2|\mathbf{u}||\mathbf{v}|\cos\theta

Now expand the left side in components:

(u1−v1)2+(u2−v2)2=(u12+u22)+(v12+v22)−2(u1v1+u2v2)(u_1 - v_1)^2 + (u_2 - v_2)^2 = \left(u_1^2 + u_2^2\right) + \left(v_1^2 + v_2^2\right) - 2\left(u_1v_1 + u_2v_2\right)

The first two brackets are ∣u∣2|\mathbf{u}|^2 and ∣v∣2|\mathbf{v}|^2, so comparing the two lines leaves u1v1+u2v2=∣u∣∣v∣cos⁡θu_1v_1 + u_2v_2 = |\mathbf{u}||\mathbf{v}|\cos\theta. The component formula and the angle formula are the law of cosines written twice, which is why a sum of products can report an angle.

Two consequences follow at once. Since ∣u∣|\mathbf{u}| and ∣v∣|\mathbf{v}| are positive, the sign of the dot product is the sign of cos⁡θ\cos\theta:

Dot productAngle
positiveacute, under 90°90°
zeroright angle
negativeobtuse, over 90°90°

And taking v=u\mathbf{v} = \mathbf{u} gives u⋅u=∣u∣2\mathbf{u} \cdot \mathbf{u} = |\mathbf{u}|^2.

Projections

The dot product also answers: how far does u\mathbf{u} reach in the direction of v\mathbf{v}? Dropping a perpendicular from the tip of u\mathbf{u} onto the line through v\mathbf{v} leaves a shadow of length ∣u∣cos⁡θ|\mathbf{u}|\cos\theta, which is the dot product divided by ∣v∣|\mathbf{v}|:

compvu=u⋅v∣v∣projvu=u⋅v∣v∣2 v\text{comp}_{\mathbf{v}}\mathbf{u} = \frac{\mathbf{u} \cdot \mathbf{v}}{|\mathbf{v}|} \qquad \text{proj}_{\mathbf{v}}\mathbf{u} = \frac{\mathbf{u} \cdot \mathbf{v}}{|\mathbf{v}|^2}\,\mathbf{v}

The first is a number, the length of the shadow. The second is the shadow itself, a vector along v\mathbf{v}.

The projection of u onto v Two arrows from the origin: u to (4, −1) and v to (3, 4). A short third arrow along v reaches (0.96, 1.28), the projection of u onto v. A dashed segment joins (4, −1) to that point and meets v at a right angle. u v -1123456-2-112345xy proj of u
The projection of u onto v

Worked examples

Common mistakes

Practice problems

  1. Find ⟨2,5⟩⋅⟨4,−1⟩\langle 2, 5\rangle \cdot \langle 4, -1\rangle.

    Answer

    33

    Full solution

    2(4)+5(−1)=8−5=32(4) + 5(-1) = 8 - 5 = 3.

  2. Find the angle between ⟨1,2⟩\langle 1, 2\rangle and ⟨3,1⟩\langle 3, 1\rangle.

    Answer

    45°45°

    Full solution

    The dot product is 3+2=53 + 2 = 5, and the lengths are 5\sqrt{5} and 10\sqrt{10}. So cos⁡θ=550=22\cos\theta = \tfrac{5}{\sqrt{50}} = \tfrac{\sqrt{2}}{2}.

  3. Are ⟨4,−2⟩\langle 4, -2\rangle and ⟨1,2⟩\langle 1, 2\rangle perpendicular?

    Answer

    Yes

    Full solution

    4(1)+(−2)(2)=4−4=04(1) + (-2)(2) = 4 - 4 = 0.

  4. Find kk so that ⟨k,3⟩\langle k, 3\rangle is perpendicular to ⟨6,−2⟩\langle 6, -2\rangle.

    Answer

    k=1k = 1

    Full solution

    6k−6=06k - 6 = 0.

  5. Use the dot product to find the length of ⟨6,8⟩\langle 6, 8\rangle.

    Answer

    1010

    Full solution

    u⋅u=36+64=100\mathbf{u} \cdot \mathbf{u} = 36 + 64 = 100, which is ∣u∣2|\mathbf{u}|^2, so ∣u∣=10|\mathbf{u}| = 10.

  6. Find the projection of ⟨3,4⟩\langle 3, 4\rangle onto ⟨1,1⟩\langle 1, 1\rangle.

    Answer

    ⟨3.5,3.5⟩\langle 3.5, 3.5\rangle

    Full solution

    The dot product is 77 and ∣v∣2=2|\mathbf{v}|^2 = 2, so the projection is 72⟨1,1⟩\tfrac{7}{2}\langle 1, 1\rangle.

  7. A force of ⟨12,5⟩\langle 12, 5\rangle newtons moves an object ⟨10,0⟩\langle 10, 0\rangle meters. Find the work.

    Answer

    120120 joules

    Full solution

    12(10)+5(0)=12012(10) + 5(0) = 120.

  8. Find the angle between ⟨−1,3⟩\langle -1, 3\rangle and ⟨2,1⟩\langle 2, 1\rangle, to the nearest tenth of a degree.

    Answer

    About 81.9°81.9°

    Full solution

    The dot product is −2+3=1-2 + 3 = 1, and the lengths are 10\sqrt{10} and 5\sqrt{5}. So cos⁡θ=150≈0.1414\cos\theta = \tfrac{1}{\sqrt{50}} \approx 0.1414 and θ≈81.9°\theta \approx 81.9°.

  9. Explain why u⋅v=v⋅u\mathbf{u} \cdot \mathbf{v} = \mathbf{v} \cdot \mathbf{u} for every pair of vectors.

    Answer

    u1v1+u2v2=v1u1+v2u2u_1v_1 + u_2v_2 = v_1u_1 + v_2u_2

    Full solution

    Each term is a product of two numbers, and multiplying numbers does not depend on the order. Geometrically, the angle between two vectors is the same either way round.

  10. A student reports that the angle between ⟨1,0⟩\langle 1, 0\rangle and ⟨−1,0⟩\langle -1, 0\rangle is 0°0°, since the dot product is −1-1 and cos⁡0°=1\cos 0° = 1. What went wrong?

    Hint

    Divide by the lengths, and watch the sign.

    Answer

    cos⁡θ=−11⋅1=−1\cos\theta = \tfrac{-1}{1 \cdot 1} = -1, so θ=180°\theta = 180°. The vectors point in opposite directions.

    Full solution

    The dot product is −1-1, and both lengths are 11, so cos⁡θ=−1\cos\theta = -1. The negative sign says the angle is obtuse, and the only angle with cosine −1-1 between 0°0° and 180°180° is 180°180°, which matches two arrows pointing opposite ways.

Frequently asked questions

What is the dot product of two vectors?

For u = ⟨u₁, u₂⟩ and v = ⟨v₁, v₂⟩, it is u₁v₁ + u₂v₂. The answer is a single number, called a scalar.

How do you find the angle between two vectors?

Use cos θ = (u · v)/(|u||v|), then take the inverse cosine. The angle comes out between 0° and 180°.

What does a dot product of zero mean?

The vectors are perpendicular, since cos 90° = 0. This is the quickest test for a right angle.

What does a negative dot product mean?

The angle between the vectors is obtuse, because cosine is negative between 90° and 180°.

How is work a dot product?

Work is the force times the distance moved in the force's direction, which is exactly F · d.

What to learn next

Standards alignment

This lesson covers the following Common Core State Standards for Mathematics.