Solution (source code)

= Solution

Split the <vector> $x$ into its normal and tangential <orthogonal projections>:
$$
x=(n\cdot x)n+\bigl(x-(n\cdot x)n\bigr).
$$
A <reflection> in the plane negates the first component and preserves the second. Thus $Hx=x-2(n\cdot x)n$, giving the <Householder reflection>
$$
\boxed{M=I-2nn^T,\qquad M_{ij}=\delta_{ij}-2n_in_j.}
$$
Since $n\cdot n=1$ and $n\cdot u=n\cdot v=0$,
$$
\boxed{Mn=-n,\qquad Mu=u,\qquad Mv=v.}
$$
The columns of a <matrix representation of a linear map> are the coordinates of the images of the ordered basis <vectors>. Consequently, in the <orthonormal basis> $(u,v,n)$,
$$
\boxed{N=\begin{pmatrix}1&0&0\\0&1&0\\0&0&-1\end{pmatrix}.}
$$
Equivalently, with the <orthogonal matrix> $Q=(u\ v\ n)$, the <change of basis> formula is $N=Q^TMQ$.