Solution (source code)

= Solution

Let $W=\operatorname{span}\{\mathbf v,\mathbf w\}=\operatorname{col}V$. Since the two columns are <linearly independent>, the leading $2\times2$ block $R_1$ in
$$
R=SV=\begin{pmatrix}R_1\\0\end{pmatrix}
$$
is invertible. Hence $S(W)=\operatorname{span}\{\mathbf e^{(1)},\mathbf e^{(2)}\}$. The hypothesis that $W$ is an <invariant subspace> of $A$ implies that this coordinate plane is invariant under $\widehat A=SAS^{-1}$. Consequently the first two columns of $\widehat A$ have no entries below row two, and
$$
\widehat A=
\begin{pmatrix}
B&C\\
0&D
\end{pmatrix},
$$
where $B$ is the top-left $2\times2$ block and $D$ is the bottom-right $(n-2)\times(n-2)$ block. <Eigenvalue deflation by an invariant subspace> now gives
$$
\det(zI-A)=\det(zI-\widehat A)
=\det(zI_2-B)\det(zI_{n-2}-D),
$$
so
$$
\boxed{\operatorname{spec}(A)=\operatorname{spec}(B)\mathbin\cup\operatorname{spec}(D),}
$$
again counting <algebraic multiplicities>.

For the required orthogonal reduction, take a thin <QR decomposition> $V=Q_1R_1$, extend the two orthonormal columns of $Q_1$ to an orthogonal matrix $Q$, and set $S=Q^T$. Then
$$
SV=Q^TV=\begin{pmatrix}R_1\\0\end{pmatrix}.
$$
Equivalently, apply one <Householder transformation> to annihilate entries $2,\ldots,n$ of $\mathbf v$, followed by a second Householder transformation acting only on coordinates $2,\ldots,n$ to annihilate entries $3,\ldots,n$ of the transformed $\mathbf w$.