Temperature in gases
For an ideal gas the kinetic theory of gases uses statistical mechanics to relate the temperature to the average kinetic energy of the atoms in the system. This average energy is independent of particle mass, which seems counter-intuitive. Temperature is related only to the average kinetic energy of the particles in a gas - each particle has its own energy which may or may not correspond to the average; the distribution of energies (and thus speeds) of the particles in any gas are given by the Maxwell-Boltzmann distribution. The temperature of a classical ideal gas is related to its average kinetic energy via the equation[4]:
, where k = R / n (n= Avogadro number, R= ideal gas constant). This relation is valid in the classical regime, i.e. when the particle density is much less than 1 / Λ3, where Λ is the thermal de Broglie wavelength.
In the case of a monoatomic gas, the kinetic energy is:

(Note that a calculation of the kinetic energy of a more complicated object, such as a molecule, is slightly more involved. Additional degrees of freedom are available, so molecular rotation or vibration must be included.)
The second law of thermodynamics states that any two given systems when interacting with each other will later reach the same average energy per particle (and hence the same temperature). In a mixture of particles of various mass, the heaviest particles will move more slowly than lighter counterparts, but will still have the same average energy. A neon atom moves slower relative to a hydrogen molecule of the same kinetic energy; a pollen particle moves in a slow Brownian motion among fast moving water molecules, etc. A visual illustration of this from Oklahoma State University makes the point more clear. Particles with different mass have different velocity distributions, but the average kinetic energy is the same because of the ideal gas law.
Temperature of vacuum
It is possible to use the zeroth law definition of temperature to assign a temperature to something not normally associated with temperatures, like a perfect vacuum. Because all objects emit black body radiation, a thermometer in a vacuum away from thermally radiating sources will radiate away its own thermal energy; decreasing in temperature indefinitely until it reaches the zero-point energy limit. At that point it can be said to be in equilibrium with the vacuum and by definition at the same temperature. A gas that behaved ideally all the way down to absolute zero, obeying the kinetic theory of gases, would achieve zero kinetic energy per particle, and thereby achieve absolute zero temperature. Thus, by the zeroth law a perfect, isolated vacuum is at absolute zero temperature. Note that in order to behave ideally in this context it is necessary for the atoms of the gas to have no zero point energy. It will turn out not to matter that this is not possible because the second law definition of temperature will yield the same result for any unique vacuum state.
More realistically, no such ideal vacuum exists. For instance a thermometer in a vacuum chamber which is maintained at some finite temperature (say, chamber is in the lab at room temperature) will equilibrate with the thermal radiation it receives from the chamber and with time reaches the temperature of the chamber. If a thermometer orbiting the Earth is exposed to sunlight, then it equilibrates at the temperature at which power received by the thermometer from the Sun is exactly equal to the power radiated away by thermal radiation of the thermometer. For a black body this equilibrium temperature is about 281 K (+8 °C). Since Earth has an albedo of 30%, average temperature as seen from space is lower than for a black body, 254 K, while the surface temperature is considerably higher due to the greenhouse effect.
A thermometer isolated from solar radiation (in the shade of the Earth, for example) is still exposed to thermal radiation of Earth - thus will show some equilibrium temperature at which it receives and radiates equal amount of energy. If this thermometer is close to Earth then its equilibrium temperature is about 236 K (-37 °C) provided that Earth surface is at 281 K.
A thermometer far away from the Solar system still receives Cosmic microwave background radiation. Equilibrium temperature of such thermometer is about 2.725 K, which is the temperature of a photon gas constituting black body microwave background radiation at present state of expansion of Universe. This temperature is sometimes referred to as the temperature of space. This temperature is thus like a test charge in that it facilitates a measure of the system even though temperature is not strictly defined there.
Definitions
Phenomenological definition based on second law of thermodynamics
In the previous section temperature was defined in terms of the Zeroth Law of thermodynamics. It is also possible to define temperature in terms of the second law of thermodynamics, which deals with entropy. Entropy is a measure of the disorder in a system. The second law states that any process will result in either no change or a net increase in the entropy of the universe. This can be understood in terms of probability. Consider a series of coin tosses. A perfectly ordered system would be one in which either every toss comes up heads or every toss comes up tails. This means that for a perfectly ordered set of coin tosses, there is only one set of toss outcomes possible: the set in which 100% of tosses came up the same.
On the other hand, there are multiple combinations that can result in disordered or mixed systems, where some fraction are heads and the rest tails. A disordered system can be 90% heads and 10% tails, or it could be 98% heads and 2% tails, et cetera. As the number of coin tosses increases, the number of possible combinations corresponding to imperfectly ordered systems increases. For a very large number of coin tosses, the combinations to ~50% heads and ~50% tails dominates and obtaining an outcome significantly different from 50/50 becomes extremely unlikely. Thus the system naturally progresses to a state of maximum disorder or entropy.
It has been previously stated that temperature controls the flow of heat between two systems and was just shown that the universe tends to progress so as to maximize entropy (this is expected of any natural system). Thus, it is expected that there is some relationship between temperature and entropy. To find this relationship, the relationship between heat, work and temperature is first considered. A heat engine is a device for converting heat into mechanical work and analysis of the Carnot heat engine provides the necessary relationships. The work from a heat engine corresponds to the difference between the heat put into the system at the high temperature, qH and the heat ejected at the low temperature, qC. The efficiency is the work divided by the heat put into the system or:
(2)
where wcy is the work done per cycle. The efficiency depends only on qC/qH. Because qC and qH correspond to heat transfer at the temperatures TC and TH, respectively, qC/qH should be some function of these temperatures:
(3)
Carnot's theorem states that all reversible engines operating between the same heat reservoirs are equally efficient. Thus, a heat engine operating between T1 and T3 must have the same efficiency as one consisting of two cycles, one between T1 and T2, and the second between T2 and T3. This can only be the case if:

