Solution (source code)

= Solution

For a nonzero real vector $v$, its <Householder reflection> is
$$
\boxed{H=I-2\frac{vv^T}{v^Tv}.}
$$
Let $P=vv^T/(v^Tv)$. Then $P^T=P$ and $P^2=P$, so
$$
H^TH=(I-2P)^2=I-4P+4P^2=I.
$$
Thus \b[$H$ is an <orthogonal matrix>], and it is also symmetric with $H^{-1}=H$. It sends $v$ to $-v$ and fixes every vector perpendicular to $v$, explaining the reflection in the hyperplane $v^\perp$. For a target reduction of a vector $a$ to $\|a\|e_1$, choose $v=a-\|a\|e_1$ when this vector is nonzero; an alternative sign avoids cancellation in numerical implementations.