31. Express the scalar product $\vec{r}_{1} \cdot \vec{r}_{2}$ in coordinates, if $\vec{r}_{1}=x_{1} \vec{i}+y_{1} \vec{j}+z_{1} \vec{k}$ and $\vec{r}_{2}=x_{2} \vec{i}+y_{2} \vec{j}+z_{2} \vec{k}$. Calculate $\cos \varphi$, where $\varphi$ is the angle between the vectors $\vec{r}_{1}$ and $\vec{r}_{2}$. Write the conditions for collinearity and perpendicularity of the vectors $\vec{r}_{1}$ and $\vec{r}_{2}$ in coordinates. What formula expresses the distance between points whose coordinates are ( $x_{1}, y_{1}, z_{1}$ ) and ( $x_{2}, y_{2}, z_{2}$ )?
31. Using the distributive property of scalar multiplication of vectors, as well as the fact that $\overrightarrow{i^{2}}=\overrightarrow{j^{2}}=\vec{k}^{2}=1, \vec{i} \vec{j}=\vec{j} \vec{k}=$ $=\vec{k} \vec{i}=0, \quad$ we obtain: $\quad \vec{r}_{1} \vec{r}_{2}=r_{1} r_{2} \cos \varphi=x_{1} x_{2}+y_{1} y_{2}+z_{1} z_{2} . \quad$ From this equality, it follows that: $\cos \varphi=\frac{x_{1} x_{2}+y_{1} y_{2}+z_{1} z_{2}}{r_{1} r_{2}}$, where $r_{1}=$ $=\sqrt{x_{1}^{2}+y_{1}^{2}+z_{1}^{2}} ; r_{2}=\sqrt{x_{2}^{2}+y_{2}^{2}+z_{2}^{2}}$.

If the vectors are perpendicular, then $\varphi=90^{\circ}$ and $\cos \varphi=0$, $x_{1} x_{2}+y_{1} y_{2}+z_{1} z_{2}=0$.

If the vectors are collinear, then $\vec{r}_{2}=\lambda \vec{r}_{1}, \quad x_{2} \vec{i}+y_{2} \vec{j}+z_{\mathrm{\varepsilon}} \vec{k}=$ $=\lambda x_{1} \vec{i}+\lambda y_{1} \vec{j}+\lambda z_{1} \vec{k} ; \frac{x_{2}}{x_{1}}=\frac{y_{2}}{y_{1}}=\frac{z_{2}}{z_{1}}=\lambda$.

Squaring the vector $\vec{r}_{2}-\vec{r}_{1}$ scalarly, we obtain the square of the distance between the points with the corresponding coordinates: $\left(\overrightarrow{r_{2}}-\overrightarrow{r_{1}}\right)^{2}=\left(x_{2}-x_{1}\right)^{2}+\left(y_{2}-y_{1}\right)^{2}+\left(z_{2}-z_{1}\right)^{2}$.