Let B be a point $\displaystyle \mathbb{R}^n$ with coordinate vector $\displaystyle \mathbf{b}$. Let $\displaystyle \mathbf{x=a+\lambda d}$, $\displaystyle \lambda \in \mathbb{R}$ be the equation of a line.

1) Show that the square of the distance from B to an arbritrary point $\displaystyle \mathbf{x}$ on the line is given by:

$\displaystyle q(\lambda)=|\mathbf{b}-\mathbf{a}|^2-2\lambda(\mathbf{b}-\mathbf{a}) \cdot \mathbf{d}+ \lambda^2 |\mathbf{d}|^2$

2) Find the shortest distance between the point B and the line by minimising $\displaystyle q(\lambda)$

3) If P is the point on the line closest to B, show that:

$\displaystyle

\vec{PB}=\mathbf{b} - \mathbf{a} - proj_{\mathbf{d}}(\mathbf{b} - \mathbf{a})$, and show that $\displaystyle \vec{PB}$ is orthogonal to the direction $\displaystyle \mathbf{d}$ of the line