# Lagrange Multipliers for the derivation of Maxwell-Boltzmann distribution

When deriving the MB-Distribution while taking the number of quantum states $$g_j$$ into account, the final equation I'd have to solve would be: $$\ln(g_j)-\ln(n_j)+\alpha+\beta\cdot E_j=0$$ Where $$n_j$$ is the number of particles at energy level $$E_j$$. The $$\alpha$$ and $$\beta$$ are the applied Lagrange Multipliers restrictions. I have understood that adding or subtracting the Lagrangian Multipliers should not matter for the end result. Now, when I continue with this equation, I'd eventually get: $$n_j=e^\alpha\cdot e^{\beta\cdot E_j} \cdot g_j$$ When I want to derive the probability distribution formula of Maxwell-Boltzmann, I'd have to consider energy to be continuous. Substituting $$g_j$$ with the energy density formula times $$\mathrm dE$$, the total number of particles $$N$$ would then be: $$\int_0^\infty\frac{V\cdot 2^{2.5}\pi\cdot m^{1.5}}{h^3}\cdot \sqrt E\cdot e^{\alpha}\cdot e^{\beta\cdot E}\cdot \mathrm dE=N$$ However, the result of this integration up to infinity would simply give the outcome $$0$$. But when you subtract the Lagrange Multipliers in the initial equation, the constants would have negative signs and the integration would give the correct formula for $$N$$.

But this means that it does matter whether you add or subtract the Lagrange Constants. What am I doing wrong here?

• There is a great deal of difference between "$\mathit 0$" and "integral diverges". On the other hand, addition and subtraction are pretty much the same thing. Mar 9 '19 at 7:03
• @Johnny Gui I think your problem is that you skip the step of identifying the Lagrangian Multipliers with physical quantities. It is correct that when setting up your auxiliary function for the minimization using Lagrangian Multipliers it does not matter whether you give the Lagrangian Multiplier terms a positive or negative sign for the correctness of your end result. But your choice of sign will reflect in the (sign of the) physical quantity the Lagrangian Multiplier represents, e.g. $\beta$ will be $\frac{1}{kT}$ in one case and $\frac{-1}{kT}$ in the other. Mar 9 '19 at 15:29
• @IvanNeretin Perhaps I did it the wrong way, but how should this problem with my integration then be approached if addition and subtraction are the same thing?
– Phy
Mar 9 '19 at 16:22
• @Philipp But what if the constants can only be derived physically by integrating the formula? I have seen sources in which e^-a is derived by integrating the equation up to infinity and then rewriting the outcome. But this is only possible when the Langrangian Constants are subtracted. How would one know this is how it should be derived if he is taught that subtraction or addition should not matter for the Langrangian Constants?
– Phy
Mar 9 '19 at 16:28
• @JohnnyGui Have a look at this Wikipedia article. In the derivation contained therein the Lagrangian Multipliers are identified by recognizing a correspondence of the resulting equation with the Euler-integrated fundamental equation of thermodynamics. And it is this point where you will see a difference depending on whether you chose to subtract or add the Lagrangian Multiplier terms. Mar 9 '19 at 17:12

Ignoring multiplicative constants, the required integral is (in general form)

$$\int \sqrt{x} e^{ax} \mathrm{d} x = \frac{1}{a}\sqrt{x}e^{ax}+\frac{i\sqrt{\pi}}{2a^{3/2}} \mathrm{erf}(i\sqrt{ax})$$

where $$\mathrm{erf}(x) = \frac{2}{\sqrt{\pi}} \int_0^x e^{-t^2}\mathrm{d}t$$

Setting $$x=E$$, $$a=\beta$$, and the integration limits as $$0$$ and $$\infty$$, gives

$$\int_0^\infty \sqrt{E} e^{\beta E} \mathrm{d} E = \frac{1}{\beta}\sqrt{E}e^{\beta E}\Bigg|_{0}^\infty + \frac{i\sqrt{\pi}}{2\beta^{3/2}} \mathrm{erf}(i\sqrt{\beta E})\Bigg|_{0}^\infty = \frac{1}{\beta}\sqrt{E}e^{\beta E}\Bigg|^\infty +\frac{i\sqrt{\pi}}{2\beta^{3/2}} \mathrm{erf}(i\sqrt{\beta E})\Bigg|^\infty$$

since $$\mathrm{erf}(0)=0$$. To make further progress, consider that the function $$\mathrm{erf}(x)$$ must have a real input $$x$$ (otherwise it will "blow up" to $$\infty$$), which implies that $$\beta$$ must be negative, or, explicitly, that $$\beta = -|\beta|$$ (we could also argue that the second term on the r.h.s must be real and come to the same conclusion). With negative $$\beta$$ we have that

$$\mathrm{erf}(i\sqrt{\beta E})=\mathrm{erf}(i\sqrt{-|\beta|E})=\mathrm{erf}(-\sqrt{|\beta|E})=-\mathrm{erf}(\sqrt{|\beta|E})$$

With this condition we also see that the first term on the r.h.s. is zero and as a result that

$$\int_0^\infty \sqrt{E} e^{-|\beta| E} \mathrm{d} E = \frac{\sqrt{\pi}}{2|\beta|^{3/2}}$$

