Solution (source code)

= Solution

Suppress the fixed individual <quantum numbers> $s_1=s_2=1/2$. In the coupled <basis>, ordered on both rows and columns as $|1,1\rangle,|1,0\rangle,|1,-1\rangle,|0,0\rangle$, the total-spin <eigenvalues> give
$$
\boxed{[f]_{\mathrm{coupled}}=\operatorname{diag}\left(a+\frac{b\hbar^2}4,a+\frac{b\hbar^2}4,a+\frac{b\hbar^2}4,a-\frac{3b\hbar^2}4\right).}
$$
Here the first three entries form the <triplet state> sector and the last is the <singlet state>. For the product <basis>, use
$$
\mathbf s_1\cdot\mathbf s_2=s_{1z}s_{2z}+\frac12(s_{1+}s_{2-}+s_{1-}s_{2+}).
$$
The first term has diagonal entries $\hbar^2(1,-1,-1,1)/4$. Each nonzero exchange term flips $|\uparrow\downarrow\rangle$ to $|\downarrow\uparrow\rangle$ or back, with coefficient $\hbar^2/2$. With rows and columns ordered as $|\uparrow\uparrow\rangle,|\uparrow\downarrow\rangle,|\downarrow\uparrow\rangle,|\downarrow\downarrow\rangle$,
$$
\boxed{[f]_{\mathrm{product}}=aI+\frac{b\hbar^2}4\begin{pmatrix}1&0&0&0\\0&-1&2&0\\0&2&-1&0\\0&0&0&1\end{pmatrix}.}
$$
The <change of basis> is made explicit by $|1,0\rangle=(|\uparrow\downarrow\rangle+|\downarrow\uparrow\rangle)/\sqrt2$ and $|0,0\rangle=(|\uparrow\downarrow\rangle-|\downarrow\uparrow\rangle)/\sqrt2$, with $|1,\pm1\rangle=|\uparrow\uparrow\rangle,|\downarrow\downarrow\rangle$. The resulting <eigenvalues> reproduce the diagonal coupled <matrix>.