Solution (source code)

= Solution

Starting with $A_0=A$, choose real shifts $\sigma_j$, factor $A_j-\sigma_jI=Q_jR_j$, and set
$$
A_{j+1}=R_jQ_j+\sigma_jI=Q_j^TA_jQ_j.
$$
Each step is an <orthogonal> similarity, so the eigenvalues are preserved and all iterates are similar. If $A_j^T=A_j$, transposing $Q_j^TA_jQ_j$ proves symmetry of $A_{j+1}$, completing the induction.

The given matrix is the <Householder reflection>
$$
A=I-\frac2n\mathbf1\mathbf1^T.
$$
It has <eigenvalue> $-1$ along $\mathbf1$ and $+1$ on its <orthogonal> complement, hence $A^TA=I$. In the positive-diagonal QR convention its unshifted factorization is $Q=A$, $R=I$, so the next iterate is again $A$. Thus \b[unshifted QR is stationary], despite the matrix generally having nonzero off-diagonal entries. If arbitrary diagonal signs are allowed in $R$, a step can instead replace $A$ by $DAD$ for a diagonal sign matrix $D$; every off-diagonal magnitude remains unchanged. Such sign changes still make no progress towards diagonalization.