The thermodynamic concept of temperature is defined by the following equation:

$$ T = \frac{\partial E}{\partial S} $$

where $ E $ is the energy of the system and $ S $ is the entropy. Now usually when the energy of a system increases or decreases it’s disorder, and hence it’s entropy, also increases or decreases. In such cases temperature is a positive quantity. However if this does not happen, i.e. if an increase of total energy of the system is accompanied by a *decrease* in the entropy, then the temperature defined as above would be a negative quantity.

Such systems do exist in Nature. One example is that of “population inversion” in a gas of atoms, such as the kind that are used to power lasers. Such a gas is first “pumped up” by irradiating it with radiation of a fixed frequency corresponding to a particular electronic transition of the has atoms or molecules. When almost all the atoms are in the excited state, light of a different frequency is used to “stimulate” emission of photons from the atoms by causing them to deexcite due to a transition to a lower state with an associated change in energy corresponding to the frequency used for de-excitation.

When one atom is de-excited and emits a photon at this second frequency, that photon hits another atom can causes it to similarly de-excite and release another photon. Now we have two photons of exactly the same frequencies. The process repeats and a cascade effect occurs because in each step the total number of photons in the gas is doubled. This radiation is very sharply peaked at the given frequency and is also coherent. This is the mechanism behind a laser.

Now, when the pumping process is first happening, the total energy of the gas is increasing as each atom gains an energy $\Delta E_1$. The maximum possible change in energy of the gas is $N \Delta E_1$, where $N$ is the total number of atoms. Now as all the atoms reach this excited level, the total energy of the is increasing. However, the entropy, as measured by the spread of the number of atoms occupying different energy levels, is decreasing. Consequently, the temperature as defined previously will be a negative quantity!

This phenomenon will occur in any system which has an upper bound for the maximum energy the system can have. As the system is pumped up and reaches a stage where the number of subsystems (gas atoms in the case of a laser) in the highest energy level becomes equal to or greater than half the total number of subsystems, the temperature will first cross zero from above and then become more and more negative.

One can show that the concept of negative temperature is perfectly consistent with the usual thermodynamic laws as long as the laws are also made “negative” for negative temperatures. I.e. if two systems at negative temperature are brought into contact, then heat will flow from the more lower temperature system to the higher temperature system.

This might appear contrary to what happens with positive temperature systems, and one might think that the second law is being violated. However one can easily see that when heat flows from asystem with a temperature $-T_1$ to a system with temperature $-T_2$, where $-T_1 < -T_2$, the entropy of the combined system will increase. Thus the second law remains valid as long as the sense of flow of heat is always from the temperature which is farther away from zero (either positive or negative) to a temperature which is closer to zero.