# Average energy in Boltzmann statistics

Currently, I am learning the Planck's radiation law and I got stuck in the average energy calculation as done in this video as below: $$\bar{E}=\frac{\int_0^\infty Ee^{-E/kT}\mathrm{d}E}{\int_0^\infty e^{-E/kT}\mathrm{d}E}=kT.$$

But during the derivation of equipartition theorem right here, we got this equation for average energy: $$\bar{E}=\frac{\int_0^\infty cq^2 e^{-cq^2/kT}\mathrm{d}q}{\int_0^\infty e^{-cq^2/kT}\mathrm{d}q}=\frac{1}{2}kT$$ (taking $$E$$ of the form $$cq^2$$), which works out to be $$kT/2$$, as expected by the equipartition theorem.

Now, my questions are:

1. Why the average energy in the first equation is double that of in the second one ? (I know many of you could say that it contain 2 degrees of freedom, but how?)
2. If we put $$E=cq^2$$ in the first equation, it would just fairly work out to be $$kT$$, does that mean that equipartition theorem is violated as it ($$cq^2$$) just have one degree of freedom?
3. And, which of the above is the right way to define and derive average energy and why? (If none, then please let me know how it's done.)

I want an answer with proper reasons and all but simple mathematical details (not the mathematics of the canonical or other ensemble thing).

• The first formula is wrong.. It should account for the degeneracy of energy E and be derived from the correct maxwell boltzmann distribution of microscopic variables.. the second one is the right one and directly takes into account all the microscopic degrees of freedom. If you want to see what happens when dealing with the energy. Take your second equation and perform a change of variable in both integrals p->E Commented May 18 at 21:26
• By the way, the degeneracy of E (= the number of microscopic configurations associated to a given energy) does contain information about the number of degree of freedom Commented May 18 at 21:27
• @Syrocco could you please emphasize it? Commented May 18 at 21:30
• I think the lesson to be learned here is that everything depends on context. Without seeing the video is difficult to tell. In general one should try to understand exactly what's the proper context (the energy of what? What is the system we are talking about here? Is it a bunch of particles? Are we in a relativistic setting? Etc. Etc. ). The list is actually pretty long.
– lcv
Commented May 19 at 10:47

The first formula is false and you must start from the microscopic definition. The true probability distribution is using the microscopic variables. Here $$q$$ in your example, in the case of black body radiation, it would be the electromagnetic modes. In any cases, the probability of obtaining a $$q$$ is proportional to $$e^{-E(q)/T}$$ (setting $$k_b$$ to 1). From this, you might jump of to the conclusion that the probability of obtaining an energy $$E$$ regardless of $$q$$ is proportional to $$e^{-E/T}$$. But this is not the case! First because there might be multiple q leading to the same energy ($$-q$$ and $$q$$ for example in your quadratic case, even though it would not change the result herew it would change it in higher dimension). And secondly, if you want to do a change of variable in probability density, you have to do it properly. For example, the probability of obtaining an energy between $$E(q+dq)$$ and $$E(q)$$ is proportional to $$e^{-E(q)/T}dq=e^{-E/T}\dfrac{dq}{dE}dE$$. Where the left hand side comes from the fundamental principle of statistical mechanics and the second equality comes from the chain rule xhich allows you to correctly perform a change of variable for probability density. Well long story short, you have to include this $$dq/dE$$ in your first formula to correctly describe probability distribution of energy.

Edit:

The correct integral is, for an energy $$E=q^2$$:

$$\langle E \rangle = \dfrac{2}{Z}\int_{-\infty}^{\infty}q^2e^{-q^2/T}dq$$ The factor 2 is due to the symmetry between $$-q$$ and $$q$$, then: $$\langle E \rangle =\dfrac{2}{Z}\int_0^\infty E \dfrac{dq}{dE}dE=\dfrac{1}{Z}\int_0^\infty E^{0.5} e^{-E/T}dE$$

I let you finish to see that it indeed leads to the correct result.

• so you are saying, that I should take the limit in the lower integral of second equation ( the correct one ) , always from 0 to ∞ as if energy is proportional to q³ or q⁵ , then taking -q and +q wouldn't be same ..Am I right? Commented May 19 at 15:12
• @CPofPhysics I might have confused you when I talked about $-q$ and $q$. My point was that, in your case to one energy you always have 2 microscopic configurations which just add a factor 2 in the denominator and numerator and hence changes nothing. Now, if you imagine that you are in 2 dimensions, you will have a non trivial number of microscopic configuration $\{q_x, q_y\}$ corresponding to one energy $E$. Hence you should take that into account. But in your case it is not necessary. The only necessary thing is doing the correct change of variable Commented May 19 at 17:52
• Concerning your other point, with $q^3$, indeed, in 1d, the negative and positive configuration would not be the same. And by the way, your system would not be stable since the energy is not bounded below (you can always decrease the energy toward $-\infty$). But again, I might have confused you, my point in your particular exemple, was that you have to apply the chain rule to get the correct equation. The first point concerning multiple $q$ corresponding to a unique $E$ becomes a problem for higher dimensions (it is called, number of states or degeneracy and is well explained in Vincent ans) Commented May 19 at 17:57
• So, I'm not saying that you should always take the limit from $0$ to $-\infty$. I'm saying that to get the correct equation and as well the correct limit of the integral, you have to apply the chain rule. Commented May 19 at 17:59
• It depends. If $q$ represents position or velocity, they always go from $-\infty$ to $\infty$. If it repr3sents position and your particles are confined by hard walls, you can eventually cut your integral to some given values of the positions corresponding to your wall position. For example $0$ and $a$ if your walls are at these positions. But it is equivalent to playing infinitely deep well potential at these points but still letting the limits go to infinity Commented May 19 at 18:47

The general formula, from the definition of average, is $$\langle E\rangle = \frac{1}{Z}\int_0^\infty E e^{-\beta E} \mathrm{d}N$$ where $$\beta=1/kT$$. In the usual derivation for a quadratic energy $$E(u) = \alpha u^2$$, the density of states is required to be uniformly-spaced with respect to the coordinate, i.e. $$\mathrm{d}N\propto \mathrm{d}u$$. This is why $$\mathrm{d}N$$ can be replaced directly with $$\mathrm{d}u$$ in both the numerator and denominator. If you want to integrate with respect to the energy, you need to change variables properly: $$\langle E\rangle = \frac{1}{Z}\int_0^\infty E e^{-\beta E} \frac{\mathrm{d}N}{\mathrm{d}E}\mathrm{d}E$$ so that the $$\mathrm{d}N/\mathrm{d}E$$ term correctly accounts for the varying number of states in each energy interval $$\mathrm{d}E$$.

(Here $$Z$$ is just an appropriate normalization factor.)

• Can you please hint me from where the general formula came and why can't we take any other variable instead of density of states (dN) Commented May 18 at 22:20
• @CPofPhysics The general formula is the definition of average E. It is each energy multiplied by the relative weight, which is the occupational probability of that E multiplied by the number of states with that E. Commented May 18 at 22:24
• sorry for that, I understood it. Commented May 18 at 22:26
• @VincentThacker Isn't everything classical here?
– lcv
Commented May 19 at 10:40
• @CPofPhysics Yes, looks correct to me. Commented Jun 4 at 23:21

I think now I should write a complete answer to my own question according to my own understanding and ofcourse using the other appreciable answers.

To start with let's write down the Boltzmann distribution:$$n_i=N\frac{e^{\frac{-\varepsilon(x_i)}{k_BT}}}{\displaystyle{\sum_{i=1}^∞}e^{\frac{-\varepsilon(x_i)}{k_BT}}}=N\frac{e^{\frac{-\varepsilon(x_i)}{k_BT}}}{Z}\tag{1}$$

Where , $$n_i$$ is the number of particles in $$i$$th (micro)state having energy $$\varepsilon(x_i)$$ , $$x$$ being the microstate variable .

And , $$N$$ is the total number of particles in the isolated system.

And , $$k_B$$ is the Boltzmann constant and $$T$$ is the absolute temperature.

And, $$Z$$ is the Partition function.

In other form ($$n_i=dN$$):$$\frac{dN}{N}=\frac{e^{\frac{-\varepsilon(x_i)}{k_BT}}}{\displaystyle{\sum_{i=1}^∞}e^{\frac{-\varepsilon(x_i)}{k_BT}}}=\frac{e^{\frac{-\varepsilon(x_i)}{k_BT}}}{Z}\tag{2}$$

For average energy ( i.e. Expectation of $$E$$ ) :$$\bar{E}=\frac{\displaystyle{\sum_{i=1}^∞}\varepsilon(x_i)n_i}{N}=\frac{\displaystyle{\sum_{i=1}^∞}\varepsilon(x_i)dN}{N}\tag{3}$$

So , for finding the the average energy of any sort , we have to find $$\frac{dN}{N}$$ ( for that case/distribution ) , first.

## The quadratic and continuous energy case.

Let's do it for the simple quadratic and continuous energy form , $$E=cq²$$ ( for example , $$E=\frac{1}{2}mv²$$ ).

From here, we would be taking $$\varepsilon(x_i)=E$$ , as the macrostate variable.

Using $$eq(2)$$ ( multiplying numerator and denominator by $$dE$$ ) , we get:$$\frac{dN}{N}=\frac{e^{\frac{-E}{k_BT}}dE}{\displaystyle{\sum_{0}^∞}e^{\frac{-E}{k_BT}}dE}=\frac{e^{\frac{-E}{k_BT}}dE}{\displaystyle{\int_0^∞}e^{\frac{-E}{k_BT}}dE}$$

Look! We could use this equation to get the fraction $$\frac{dN}{N}$$, the same in any case and hence the average energy in any case /distribution could be worked out to be $$k_BT$$ , as in the first integral of the question.Wait ....what ?

That wrong ! ( looks like , but why ? )

It's because "the Partition function in the denominator is defined (rather derived ) to be the sum over all the microstates ($$x_i$$) not over the macrostate ($$E$$)".

Look at the Wikipedia article below:

Let's try to answer the why :

While deriving the Boltzmann distribution through the path of maximizing the entropy ( at equilibrium , which is the Boltzmann distribution all about ) , we encounter the following equation after applying Lagrange multipliers ( $$\alpha$$ and $$\beta$$ being constants ) :$$\beta\varepsilon(x_i)+ln(n_i)+\alpha=0$$Which works out to be:$$ln(n_i)=-\alpha-\beta\varepsilon(x_i)$$$$n_i=e^{-\alpha}e^{-\beta\varepsilon(x_i)}$$ To get $$e^{-\alpha}$$ , we take the sum over all the microstates ($$i$$) on both sides leaving us with :$$e^{-\alpha}=\frac{\displaystyle{\sum_{x_i}}n_i}{\displaystyle{\sum_{x_i}}e^{-\beta\varepsilon(x_i)}}=\frac{N}{\displaystyle{\sum_{x_i}}e^{-\beta\varepsilon(x_i)}}$$Clearly , putting it in the previous equation we get the Boltzmann distribution as in $$eq(1)$$ , through which by comparing we get:$$Z=\displaystyle{\sum_{x_i}}e^{-\beta\varepsilon(x_i)}$$Hence , proving that The partition function is the sum over all the microstates as mentioned earlier.

Now , back to our quadratic case and again using the $$eq(2)$$ but this time by integrating over the microstate variable , which in our case ( $$E=cq²$$ ) is $$q$$ , we get:$$\frac{dN}{N}=\frac{e^{\frac{-E}{k_BT}}dq}{\displaystyle{\int_0^∞}e^{\frac{-E}{k_BT}}dq}=\frac{e^{\frac{-cq²}{k_BT}}dq}{\displaystyle{\int_0^∞}e^{\frac{-cq²}{k_BT}}dq}$$Which gives the average energy in the quadratic energy distribution as:$$\bar{E}=\frac{\displaystyle{\sum_{i=1}^∞}\varepsilon(x_i)dN}{N}=\frac{\displaystyle{\int_0^∞}EdN}{N}=\frac{\displaystyle{\int_0^∞}cq²e^{\frac{-cq²}{k_BT}}dq}{\displaystyle{\int_0^∞}e^{\frac{-cq²}{k_BT}}dq}=\frac{k_BT}{2}\tag{4}$$ Which proves the equipartition theorem as in the second integral of the question.

## Average energy in Rayleigh - Jeans Radiation Law

In this distribution , the energy only depends on the frequency as $$E=hf$$ , so the microstate variable in this case is taken as $$f$$ , giving us : $$\frac{dN}{N}=\frac{e^{\frac{-E}{k_BT}}df}{\displaystyle{\int_0^∞}e^{\frac{-E}{k_BT}}df}=\frac{e^{\frac{-hf}{k_BT}}df}{\displaystyle{\int_0^∞}e^{\frac{-hf}{k_BT}}df}$$ Hence , the average energy , for this distribution is ( here , the energy is assumed to be continuous even in the quantum system , which was the main reason behind the Ultraviolet Catastrophe ) : $$\bar{E}=\frac{\displaystyle{\sum_{i=1}^∞}\varepsilon(x_i)dN}{N}=\frac{\displaystyle{\int_0^∞}EdN}{N}=\frac{\displaystyle{\int_0^∞}hfe^{\frac{-hf}{k_BT}}df}{\displaystyle{\int_0^∞}e^{\frac{-hf}{k_BT}}df}=k_BT$$ This could be written in terms of energy as in the first integral in the question as : $$\bar{E}=\frac{\frac{\displaystyle{\int_0^∞}hfe^{\frac{-hf}{k_BT}}d(hf)}{h}}{\frac{{\displaystyle{\int_0^∞}e^{\frac{-hf}{k_BT}}d(hf)}}{h}}=\frac{\displaystyle{\int_0^∞}Ee^{\frac{-E}{k_BT}}dE}{\displaystyle{\int_0^∞}e^{\frac{-E}{k_BT}}dE}=k_BT$$ Which , is clearly the first integral in the question and describes the average energy for Rayleigh - Jeans Radiation Law, which was later modified by Planck using the quantization of energy.

Actually , we could change the variable from $$q$$ to $$E$$ even for the quadratic distribution , noting : $$dE=d(cq^2)=2cq\cdot dq$$$$dq=\frac{dE}{2cq}=\frac{dE}{2\sqrt{cE}}\tag{5}$$ Then , average energy for Maxwell speed distribution with the integrating variable , $$E$$ , is ( using $$eq(4)$$ & $$eq(5)$$ ):

$$\bar{E}=\frac{\displaystyle{\int_0^∞}cq²e^{\frac{-cq²}{k_BT}}dq}{\displaystyle{\int_0^∞}e^{\frac{-cq²}{k_BT}}dq}=\frac{\displaystyle{\int_0^∞}Ee^{\frac{-E}{k_BT}}\frac{dE}{2\sqrt{cE}}}{\displaystyle{\int_0^∞}e^{\frac{-E}{k_BT}}\frac{dE}{2\sqrt{cE}}}$$Which gives: $$\bar{E}=\frac{\displaystyle{\int_0^∞}\sqrt{E}e^{\frac{-E}{k_BT}}dE}{\displaystyle{\int_0^∞}\frac{e^{\frac{-E}{k_BT}}}{\sqrt{E}}dE}=\frac{k_BT}{2}$$

To summarise :

1. Both the equations are in their own correct , according to their use in their respective distribution.
2. The general equation for the average energy for any distribution is the $$eq(3)$$ , based on their $$\frac{dN}{N}$$ accordingly.
3. And , as long as we change the integrating variable in the right way we get the same average energy for a particular distribution, which is obviously fair .
• If those $--(1)$ and $--(2)$ are supposed to be equation numbers, you can use \tag{1} or \tag{2} in the mathjax to insert right-adjusted numbers Commented Jun 1 at 18:38
• @KyleKanos Thanks , I was wondering there should be some code. Commented Jun 1 at 18:55

Both your results for the average energy are mathematically correct. They just relate to different things: the first is an average in energy space, the second is an average in velocity space (if you take $$q=v$$)

See http://hyperphysics.phy-astr.gsu.edu/hbase/Kinetic/molke.html for a detailed derivation in both cases.

You can of course replace $$E$$ with $$cq^2$$ in the first case as well, but then you would have to replace $$dE$$ with $$c \cdot d(q^2) = c\cdot 2q\cdot dq$$ also. This is where the factor 2 difference comes from.

For clarification consider the following simple example: if we have a step function with a value of $$f(q)=1$$ for $$0\le q \lt 1$$, $$2$$ for $$1\le q \lt 2$$, and $$3$$ for $$2\le q \lt 3$$ as shown in this diagram

then the average value $$\overline {f(q)} = ( \sum{_i} f(q_i)\cdot \Delta q_i) / \sum{_i} \Delta q_i = (1+2+3)/3 = 2$$.

If on the other hand you assign the same function values to $$q^2$$ instead of $$q$$, you have $$f(q^2)=1$$ for $$0\le q^2 \lt 1$$, $$2$$ for $$1\le q^2 \lt 4$$, and $$3$$ for $$4\le q^2 \lt 9$$

In this case the average $$\overline{f(q^2)} = ( \sum{_i} f(q^2_i)\cdot \Delta q^2_i) / \sum{_i} \Delta q^2_i = (1+2\cdot 3 +3\cdot 5)/9 = 22/9 = 2 \frac{4}{9}$$.

So it all depends whether one takes the average in velocity space (relating to $$q$$) or in energy space (relating to $$q^2$$). The resulting averages will in general differ from each other. It has as such nothing to do with the specific microstate variables, so it applies also for the kinetic energies of a gas. For the Maxwell-Boltzmann distribution they differ by a factor 2. If averaged in energy space the average kinetic energy is in this case $$kT$$, if averaged in velocity space, it is $$kT/2$$.

The question is though whether it makes any sense at all to average the energy in velocity space. It is for instance exactly the latter that leads to the paradoxical claim in the video the OP linked to that the equipartition theorem only applies to kinetic energies but not to atomic excitation energies (it is paradoxical as atomic excitations exactly happen by means of conversion of kinetic energies into atomic excitation energies in the course of collisions, so the inner-atomic energy distribution (given by the Boltzmann distribution) should be strictly related in a 1:1 manner to the kinetic energy distribution of the exciting particles).

• That makes sense ...but could you please tell me that if we plug $E=cq²$ in the first equation, won't it give $kT$ even though it is a continuous distribution...or does the equation treat it as a discrete distribution of energy and why ? Commented May 22 at 15:34
• @CPofPhysics The difference here is that in the first case you are evaluating the average value in energy space, integrating over $dE$ (as it would be appropriate for Planck's radiation law). In the second case you are evaluating the average in velocity space, integrating over $q$ (=$v$). You can of course replace $E$ with $cq^2$ in the first case as well, but then you would have to replace $dE$ with $c \cdot d(q^2) = c\cdot 2q\cdot dq$ also. This is where the factor 2 difference comes from. Commented May 22 at 21:42
• Thanks , it really helped. Commented May 23 at 7:48
• Could you please clarify it , even when I compute the first integral after taking $E=cq²$ and $dE=2cq \cdot dq$ i.e. $\frac{\int_0^∞2c²q³e^{-cq²/kT}dq}{\int_0^∞2cqe^{-cq²/kT}dq}$ , I still get the average energy to be $kT$. Can you tell me why the factor of two didn't came? Commented May 27 at 19:11
• @CPofPhysics Yes, you get $kT$ if you integrate over $dE=d(c\cdot q^2)$ but you get $kT/2$ if you integrate over $dq$ Commented May 28 at 20:07