# Partition function

I am trying to calculate the partition function of a system that has 2 bosons (spin 0) in thermal equilibrium with a reservoir. The particles are independent and each one admits as possible orbitals the eigenstates of the harmonic oscillator. I tried to use the definition of partition function used in the salinas book that writes the expression as following:

$$\Xi = \Xi(T,V,\mu) = \prod_j\left\{\sum_n\exp[-\beta(\epsilon_j-\mu)n]\right\}$$

However, I don't understand very well how to apply the expression in this exercise. I tried to solve the problem, by separating the cases where both particles are in the same state and the cases where they are in different states. My teacher came up with this expression, but that expression doesn't exclude the cases where particles are in different states, because in the second summation he states that $$n_2=n_1$$. Why is it that $$n_2=n_1$$?

$$\mathcal{Z} = \sum_{n_1=0}^{+\infty}\sum_{n_2=n_1}^{+\infty} e^{-\beta(n_1+n_2+1)\hbar\omega}$$

Your second equation does not say that $$n_1=n_2$$. It is simply saying that the sum on $$n_2$$ starts from $$n_2=n_1$$ and continues up to $$n_2=\infty$$. This ensures that you are not double counting as $$|n_1,n_2\rangle = |n_2,n_1\rangle$$ by Bose statistics. Myself, I would have written $$n_2\ge n_1$$.
To expand on the other answer: the reason your first expression for $$\Xi$$ does not work is because it is the partition function for bosons in the grand canonical ensemble, not the canonical ensemble. In the grand canonical ensemble, particle number is not fixed -- indeed, the interpretation of the sum you wrote is that for each $$j$$th orbital, you are summing over the number of bosons $$n$$ occupying the orbital. Clearly each configuration in this case does not have the same number of bosons.
On the other hand, the second expression always has one boson in state $$| n_1 \rangle$$ and the second boson in state $$|n_2 \rangle$$, with the sum constrained such that $$n_2 \geq n_1$$. The reason for this is because $$| n_1 , n_2 \rangle$$ is the same state as $$|n_2, n_1 \rangle$$ for bosons, since it does not matter which boson is in which state.
\begin{align} \sum_{n_1 = 0}^{\infty} \sum_{n_2 = n_1}^{\infty} e^{-\beta \hbar \omega (n_1 + n_2 + 1) } &= e^{-\beta \hbar \omega (0 + 0 + 1)} + e^{-\beta \hbar \omega (0 + 1 + 1)} + e^{-\beta \hbar \omega (0 + 2 + 1)} + e^{-\beta \hbar \omega (0 + 3 + 1)} + \ldots \\ &\quad \quad \quad \quad \quad \quad \ + e^{-\beta \hbar \omega (1 + 1 + 1)} + e^{-\beta \hbar \omega (1 + 2 + 1)} + e^{-\beta \hbar \omega (1 + 3 + 1)} + \ldots \\ &\quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \ \ + e^{-\beta \hbar \omega (2 + 2 + 1)} + e^{-\beta \hbar \omega (2 + 3 + 1)} + \ldots \\ \end{align}