# Dot product

The dot product (or scalar product) of the two real vectors $\mathbf{a} = \begin{pmatrix}a_1 \\ a_2 \\ a_3\end{pmatrix} \quad\text{and}\quad \mathbf{b} = \begin{pmatrix}b_1 \\ b_2 \\ b_3 \end{pmatrix}$ is $\mathbf{a} \cdot \mathbf{b} = a_1b_1 + a_2b_2 + a_3b_3.$ This is a real number (hence the name ‘scalar’ product). The definition extends to vectors $\mathbf{a}$ and $\mathbf{b}$ with $n$ components. (Compare this to the cross product, which outputs a vector and which does not have such a simple generalisation.)

The dot product combines information about the lengths of $\mathbf{a}$ and $\mathbf{b}$ and the angle between them. Specifically, $\mathbf{a} \cdot \mathbf{b} = |\mathbf{a}|\, |\mathbf{b}| \cos \theta$ where $|\mathbf{a}|$ and $|\mathbf{b}|$ are the lengths (magnitudes) of $\mathbf{a}$ and $\mathbf{b}$ and $\theta$ is the angle between the two vectors. It follows that for non-zero vectors $\mathbf{a}$ and $\mathbf{b}$, the dot product is zero exactly when $\mathbf{a}$ and $\mathbf{b}$ are at right angles to one another.

For every choice of $\mathbf{a}$, $\mathbf{b}$ and $\mathbf{c}$ and every scalar $\lambda$, we have \begin{align*} \mathbf{a} \cdot \mathbf{b} &= \mathbf{b} \cdot \mathbf{a} && \text{(commutativity)}\\ \mathbf{a} \cdot (\mathbf{b} + \mathbf{c}) &= \mathbf{a} \cdot \mathbf{b} + \mathbf{a} \cdot \mathbf{c} && \text{(distributivity over addition)}\\ (\lambda \mathbf{a}) \cdot \mathbf{b} &= \lambda (\mathbf{a} \cdot \mathbf{b}) = \mathbf{a} \cdot (\lambda \mathbf{b}). \end{align*}