Solution (source code)

= Solution

The <Holstein–Primakoff transformation> acts on the physical <Fock states> $|n\rangle$, $0\le n\le2S$, with the specified operator ordering. Its matrix elements are
$$
S^z|n\rangle=(S-n)|n\rangle,\qquad
S^-|n\rangle=\sqrt{(2S-n)(n+1)}|n+1\rangle,\qquad
S^+|n\rangle=\sqrt{n(2S-n+1)}|n-1\rangle.
$$
The unavailable endpoint states have zero coefficient. These formulas directly give $[S^z,S^\pm]|n\rangle=\pm S^\pm|n\rangle$. Moreover
$$
\begin{aligned}
[S^+,S^-]|n\rangle
&=[(2S-n)(n+1)-n(2S-n+1)]|n\rangle\\
&=2(S-n)|n\rangle=2S^z|n\rangle.
\end{aligned}
$$
Thus the <spin commutation relations> hold in units $\hbar=1$. The <Holstein–Primakoff occupation constraint> is essential: the spin <Hilbert space> has dimension $2S+1$, so unrestricted boson <Fock space> is not itself this finite-spin representation. The square root and oscillator operators must retain their order for the displayed matrix elements and endpoint conditions to agree.