• Thanks for your answer. But can you please elaborate further why a real input of x must lead to a negative beta? I'm missing that part.
– Phy
Mar 9 '19 at 18:28
• @JohnnyGui I elaborated on how x becomes positive with negative beta. Mar 9 '19 at 20:57
• Ok thanks, but one could ask, why is it "bad" for it to "blow up" to infinity? Why can't one then just accept that the integrand is divergent?
– Phy
Mar 9 '19 at 22:18
• @JohnnyGui The point of the integration is to find the normalization constant such that the integral from 0 to $\infty$ over the MB distribution is 1. If the integral blows up you can't normalize the distribution. Mar 10 '19 at 4:12

You can choose the signs either way round, the final result will be the same because the same physics is involved. You have presumably started by finding the number of distinguishable stationary states such as $$\Omega=\sum_n N!/\prod_in_i$$ subject to $$\sum_i n_i=N; \; \sum_,n_i\epsilon_i=E$$. As it turns out the maximum terms is greater than all the rest put together, i.e. the equilibrium condition is overwhelmingly probable, and so $$\Omega_m= N!/\prod_in_i$$ and from this we aim to find the maximum value which leads to $$\displaystyle \frac{\partial \Omega_m}{\partial n_i}+\alpha+\beta\epsilon_i=0$$ where $$\alpha,\,\beta$$ are the undetermined multipliers but they are not indeterminate. The $$\alpha$$ is related to the partition function and $$\beta$$ in a simple way to the temperature so they have a physical meaning so that their values are fixed because of that, thus it does not matter if the equation were $$\displaystyle \frac{\partial \Omega_m}{\partial n_i}-\alpha-\beta\epsilon_i=0$$

Mathematically it is easier to use the log thus, start with $$\displaystyle \frac{\partial \ln(\Omega_m)}{\partial n_i}-\alpha-\beta\epsilon_i=0$$ and after several steps and as each $$n_i$$ is independent then $$\ln(n_i)+\alpha+\beta=0$$. This gives $$n_i=e^\alpha e^{-\beta e_i}$$ which is the Maxwell Boltzmann distribution and $$n_i=g_ie^\alpha e^{-\beta e_i}$$ if degeneracy is included.

To go further the multipliers have to be found. As $$\sum_in_i=N$$ then $$N=e^{-\alpha}\sum_n g_ie^{-\beta\epsilon_i}$$ and the partition function is $$Z=\sum_n g_ie^{-\beta\epsilon_i}$$.

It is more difficult to calculate $$\beta$$ and the entropy is needed to do so. But we know that $$\beta$$ must be a positive number (as defined above in $$\partial \ln(\Omega_m)/\partial n_i-\alpha-\beta\epsilon_i=0$$) otherwise the partition function would diverge towards infinity (and if zero the partition function would be an infinite sum). The same is true for your integral.

$$\beta$$ must be related to temperature because if there were two isolated systems that were then brought into contact and so exchange energy and come to equilibrium this then is possible only with the same value of $$\beta$$. Finally an increase in $$\beta$$ is associated with a decrease in temperature. The ratio of two distributions is $$\displaystyle \frac{n_k}{n_i}=\frac{g_k}{g_i}e^{-\beta(\epsilon_k-\epsilon_i)}$$. If $$\epsilon_k>\epsilon_i$$ when $$\beta$$ decreases the ration $$n_k/n_i$$ must increase. Hence the total energy of the system must increase as population moves from lower levels $$i$$ to those of $$k$$. Thermodynamically such a change is associated with a rise in temperature.

As the entropy is defined as $$S=k\ln(\Omega_m)$$ and given by classical thermodynamics as $$\displaystyle \left(\frac{\partial S}{\partial E}\right)_{V,N}=\frac{1}{T}$$ we find that $$\displaystyle \left(\frac{\partial S}{\partial E}\right)_{V,N}=\frac{1}{T}=k\beta$$, where $$k$$ is a (Boltzmann's) constant.

Had we used positive signs in the starting equation $$\partial \ln(\Omega_m)/\partial n_i$$ then we would have to change the sign in front of each $$\beta$$ and end up with the same definition of the partition function $$Z$$.

• Thanks for your explanation. I noticed that when I write out $ln(\Omega_m)$ I would get $\partial[\partial n_i \cdot k(\alpha + \beta E)] \cdot \frac{1}{\partial E}$. Could you please explain how $\partial n_i$ is removed from the equation so that the formula for $\frac{1}{T}$ would not contain $\partial n_i$?
– Phy
Mar 10 '19 at 19:57
• I'm not quite sure where you are starting, but to get the entropy use Sterling's approx for the factorial and get $S=k(N\ln(N)+\alpha N+\beta N)$ then obtain $S=N(k\ln(\sum_i e^{-\beta \epsilon_i} +\beta E))$. Now the rest is messy and tricky; $\beta$ depends on $E$ as $\sum_in_i=N \; \sum_i n_i\epsilon_i=E,\; n_i=e^{-\alpha} e^{-\beta \epsilon_i}$ so to get $\partial S/\partial E$ we find $k\beta +k\frac{\partial}{\partial \beta}(N\ln(\sum_i e^{-\beta \epsilon_i})+\beta E)\frac{\partial \beta}{\partial E}$. Evaluate this and only the $k\beta$ remains. (Please check my signs). Mar 11 '19 at 13:45