Why Angles and Projections Are Easy to Miscalculate
Dot products connect several related ideas: the angle between two vectors, the signed component of one vector along a direction, and the vector projection onto that direction. Because the same dot product appears in each calculation, it is tempting to use a familiar formula without checking what its inputs mean.
Four errors are especially common: leaving out one or both vector magnitudes in an angle calculation, treating a nonunit vector as though it were a unit direction, discarding a negative sign that carries directional information, and changing component signs when writing a projected vector. The remedy is to identify the quantity being calculated, write the applicable formula, and check the result against its geometric meaning.
Definitions and Formulas to Keep Distinct
For vectors \(\mathbf{a}=(a_1,a_2,a_3)\) and \(\mathbf{b}=(b_1,b_2,b_3)\), their dot product is \( \mathbf{a}\cdot\mathbf{b}=a_1b_1+a_2b_2+a_3b_3\), and the magnitude of \(\mathbf{a}\) is \( \|\mathbf{a}\|=\sqrt{a_1^2+a_2^2+a_3^2}\). The angle formula requires both vectors to be nonzero.
Now let \(\mathbf{d}\ne\mathbf{0}\) be a direction vector. It need not have unit length. The scalar projection of \(\mathbf{v}\) onto the direction of \(\mathbf{d}\) is a signed number; the vector projection is a vector parallel to \(\mathbf{d}\).
If \(\mathbf{d}\) is a unit vector, then \(\|\mathbf{d}\|=1\), so these formulas simplify to \(\operatorname{comp}_{\mathbf{d}}\mathbf{v}=\mathbf{v}\cdot\mathbf{d}\) and \(\operatorname{proj}_{\mathbf{d}}\mathbf{v}=(\mathbf{v}\cdot\mathbf{d})\mathbf{d}\). Those shorter formulas require a unit direction; using them with a nonunit vector generally gives the wrong result.
Why the Projection Denominator Is Necessary
The projection vector must lie in the direction of \(\mathbf{d}\), so it has the form \(t\mathbf{d}\) for some number \(t\). Its defining property is that the leftover vector \(\mathbf{v}-t\mathbf{d}\) is perpendicular to \(\mathbf{d}\). Since perpendicular vectors have dot product zero, this property determines \(t\).
Set \(\mathbf{p}=t\mathbf{d}\), where \(\mathbf{d}\ne\mathbf{0}\).
Take its dot product with \(\mathbf{d}\): \((\mathbf{v}-t\mathbf{d})\cdot\mathbf{d}=0\).
Expand to obtain \(\mathbf{v}\cdot\mathbf{d}-t(\mathbf{d}\cdot\mathbf{d})=0\). Because \(\mathbf{d}\ne\mathbf{0}\), \(\mathbf{d}\cdot\mathbf{d}=\|\mathbf{d}\|^2>0\), so \(t=(\mathbf{v}\cdot\mathbf{d})/\|\mathbf{d}\|^2\).
Thus \(\mathbf{p}=((\mathbf{v}\cdot\mathbf{d})/\|\mathbf{d}\|^2)\mathbf{d}\), the vector projection formula.
This derivation explains why the denominator cannot be omitted for a general direction vector. It also gives a useful check: subtracting the projection from the original vector must leave a vector whose dot product with \(\mathbf{d}\) is zero.
Worked Example: Restoring the Magnitudes in an Angle Calculation
Worked Example: Restoring the Magnitudes in an Angle Calculation
Find the angle between \(\mathbf{a}=(1,0,0)\) and \(\mathbf{b}=(1,1,0)\). Then compare with the incorrect calculation that omits magnitudes.
First compute the dot product and magnitudes:
Substitute all three values into the angle formula:
Check: \(\cos 45^\circ=\sqrt{2}/2=1/\sqrt{2}\), which agrees with the formula's value. If the magnitudes are omitted, one might instead write \(\theta=\arccos(1)=0^\circ\). That is incorrect: the vectors point in different directions, and the missing factor \(\|\mathbf{b}\|=\sqrt{2}\) changes the cosine.
Worked Example: Projecting Onto a Nonunit Direction
Worked Example: Projecting Onto a Nonunit Direction
Find the scalar and vector projections of \(\mathbf{v}=(3,4,0)\) onto \(\mathbf{d}=(2,0,0)\). The direction vector has magnitude \(2\), so it is not a unit vector.
Calculate the dot product and the squared magnitude of the direction:
The scalar projection is \(6/2=3\). The vector projection uses the squared magnitude in its denominator:
Check the vector result by subtracting it from \(\mathbf{v}\): \(\mathbf{v}-(3,0,0)=(0,4,0)\). Its dot product with \(\mathbf{d}\) is \((0)(2)+(4)(0)+(0)(0)=0\), as required. The incorrect unit-vector shortcut \((\mathbf{v}\cdot\mathbf{d})\mathbf{d}\) would give \(6(2,0,0)=(12,0,0)\), which is too large and leaves a remainder \((-9,4,0)\) that is not perpendicular to \(\mathbf{d}\), since its dot product with \(\mathbf{d}\) is \(-18\).
Signed Projections and Unsigned Angles
The angle between two vectors, as defined above, is always between \(0^\circ\) and \(180^\circ\); it does not record a clockwise or counterclockwise choice. A scalar projection, by contrast, records whether the vector points generally along or opposite the chosen direction. If \(\mathbf{v}\cdot\mathbf{d}<0\), the scalar projection is negative. Replacing the dot product by its absolute value erases that information and changes the answer.
Worked Example: Keeping a Negative Projection Sign
Worked Example: Keeping a Negative Projection Sign
Let \(\mathbf{v}=(-1,\sqrt{3},0)\) and choose the unit direction \(\mathbf{u}=(1,0,0)\). Find the angle between the vectors and the scalar and vector projections of \(\mathbf{v}\) onto \(\mathbf{u}\).
The dot product is \((-1)(1)+(\sqrt{3})(0)+(0)(0)=-1\). Their magnitudes are \(\|\mathbf{v}\|=\sqrt{(-1)^2+(\sqrt{3})^2+0^2}=\sqrt{4}=2\) and \(\|\mathbf{u}\|=1\). Therefore:
Since \(\mathbf{u}\) is a unit vector, its scalar projection is \(\mathbf{v}\cdot\mathbf{u}=-1\), and its vector projection is \((-1)\mathbf{u}=(-1,0,0)\). The minus sign means the parallel component points opposite to \(\mathbf{u}\), not that the projection has been calculated incorrectly.
Check by splitting the vector into parallel and perpendicular parts: \((-1,\sqrt{3},0)=(-1,0,0)+(0,\sqrt{3},0)\). The second part has dot product \((0,\sqrt{3},0)\cdot(1,0,0)=0\) with \(\mathbf{u}\), confirming the split. Replacing \(-1\) with its absolute value would give a false scalar projection of \(1\) and a false vector projection of \((1,0,0)\).
Signs in the Projected Vector Follow the Direction
A positive scalar coefficient does not mean every component of the projection vector is positive. The projection vector is a scalar multiple of the direction vector; its component signs must therefore follow the components of that direction, allowing for an overall negative multiplier when the scalar projection is negative.
Worked Example: Preserving the Direction's Component Signs
Project \(\mathbf{v}=(2,1,0)\) onto \(\mathbf{d}=(1,-1,0)\). Compute the dot product and squared magnitude:
Then the vector projection is:
The coefficient \(1/2\) is positive, but the second component remains negative because the second component of \(\mathbf{d}\) is negative. Check the remainder: \((2,1,0)-(\frac12,-\frac12,0)=(\frac32,\frac32,0)\). Its dot product with \(\mathbf{d}\) is \((\frac32)(1)+(\frac32)(-1)=0\). If the second sign were mistakenly changed to positive, the proposed vector \((\frac12,\frac12,0)\) would not even be parallel to \((1,-1,0)\); its dot product with the proposed remainder \((\frac32,\frac12,0)\) would be \(1\), not zero.
A Practical Error-Checking Routine
Before accepting an angle or projection calculation, identify the output and check the relevant conditions. The checks below catch different mistakes, so none should be replaced by a general impression that the answer “looks right.”
- For an angle: confirm both input vectors are nonzero, compute both magnitudes, and check that the cosine is between \(-1\) and \(1\). The resulting angle must be between \(0^\circ\) and \(180^\circ\).
- For a scalar projection: divide the dot product by the magnitude of the direction vector. Keep its sign.
- For a vector projection: divide by the squared magnitude of the direction vector, then multiply by the direction vector itself. Check that the result is parallel to that direction.
- For a perpendicular remainder: subtract the proposed projection from the original vector and check that its dot product with the direction is zero.
These checks are useful because they test the structure of the answer, not just the arithmetic. A projection with an omitted denominator may still be parallel to the direction but have the wrong length; a sign error may give a vector that is not parallel at all. Using the formula and an independent geometric check helps distinguish those failures.
Check Your Understanding
For each question, identify which quantity is being calculated before choosing a formula.
- What two magnitude factors belong in the denominator of the angle formula?
- Why does projecting onto a nonunit direction require division by its squared magnitude in the vector formula?
- If \(\mathbf{v}\cdot\mathbf{d}<0\), what does the sign of the scalar projection tell you?
- What dot-product check can confirm that a proposed vector projection is correct?
- For \(\mathbf{d}=(1,-2,0)\), what should the signs of the first two components of a positive multiple of \(\mathbf{d}\) be?