Dot Product in 3D: Angle, Projection, and Work
The dot product (also called the scalar product) is one of the most important operations in vector geometry and physics.
For two 3D vectors \(A=\langle A_x,A_y,A_z\rangle\) and \(B=\langle B_x,B_y,B_z\rangle\), the dot product is defined by the coordinate formula:
\[
A\cdot B = A_xB_x + A_yB_y + A_zB_z.
\]
This number measures how strongly the vectors “point in the same direction.” If \(A\) and \(B\) point mostly the same way, \(A\cdot B\) is positive.
If they point mostly opposite ways, it is negative. If they are perpendicular, the dot product is zero (or extremely close to zero in numerical work).
The dot product is closely tied to vector length (magnitude). The magnitude of a vector is
\(\lVert A\rVert=\sqrt{A\cdot A}=\sqrt{A_x^2+A_y^2+A_z^2}\), and similarly for \(\lVert B\rVert\).
A second, geometric way to express the dot product uses the angle \(\theta\) between the two vectors:
\[
A\cdot B = \lVert A\rVert\,\lVert B\rVert \cos\theta.
\]
This relationship lets you solve for the angle:
\(\cos\theta = \dfrac{A\cdot B}{\lVert A\rVert\,\lVert B\rVert}\) and \(\theta=\arccos(\cos\theta)\).
The formula is valid when both vectors have nonzero length. If either vector is the zero vector, the angle is undefined because “direction” is undefined.
In practice, calculators clamp the computed cosine into \([-1,1]\) before applying \(\arccos\) to avoid tiny floating-point errors that would otherwise
produce invalid inputs to the inverse cosine.
Dot products also power projections. The scalar projection (component) of \(A\) onto \(B\) is
\[
\operatorname{comp}_B(A)=\frac{A\cdot B}{\lVert B\rVert},
\]
which gives the signed length of \(A\) in the direction of \(B\). The vector projection is the actual vector along \(B\):
\[
\operatorname{proj}_B(A)=\frac{A\cdot B}{B\cdot B}\,B.
\]
Once you have the projection, you can decompose \(A\) into a part parallel to \(B\) and a part perpendicular to \(B\):
\(A=\operatorname{proj}_B(A)+A_\perp\), where \(A_\perp=A-\operatorname{proj}_B(A)\). This decomposition is the basis for many geometry and
linear algebra ideas, including orthogonal components, least squares, and resolving vectors into along-axis components.
In physics, dot products appear naturally in the definition of work:
\(W=F\cdot d\), where \(F\) is force and \(d\) is displacement. This means only the component of the force aligned with the displacement
contributes to work; a perpendicular force does no work on an object moving sideways. In computer graphics and engineering, dot products are used
to compute lighting angles, determine whether surfaces face a camera, and measure similarity between directions. Because the dot product encodes
both magnitude and alignment, it is a compact tool for answering “how parallel?” and “how much in this direction?” questions in 3D space.