Dot product in 2D and 3D
For vectors
a=(a1,a2,a3),b=(b1,b2,b3),
the dot product in 3D is
a⋅b=a1b1+a2b2+a3b3.
In 2D, if
a=(a1,a2),b=(b1,b2),
then
a⋅b=a1b1+a2b2.
Example in 3D:
(2,−1,3)⋅(4,5,−2)=2⋅4+(−1)⋅5+3⋅(−2)=−3.
Compute
(3,−4)⋅(2,5).Answer:
3⋅2+(−4)⋅5=6−20=−14.
Compute
(1,2,−1)⋅(4,−3,5).Answer:
1⋅4+2⋅(−3)+(−1)⋅5=4−6−5=−7.
If
(x,2,1)⋅(3,−1,4)=9,find x.
Answer:
3x+2(−1)+1⋅4=9⇒3x+2=9⇒x=37.
Arithmetic properties of dot product
For vectors a,b,c and scalar k, the dot product satisfies:
- Commutative law
a⋅b=b⋅a
- Distributive over addition
a⋅(b+c)=a⋅b+a⋅c
- Distributive in the first slot
(a+b)⋅c=a⋅c+b⋅c
- Scalar multiplication compatibility
(ka)⋅b=k(a⋅b)=a⋅(kb)
- Zero vector property
a⋅0=0,0⋅a=0
- Self-dot gives squared magnitude
a⋅a=∥a∥2≥0
These can be summarized as: dot product is symmetric and bilinear.
Given
a⋅b=7,a⋅c=−2,find
a⋅(b+c).Answer:
a⋅(b+c)=7+(−2)=5.
If u⋅v=−3, compute
(4u)⋅(−2v).Answer:
(4u)⋅(−2v)=−8(u⋅v)=−8(−3)=24.
If
w⋅w=49,what is ∥w∥?
Answer:
∥w∥=7.
The angle theorem for dot product
Theorem. For nonzero vectors a,b with angle θ between them,
a⋅b=∥a∥∥b∥cosθ.
Proof (using the law of cosines)
Consider the triangle formed by a, b, and a−b. By law of cosines,
∥a−b∥2=∥a∥2+∥b∥2−2∥a∥∥b∥cosθ.
On the other hand,
∥a−b∥2=(a−b)⋅(a−b)=a⋅a−2a⋅b+b⋅b=∥a∥2+∥b∥2−2a⋅b.
Compare the two expressions for ∥a−b∥2:
∥a∥2+∥b∥2−2a⋅b=∥a∥2+∥b∥2−2∥a∥∥b∥cosθ.
Therefore,
a⋅b=∥a∥∥b∥cosθ.
In this graph, O=(0,0), A=a, and B=b. The side AB is exactly a−b, so the triangle makes the law-of-cosines identity visible.
Triangle proof view: why |a-b|^2 = |a|^2 + |b|^2 - 2|a||b|cos(theta)
a⃗ = (4.00, 1.00)b⃗ = (2.00, 3.00)a⃗ · b⃗ = 11.000θ = 42.3°
Drag the coloured dots at the arrow tips to move each vector.
If
a=(1,2),b=(2,1),find the angle between them.
Answer:
a⋅b=4,∥a∥=∥b∥=5.So
cosθ=54,heta=cos−1(54)≈36.87∘.
Determine whether
u=(3,−1,2),v=(1,5,1)are perpendicular.
Answer:
u⋅v=3⋅1+(−1)⋅5+2⋅1=0.Hence cosθ=0, so θ=90∘ and they are perpendicular.
Find k so that
(k,1) is perpendicular to (2,−6).Answer:
Perpendicular means dot product =0:
2k+1⋅(−6)=0⇒2k−6=0⇒k=3.
Geometric meaning of dot product
The formula
a⋅b=∥a∥∥b∥cosθ
gives several geometric interpretations:
- Angle information:
cosθ=∥a∥∥b∥a⋅b
-
Sign tells relative direction:
- a⋅b>0 means acute angle (0∘<θ<90∘)
- a⋅b=0 means right angle (θ=90∘)
- a⋅b<0 means obtuse angle (90∘<θ<180∘)
-
Orthogonality test:
a⊥b⟺a⋅b=0
- Directional component / projection relation:
a⋅b=∥b∥(scalar projection of a on b).
Use this to explore acute/obtuse/perpendicular cases by changing a and b. The annotation shows cosθ and both sides of the identity.
Geometric meaning: angle sign and dot-product identity
a⃗ = (3.00, 2.00)b⃗ = (4.00, -1.00)a⃗ · b⃗ = 10.000θ = 47.7°
Drag the coloured dots at the arrow tips to move each vector.
Without finding the exact angle, classify the angle between
p=(2,1,−1),q=(1,3,0).Answer:
p⋅q=2⋅1+1⋅3+(−1)⋅0=5>0.So the angle is acute.
Are
p=(1,2,3),q=(2,−1,0)orthogonal?
Answer:
p⋅q=1⋅2+2⋅(−1)+3⋅0=0.Yes, they are orthogonal.
For
u=(1,0,1),v=(2,2,1),find cosθ.
Answer:
u⋅v=3,∥u∥=2,∥v∥=3.Thus
cosθ=323=21.
Scalar projection vs vector projection
Let a be projected onto a nonzero vector b.
Scalar projection (component)
The scalar projection of a onto b is
compba=∥b∥a⋅b.
This is a number. It can be positive, negative, or zero.
Vector projection
The vector projection of a onto b is
projba=(∥b∥2a⋅b)b.
This is a vector in the direction of b (or opposite if the coefficient is negative).
Relationship:
projba=(compba)∥b∥b.
In the graph below, the purple vector is projba and the red dashed segment is the rejection a−projba.
Projection view: scalar component vs projection vector
a⃗ = (5.00, 2.00)b⃗ = (3.00, 0.00)a⃗ · b⃗ = 15.000θ = 21.8°comp_b(a⃗) = 5.000proj_b(a⃗) = (5.00, 0.00)
Drag the coloured dots at the arrow tips to move each vector.
Let
a=(3,4),b=(1,0).Find compba.
Answer:
compba=∥b∥a⋅b=13=3.
Let
a=(3,4),b=(1,0).Find projba.
Answer:
projba=(∥b∥2a⋅b)b=(13)(1,0)=(3,0).
Let
a=(2,1),b=(−4,0).Find both compba and projba.
Answer:
a⋅b=−8,∥b∥=4,∥b∥2=16.So
compba=4−8=−2,and
projba=(16−8)(−4,0)=(−21)(−4,0)=(2,0).The scalar projection is a signed number (−2), while the vector projection is an actual vector ((2,0)).
Mixed practice on dot product
Given
u=(1,−2,2),v=(2,1,0),compute u⋅v and decide whether the angle is acute, right, or obtuse.
Compute the dot product first, then use its sign.
u⋅v=1⋅2+(−2)⋅1+2⋅0=0.So the vectors are orthogonal and the angle is right.
Find the angle between
a=(1,1,0),b=(1,0,1).Use cosθ=∥a∥∥b∥a⋅b.
a⋅b=1,∥a∥=2,∥b∥=2.Therefore
cosθ=21,θ=60∘.
For
a=(4,2,0),b=(2,0,0),find both compba and projba.
Compute a⋅b, then divide by ∥b∥ or ∥b∥2 as needed.
a⋅b=8,∥b∥=2,∥b∥2=4.So
compba=28=4,and
projba=(48)(2,0,0)=2(2,0,0)=(4,0,0).
Find all k such that
(k,2,−1)⊥(3,k,6).Perpendicular vectors have dot product zero.
(k,2,−1)⋅(3,k,6)=3k+2k−6=0so
5k=6⇒k=56.