Use of Lagrange multipliers in derivation of the Bose-Einstein distribution My main question in regards to this is an explanation on why/how you can use Lagrange multipliers when you have a function of infinite variables, what is the justification behind this? So to derive the Bose-Einstein distribution you have to maximize the function
\begin{equation}
f=\sum_in_i\ln\left(\frac{n_i+g_i}{n_i}\right)+\sum_ig_i\ln\left(\frac{n_i+g_i}{g_i}\right)
\end{equation}
subject to the constraint equations
\begin{equation}
g=\sum_i n_i-N=0 \qquad \text{and} \qquad h=\sum_i \epsilon_in_i-U=0.
\end{equation}
now $f,g,h$ are all functions of $n_1,\dots,n_i,\dots$. so using Lagrange multipliers will lead to an infinite set of equations:
\begin{align}\begin{split}
     \frac{\partial}{\partial n_1}(f+\alpha g+\beta h)&=\frac{\partial f}{\partial n_1}+\alpha\frac{\partial g}{\partial n_1}+\beta\frac{\partial h}{\partial n_1}=0\\
     &\vdots\\
     \frac{\partial}{\partial n_i}(f+\alpha g+\beta h)&=\frac{\partial f}{\partial n_i}+\alpha\frac{\partial g}{\partial n_i}+\beta\frac{\partial h}{\partial n_i}=0\\
     &\vdots
 \end{split}\end{align}
is this mathematically rigorous? is there any point in considering an infinite set of equations with infinite unknowns? I have googled this and it seems possible but the math they use is above my level. That's my first question. Anyway all these equations are alike so we can consider the general case:
\begin{equation}
     \frac{\partial}{\partial n_k}(f+\alpha g+\beta h)=\frac{\partial f}{\partial n_k}+\alpha\frac{\partial g}{\partial n_k}+\beta\frac{\partial h}{\partial n_k}=0
 \end{equation}
for $k=1,\dots,i,\dots$. Substituting in the expressions for $f,g$ and $h$ we get that:
\begin{align}
     \frac{\partial}{\partial n_k}\left[\sum_in_i\ln\left(\frac{n_i+g_i}{n_i}\right)+\sum_ig_i\ln\left(\frac{n_i+g_i}{g_i}\right)\right]+\alpha\frac{\partial}{\partial n_k}\left[\sum_i n_i-N\right]+\beta\frac{\partial}{\partial n_k}\left[\sum_i \epsilon_in_i-U\right]=0
 \end{align}
now since we are differentiating with respect to the $k$th term all the other terms will go to zero so $\partial/\partial n_k(\sum_in_i-N)=1$ and $\partial/\partial n_k(\sum_i\epsilon_in_i-U)=\epsilon_k$. The same applies for the first term, only the $k$th term will survive and you just need to use the product and chain rule leading to a lot of cancellations. After simplifying we are left with:
\begin{equation}
     \ln\left(\frac{n_i+g_i}{n_i}\right)+\alpha+\beta\epsilon_i=0
 \end{equation}
which when solved for $n_i$ gives us that:
\begin{equation}
     \boxed{n_i=\frac{g_i}{e^{(-\beta\epsilon_i-\alpha)}-1}}
 \end{equation}
apparently, this is wrong it should be $\beta\epsilon_i-\alpha$? Don't really understand where the $-\beta\epsilon_i$ comes from in the second to last equation, I guess I could define the constraint function $h$ as $h=U-\sum_i\epsilon_in_i$ and you would ge the negative sign but why should this matter?
 A: To solve the problem, you need to find the value of the Lagrange multipliers as well, that are not determined in the final expression of your answer.
Minimization of the augmented function $f + \alpha g + \beta h$, must be performed w.r.t. all the independent variables, i.e. the original independent variables $n_i$, and the Lagrange multipliers $\alpha$ and $\beta$.
Minimization w.r.t. $n_i$ gives (if you performed the computation well), the result you got
$n_i = \dfrac{g_i}{e^{-\beta \epsilon_i- \alpha} - 1}$,
while minimization w.r.t. the Lagrange multipliers gives you the constraints
$0 = g = \displaystyle \sum_i n_i - N$$\qquad \rightarrow \qquad$
$\sum_i \dfrac{g_i}{e^{-\beta \epsilon_i - \alpha}- 1} = N$
$0 = h = \displaystyle \sum_i \epsilon_i n_i - U$$\qquad \rightarrow \qquad$
$\sum_i \dfrac{\epsilon_i g_i}{e^{-\beta \epsilon_i - \alpha}- 1} = U$-
These are the two equations that allow you to evaluate the value of $\alpha$ and $\beta$, not known in the expression of $n_i$ above.
Physical meaning of Lagrange multipliers.
Lagrange multipliers $\alpha$ and $\beta$ can be related to temperature and chemical potential through Boltzmann's constant
$\alpha = \dfrac{\mu}{k_B T} \qquad , \qquad \beta = \dfrac{1}{k_B T}$
For full derivation and details, please take a look at the wiki pages:

*

*https://en.wikipedia.org/wiki/Bose%E2%80%93Einstein_statistics, expand the section Derivation in the canonical approach

*https://en.wikipedia.org/wiki/Maxwell%E2%80%93Boltzmann_statistics
