# Energy of a photon gas: two ways to get it, two different answers

1. Apr 2, 2009

### Pacopag

1. The problem statement, all variables and given/known data
I've been asked to calculate the energy of a photon gas in terms of the temperature. Assume non-interacting.
I'll spare the details, unless someone would like to see them, because the calculations can be found in most textbooks. Here's the problem:
When I do it using the partition function with Hamiltonian H = pc, I get
$$E = 3NkT$$
where N is the number of photons, k is Boltzmann's constant, and T is temperature.
When I do it by finding the density of states, i get
$$E \propto VT^4$$
The first expression agrees with the equipartition theorem, but the second expression is the stefan-boltzmann law. So what the heck is going on here?

2. Relevant equations

3. The attempt at a solution

Last edited: Apr 2, 2009
2. Apr 2, 2009

### Pacopag

I think I found the answer on Wikipedia under "Photon Gas." It seems that the number of photons is not fixed as in an ideal gas, and that
$$N \propto VT^3$$.
That gives the consistency I'm looking for.

3. Apr 3, 2009

### turin

Not exactly. Perhaps some integrated version of.

EXCELLENT!

Why do you think that the number of photons in an ideal gas is fixed? Grand canonical ensemble.

Indeed, you are deriving this from stat mech, relativity, and (a bastardized version of) QM.