Back to Dot Product Explorer

Theoretical Background: Dot Product Explorer

Open the app

Definition

For \(\mathbf A = A_x\mathbf i + A_y\mathbf j + A_z\mathbf k\) and \(\mathbf B = B_x\mathbf i + B_y\mathbf j + B_z\mathbf k\), the dot (scalar) product is a number:

$$ \mathbf A \cdot \mathbf B = A_x B_x + A_y B_y + A_z B_z $$

Geometrically it equals the product of the lengths and the cosine of the angle between the vectors:

$$ \mathbf A \cdot \mathbf B = |\mathbf A|\,|\mathbf B| \cos\theta, \qquad |\mathbf A| = \sqrt{A_x^2 + A_y^2 + A_z^2} $$

Angle between two vectors

$$ \theta = \arccos\!\left(\frac{\mathbf A \cdot \mathbf B}{|\mathbf A|\,|\mathbf B|}\right), \qquad 0^\circ \le \theta \le 180^\circ $$
  • \(\mathbf A\cdot\mathbf B > 0\): acute angle (\(\theta < 90^\circ\)).
  • \(\mathbf A\cdot\mathbf B = 0\): perpendicular (\(\theta = 90^\circ\)).
  • \(\mathbf A\cdot\mathbf B < 0\): obtuse angle (\(\theta > 90^\circ\)).

Projection

The scalar projection of \(\mathbf B\) on the direction of \(\mathbf A\) (the length of the dashed shadow in the drawing) and the vector projection are

$$ B_A = \frac{\mathbf A\cdot\mathbf B}{|\mathbf A|}, \qquad \mathbf B_{\parallel} = \frac{\mathbf A\cdot\mathbf B}{|\mathbf A|^2}\,\mathbf A $$

Worked example

Example

\(\mathbf A = (3, 1, 0)\), \(\mathbf B = (1, 2, 0)\).

\(\mathbf A\cdot\mathbf B = 3\cdot1 + 1\cdot2 + 0\cdot0 = 5\), \(|\mathbf A| = \sqrt{10} = 3.1623\), \(|\mathbf B| = \sqrt5 = 2.2361\).

\(\cos\theta = 5/(3.1623\cdot2.2361) = 0.7071 \Rightarrow \theta = 45^\circ\) (acute). Scalar projection of B on A: \(5/3.1623 = 1.5811\).

Finding a missing component: if \(\mathbf A = (2, A_y, -1)\), \(\mathbf B = (4, 3, 2)\) and \(\mathbf A\cdot\mathbf B = 12\), then \(8 + 3A_y - 2 = 12\), so \(A_y = 2\).

Properties

  • Commutative: \(\mathbf A\cdot\mathbf B = \mathbf B\cdot\mathbf A\).
  • Distributive: \(\mathbf A\cdot(\mathbf B + \mathbf C) = \mathbf A\cdot\mathbf B + \mathbf A\cdot\mathbf C\).
  • \(\mathbf A\cdot\mathbf A = |\mathbf A|^2\).
  • Unit vectors: \(\mathbf i\cdot\mathbf i = \mathbf j\cdot\mathbf j = \mathbf k\cdot\mathbf k = 1\), \(\mathbf i\cdot\mathbf j = \mathbf j\cdot\mathbf k = \mathbf k\cdot\mathbf i = 0\).

Where it is used

  • Statics: the component of a force along a member or a line, \(F_{\parallel} = \mathbf F\cdot\mathbf u\).
  • Work: \(W = \mathbf F\cdot\mathbf d\).
  • Geometry and graphics: angles between lines, lighting (cosine of the angle to the light), testing perpendicularity.

FAQ

Is the dot product a vector?

No. It is a scalar (a single number). The cross product A × B is the product that gives a vector.

Can the dot product be negative?

Yes, whenever the angle between the vectors is greater than 90°.

What if one vector is zero?

The dot product is 0 and the angle is not defined; the app shows “–” for the angle.

Why does the drawing ignore z?

The drawing is a top view on the x–y plane. All numbers in the results use all three components.