# Angles and scalar product

The angle between two vectors is the angle between their two directions. It is the smallest rotation angle that maps one direction to the other.

The angle lies in the interval $$[0,\pi)$$ (i.e. $$0$$ is included and $$\pi$$ is excluded).

Two non-zero vectors are orthogonal if the angle between them is $$\pi/2$$. They are also called perpendicular, or normal.

Two vectors are **collinear** if their angle is $$0$$.

The scalar product between two vectors is the number defined by $$$ \uvec\cdot\vvec = \cos\theta\vert\;\uvec\vert \vert\vvec\vert $$$ where $$\theta$$ is the angle between $$\uvec$$ and $$\vvec$$.

In Cartesian components \begin{gather*} (x_1,y_1)\cdot(x_2,y_2) = x_1x_2+y_1y_2,\\ (x_1,y_1,z_1)\cdot(x_2,y_2,z_2) = x_1x_2+y_1y_2+z_1z_2 \end{gather*}

The **length** of a vector is given by the scalar product by the relation $$\vert\uvec\vert^2 = \uvec\cdot\uvec$$.

The scalar product is also called the dot product.

Two vectors are **orthogonal** if their scalar product is 0.

The main algebraic properties of ** scalar products** are:

- Symmetry: $$ \uvec\cdot\vvec = \vvec\cdot\uvec $$
- Bilinearity: \begin{gather*} (\lambda_1\uvec_1+\lambda_2\uvec_2)\cdot\vvec = \lambda_1\uvec_1\cdot\vvec +\lambda_2\uvec_2\cdot\vvec\\ \uvec\cdot(\lambda_1\vvec_1+\lambda_2\vvec_2)c = \lambda_1\uvec\cdot\vvec_1+\lambda_2\uvec\cdot\vvec_2. \end{gather*}
- Positive definiteness: $$ \uvec\cdot\uvec\gt0$$ unless $$\uvec = 0$$.

In the 2D-plane, resp. in the 3D-space, the angle $$\theta$$ between two vectors $$(x_1,y_1)$$ and $$(x_2,y_2)$$, resp. $$(x_1,y_1,z_1)$$ and $$(x_2,y_2,z_2)$$ is characterised by \begin{align*} \cos\theta & = \frac{\uvec\cdot\vvec}{\vert\uvec\vert\;\vert\vvec\vert } = \frac{x_1x_2+y_1y_2}{\sqrt{x_1^2+y_1^2}\sqrt{x_2^2+y_2^2}},\\ \cos\theta & = \frac{\uvec\cdot\vvec}{\vert\uvec\vert\;\vert\vvec\vert } = \frac{x_1x_2+y_1y_2+z_1z_2}{\sqrt{x_1^2+y_1^2+z_1^2}\sqrt{x_2^2+y_2^2+z_2^2}}. \end{align*}

Thus, the angle of a vector $$\vvec = (x,y,z)$$ in space with the axes is $$$ \cos \theta_x = \frac{x}{\vert \vvec\vert} \quad \cos\theta_y = \frac{y}{\vert\vvec\vert}, \quad\cos\theta_z = \frac{z}{\vert \vvec \vert}. $$$

We have the relationship $$$ \cos^2\theta_x + \cos^2\theta_y + \cos^2\theta_y = 1$$$