Spectrum of a scalar matrix plus a rank-one projector (source code)

= Spectrum of a scalar matrix plus a rank-one projector
{title2=$A=\alpha I+\beta vv^{\mathsf T}$}

Let $v$ be a real <unit vector> in $d$-dimensional <Euclidean space>. Then $P=vv^{\mathsf T}$ is a <rank-one orthogonal projection>: $Pv=v$, while $Pw=0$ for $w$ <orthogonal> to $v$. Consequently the <symmetric matrix> $A=\alpha I+\beta P$ has <eigenvalue> $\alpha+\beta$ on the line spanned by $v$ and <eigenvalue> $\alpha$ on its <orthogonal complement>. Any <orthonormal basis> of that complement completes $v$ to an <orthonormal eigenbasis>. Thus
$$
\operatorname{tr}A=d\alpha+\beta,\qquad\det A=\alpha^{d-1}(\alpha+\beta).
$$
The <trace> and <determinant> formulas remain valid when one of these <eigenvalues> is zero. When $\beta=0$, all nonzero <vectors> have the same <eigenvalue>, and the chosen splitting is optional.