# Scalar product and angles

Description of multiplication, scalar product and angles of Vectors

## Calculate the scalar product of two vectors

The multiplication of vectors has been briefly described in the section Vectors Calculation. It was shown that the result is not a vector but a real number (scalar product or dot product).

This section describes the calculation of the scalar product; and how the angle between the vectors can be calculated with the help of the scalar product.

For the two vectors $$\overrightarrow{x}=\left[\matrix{x_1\\⋮\\x_n}\right]$$ and $$\overrightarrow{y}=\left[\matrix{y_1\\⋮\\y_n}\right]$$
the scalar produkt is defined as $$\overrightarrow{x}·\overrightarrow{y}= x_1·y_1 + ⋯ + x_n·y_n$$

Example

$$\overrightarrow{x}=\left[\matrix{1\\2\\3}\right]$$     $$\overrightarrow{y}=\left[\matrix{4\\5\\6}\right]$$     $$\overrightarrow{x}·\overrightarrow{y}= 1·4+2·5+3·6=4+10+18=32$$

## Calculate angle between two vectors

From the scalar product described above and the Betrag of the vectors, the angle included by the vectors can be calculated.

The following formula is used for this   $$\displaystyle cos ∡ (\overrightarrow{x},\overrightarrow{y})= \frac{\overrightarrow{x}·\overrightarrow{y}}{\left|\overrightarrow{x}\right|·\left|\overrightarrow{y}\right|}$$

The following example calculates the angle of the vectors

$$\overrightarrow{x} =\left[\matrix{3\\0}\right]$$       $$\overrightarrow{y} =\left[\matrix{5\\5}\right]$$
$$\displaystyle cos ∡ (\overrightarrow{x},\overrightarrow{y})= \frac{\left[\matrix{3\\0}\right]·\left[\matrix{5\\5}\right]} {\left|\left[\matrix{3\\0}\right]\right|·\left|\left[\matrix{5\\5}\right]\right|}$$ $$\displaystyle =\frac{3·5+0·5}{\sqrt{3^2+0^2}·\sqrt{5^2+5^2}}$$

$$\displaystyle = \frac{15}{3·\sqrt{2·5^2}}=\frac{15}{3·5·\sqrt{2}} = \frac{15}{15·\sqrt{2}}=\frac{1}{\sqrt{2}}$$

The result is   $$∡ (\overrightarrow{x},\overrightarrow{y})= arccos\frac{1}{\sqrt{2}}=45°$$

The figure below shows the graphical representation of the vectors and the angle