I know that for the canonical ensemble:
$Z=\Sigma_n e^{-\beta E_n}$
By using the Lagrange Lagrange multiplier method, one can find for the probability of the system being in an microstate:
$Pr_n=\frac 1 Z e^{-\beta (E_n)}$
But if we consider that each microstate is $\Omega_n$ times degenerated, then we'd have:
$Z=\Sigma_{n,\Omega_n} e^{-\beta E_n}=\Sigma_n \Sigma_{k=1}^{\Omega_n}e^{-\beta E_n}$.
And consequently $Pr_n=\Omega_n \frac 1 Z e^{-\beta (E_n)}$. But how do we get $\Omega_n$? Even when I consider the lagrange multiplier, I still don't get the factor $\Omega_n$.
For the Grand Canonical Ensemble:
$$Z_G=\Sigma_n e^{-\beta(E_n - \mu N_n)}=\Sigma_n e^{-\beta\Sigma_{n_i}(\epsilon_i - \mu)}$$
$$\Sigma_{\{n_i \}}e^{-\beta\Sigma_{n_i}(\epsilon_i - \mu)}=\Pi_i \Sigma_{n_i=0}^{n_{max}}e^{-\beta{n_i}(\epsilon_i - \mu)}$$
And to simplify the expression, if we consider fermions for example, our expression for the Partition function of the grand canonical ensemble would be:
$$Z_G=\Pi_i[1+ e^{-\beta{n_i}(\epsilon_i - \mu)}]$$
Now if we consider that each energy level is g-times degenerated, we would have:
$$Z_G=\Sigma_{\{n_i \},g}e^{-\beta\Sigma_{n_i}(\epsilon_i - \mu)}$$.
$$Z_G=\Sigma_{\{n_i \},} \cdot g \cdot e^{-\beta\Sigma_{n_i}(\epsilon_i - \mu)}$$.
And this changes to:
$$Z_G=\Pi_i \Pi_{k=1}^g[1+ e^{-\beta{n_i}(\epsilon_i - \mu)}]$$.
Why do we get a product of the degeneracy, when as I showed above, it comes out as a constant?