Dot Product

Compute a dot product by multiplying corresponding components and accumulating the products into one scalar.

Multiply, then accumulate

Pair entries in the same positions. The three products are 8, −2 and −3, and their running sum ends at 3.

dot([[2], [−1], [3]], [[4], [2], [−1]])

Dot two row vectors

The procedure is identical for row vectors. Multiply each aligned pair and add from left to right to obtain 32.

dot([[1, 2, 3]], [[4, 5, 6]])

Watch signs and zero terms

A negative product lowers the running total, while a zero component contributes nothing. The remaining products determine the scalar answer.

dot([[2, −3, 1]], [[−1, 4, 0]])

Practice

Practice: problems like this one, made and checked in your browser.

Recap

  • A dot product requires vectors with matching shapes.
  • Multiply corresponding components before adding.
  • The result is a scalar, not another vector.