Solution (source code)

= Solution

If either <vector> is zero, both sides vanish. Otherwise let $\theta$ be the angle between them. The magnitudes of the <cross product> and <dot product> are described by
$$
|\mathbf a\times\mathbf b|=|\mathbf a|\,|\mathbf b|\sin\theta,
\qquad \mathbf a\cdot\mathbf b=|\mathbf a|\,|\mathbf b|\cos\theta.
$$
Squaring and using $\sin^2\theta=1-\cos^2\theta$ proves <Lagrange's identity>:
$$
\boxed{|\mathbf a\times\mathbf b|^2
=|\mathbf a|^2|\mathbf b|^2-(\mathbf a\cdot\mathbf b)^2.}
$$