Dot product of vectors

The dot product (a.k.a. scalar product) is an operation that take two vectors of the same dimension and produces a real number. Algebraically, it is simply the sum of the products of the corresponding entries in the two vectors:

\[ \begin{bmatrix} x_1 \\ y_1 \end{bmatrix} \cdot \begin{bmatrix} x_2 \\ y_2 \end{bmatrix} = x_1 x_2 + y_1 y_2 \]

In three-dimension, it is defined to be

\[ \begin{bmatrix} x_1 \\ y_1 \\ z_1 \end{bmatrix} \cdot \begin{bmatrix} x_2 \\ y_2 \\ z_2 \end{bmatrix} = x_1 x_2 + y_1 y_2 + z_1 z_2 \]