Solution (source code)

= Solution

The $n$ independent <eigenvectors> $v_1,\ldots,v_n$ of $B$ from part (e) are also <eigenvectors> of $A$. Put $S=(v_1\ \cdots\ v_n)$ and $P=S^{-1}$. Then
$$
\boxed{PAP^{-1}=\operatorname{diag}(\mu_1,\ldots,\mu_n),\qquad PBP^{-1}=\operatorname{diag}(\lambda_1,\ldots,\lambda_n).}
$$
This supplies the required <simultaneous diagonalization> over the same <field> as in part (e).