Solution (source code)

= Solution

For independent bosonic modes, the <canonical commutation relation> is
$$
[b_i,b_j^\dagger]=\delta_{ij},\qquad [b_i,b_j]=[b_i^\dagger,b_j^\dagger]=0.
$$
For independent fermionic modes, the <canonical anticommutation relations> are
$$
\{c_i,c_j^\dagger\}=\delta_{ij},\qquad \{c_i,c_j\}=\{c_i^\dagger,c_j^\dagger\}=0,
$$
where $[A,B]=AB-BA$ and $\{A,B\}=AB+BA$. The <creation operator> is the adjoint of the <annihilation operator>. In either case the mode's <number operator> is
$$
\boxed{n_i=a_i^\dagger a_i},
$$
with $a_i=b_i$ or $c_i$ as appropriate. It measures the mode's <occupation number>. Its possible <eigenvalues> are
$$
\boxed{n_i=0,1,2,\ldots\ \text{for bosons};\qquad n_i=0,1\ \text{for fermions}}.
$$
For <fermions>, $c_i^2=0$ implies $n_i^2=c_i^\dagger(1-c_i^\dagger c_i)c_i=n_i$, so the <number operator> is a projection. This expresses the exclusion of double occupation of one fermionic mode. The total particle number is $N=\sum_i n_i$.