Solution (source code)

= Solution
{c}

A real square <matrix> $A$ is an <orthogonal matrix> when
$$
\boxed{A^TA=I.}
$$
Here $A^T$ is the <transpose> and $I$ the <identity matrix>; equivalently, its columns form an <orthonormal basis>. If this holds, the squared <Euclidean norm> obeys
$$
|A\mathbf v|^2=\mathbf v^TA^TA\mathbf v=\mathbf v^T\mathbf v=|\mathbf v|^2,
$$
so the <linear transformation> preserves length.

Conversely, suppose $|A\mathbf v|=|\mathbf v|$ for every <vector> $\mathbf v$. Put $B=A^TA-I$, a <symmetric matrix>. Then $\mathbf v^TB\mathbf v=0$ for every <vector>. Taking $\mathbf v=\mathbf e_i$, the standard <basis vectors>, gives $B_{ii}=0$. Taking $\mathbf v=\mathbf e_i+\mathbf e_j$ for $i\ne j$ gives $2B_{ij}=0$. Thus $B=0$, proving that \b[the <linear transformation> preserves length if and only if $A$ is an <orthogonal matrix>.]