Based on exercise 15.1.1. from Principles of Quantum Mechanics, 2nd ed. by Shankar:
Express S 2 {\displaystyle \ S^{2}} as a matrix for two spin-1/2 particles in the direct product basis.
1.) First express S 2 {\displaystyle \ S^{2}} in terms of S 1 2 {\displaystyle \ S_{1}^{2}} , S 2 2 {\displaystyle \ S_{2}^{2}} , S 1 z {\displaystyle \ S_{1z}} , S 2 z {\displaystyle \ S_{2z}} , S 1 ± {\displaystyle \ S_{1\pm }} and S 2 ± : S 2 = ( S 1 → ⋅ S 2 → ) 2 = S 1 2 + S 2 2 + 2 S 1 → ⋅ S 2 → = S 1 2 + S 2 2 + 2 ( S 1 x S 2 x + S 1 y S 2 y + S 1 z S 2 z ) = S 1 2 + S 2 2 + {\displaystyle \ S_{2\pm }:S^{2}=({\vec {S_{1}}}\cdot {\vec {S_{2}}})^{2}=S_{1}^{2}+S_{2}^{2}+2{\vec {S_{1}}}\cdot {\vec {S_{2}}}=S_{1}^{2}+S_{2}^{2}+2(S_{1x}S_{2x}+S_{1y}S_{2y}+S_{1z}S_{2z})=S_{1}^{2}+S_{2}^{2}+} . Now use the idendity
ℏ 2 ( 2 0 0 0 0 1 1 0 0 1 1 0 0 0 0 2 ) {\displaystyle {\hbar }^{2}{\begin{pmatrix}2&0&0&0\\0&1&1&0\\0&1&1&0\\0&0&0&2\\\end{pmatrix}}}