Solution (source code)

= Solution

Since $S\mathbf w=c\mathbf e^{(1)}$ and $A\mathbf w=\lambda_1\mathbf w$,
$$
\widehat A(c\mathbf e^{(1)})
=SAS^{-1}S\mathbf w
=SA\mathbf w
=\lambda_1c\mathbf e^{(1)}.
$$
Thus the first column of $\widehat A$ is $(\lambda_1,0,\ldots,0)^T$, and $\widehat A$ is a <block upper triangular matrix>:
$$
\widehat A=
\begin{pmatrix}
\lambda_1&*\\
0&B
\end{pmatrix},
$$
where $B$ is its bottom-right $(n-1)\times(n-1)$ submatrix. Therefore
$$
\det(zI-\widehat A)=(z-\lambda_1)\det(zI-B).
$$
A <similarity transformation> preserves the <characteristic polynomial>, so
$$
\boxed{\operatorname{spec}(A)=\{\lambda_1\}\mathbin\cup\operatorname{spec}(B),}
$$
with <algebraic multiplicities> included.

To construct $S$, use a <Householder transformation>. With $\alpha=\|\mathbf w\|_2$, choose the sign of $\alpha$ to avoid cancellation and set
$$
\mathbf v=\mathbf w-\alpha\mathbf e^{(1)},
\qquad
S=I-2\frac{\mathbf v\mathbf v^T}{\mathbf v^T\mathbf v}.
$$
Then $S$ is an <orthogonal matrix> and maps $\mathbf w$ to $\alpha\mathbf e^{(1)}$ up to the chosen sign. If $\mathbf w$ already lies on the first coordinate axis, take a suitable diagonal sign matrix. This is the one-vector case of <orthogonal coordinate reduction of a subspace>.