Since the first function is independent of T2, this temperature must cancel on the right side, meaning f(T1,T3) is of the form g(T1)/g(T3) (i.e. f(T1,T3) = f(T1,T2)f(T2,T3) = g(T1)/g(T2)· g(T2)/g(T3) = g(T1)/g(T3)), where g is a function of a single temperature. A temperature scale can now be chosen with the property that:
(4)
Substituting Equation 4 back into Equation 2 gives a relationship for the efficiency in terms of temperature:
(5)
Notice that for TC = 0 K the efficiency is 100% and that efficiency becomes greater than 100% below 0 K. Since an efficiency greater than 100% violates the first law of thermodynamics, this implies that 0 K is the minimum possible temperature. In fact the lowest temperature ever obtained in a macroscopic system was 20 nK, which was achieved in 1995 at NIST. Subtracting the right hand side of Equation 5 from the middle portion and rearranging gives:

where the negative sign indicates heat ejected from the system. This relationship suggests the existence of a state function, S, defined by:
(6)
where the subscript indicates a reversible process. The change of this state function around any cycle is zero, as is necessary for any state function. This function corresponds to the entropy of the system, which was described previously. Rearranging Equation 6 gives a new definition for temperature in terms of entropy and heat:
(7)
For a system, where entropy S may be a function S(E) of its energy E, the temperature T is given by:
(8)
i.e. the reciprocal of the temperature is the rate of increase of entropy with respect to energy.
Definition by statistical mechanics
The argument in the previous section is how the relation between entropy and heat was arrived at historically. Modern definition of temperature is given in Statistical mechanics and it is defined in terms of the fundamental degrees of freedom of a system (see the article entropy for details). Eq.(8) of the previous section is then taken to be the defining relation of the temperature. Eq. (7) can be derived from the definition of entropy, see e.g. here.
Generalized temperature from single particle statistics
It is possible to extend the definition of temperature even to systems made of few particles, like in a quantum dot. The generalized temperature is obtained by considering time ensembles instead of configuration space ensembles given in Statistical mechanics in the case of thermal and particle exchange between a small system of fermions (N even less than 10) with a single/double occupancy system. The finite quantum grand partition ensemble[5], obtained under the hypothesis of ergodicity and orthodicity, allows to express the generalized temperature from the ratio of the average time of occupation τ1 and τ2 of the single/double occupancy system [6]:

where EF is the Fermi energy which tends to the ordinary temperature when N goes to infinity.
Zeroth Law of Thermodynamics
If two systems with fixed volumes are brought together in thermal contact, changes will most likely take place in the properties of both systems. These changes are caused by the transfer of heat between the systems. A state must be reached in which no further changes occur, to put the objects into thermal equilibrium.
A basis for the definition of temperature can therefore be obtained from the Zeroth Law of Thermodynamics which states that if two systems, A and B, are in thermal equilibrium and a third system C is in thermal equilibrium with system A then systems B and C will also be in thermal equilibrium (being in thermal equilibrium is a transitive relation; moreover, it is an equivalence relation). This is an empirical fact, based on observation rather than theory. Since A, B, and C are all in thermal equilibrium, it is reasonable to say each of these systems shares a common value of some property. This property is called temperature.
Generally, it is not convenient to place any two arbitrary systems in thermal contact to see if they are in thermal equilibrium and thus have the same temperature. Also, it would only provide an ordinal scale.
Therefore, it is useful to establish a temperature scale based on the properties of some reference system. Then, a measuring device can be calibrated based on the properties of the reference system and used to measure the temperature of other systems. One such reference system is a fixed quantity of gas. The ideal gas law indicates that the product of the pressure and volume (P · V) of a gas is directly proportional to the temperature[4]:
(1)
where 'T is temperature, n is the number of moles of gas and R is the gas constant. Thus, one can define a scale for temperature based on the corresponding pressure and volume of the gas: the temperature in kelvins is the pressure in pascals of one mole of gas in a container of one cubic metre, divided by 8.31... In practice, such a gas thermometer is not very convenient, but other measuring instruments can be calibrated to this scale.
The pressure, volume, and the number of moles of a substance are all inherently greater than or equal to zero, suggesting that temperature must also be greater than or equal to zero. As a practical matter it is not possible to use a gas thermometer to measure absolute zero temperature since the gasses tend to condense into a liquid long before the temperature reaches zero. It is possible to extrapolate how many degrees below the present temperature the absolute zero is from the temperature range where Equation 1 works.
| Effect of temperature |
| Temperature | Speed of sound | Density of air | Acoustic impedance |
in °C | c in m·s−1 | ρ in kg·m−3 | Z in N·s·m−3 |
| −25 | 315.8 | 1.423 | 449.4 |
| −20 | 318.9 | 1.395 | 444.9 |
| −15 | 322.1 | 1.368 | 440.6 |
| −10 | 325.2 | 1.342 | 436.1 |
| −5 | 328.3 | 1.317 | 432.0 |
| 0 | 331.3 | 1.292 | 428.4 |
| +5 | 334.3 | 1.269 | 424.3 |
| +10 | 337.3 | 1.247 | 420.6 |
| +15 | 340.3 | 1.225 | 416.8 |
| +20 | 343.2 | 1.204 | 413.2 |
| +25 | 346.1 | 1.184 | 409.8 |
| +30 | 349.0 | 1.164 | 406.2 |
| +35 | 351.9 | 1.146 | 403.3 |
Specific heat
Specific heat is the measure of the energy required to increase the temperature of a unit quantity of a substance by a unit of temperature. For example, the energy required to raise water’s temperature by one kelvin (equal to one degree Celsius) is 4186 J/kg.