Is temperature an extensive property, like density? I was thinking about it some time ago, and now that I've discovered this site I would like to ask it here because I couldn't work it out then.
I know that the higher temperature the air in my room has, the more energy the molecules have. But temperature isn't energy because otherwise we'd be measuring temperature in joules, and we don't. And then temperature would depend on the number of molecules in the room, and that doesn't make any sense. So what I thought temperature had to be was the total energy that the molecules in the room have divided by something, for example the number of molecules or the volume of the room. If it was the latter, then temperature would be exactly like density, only with energy instead of mass. But in any case, I went to Wikipedia and tried to see if I could understand what they said about temperature. I didn't understand too much, but I saw that they used something called entropy to define temperature. I couldn't understand the article on entropy at all, but I think it means my thinking must have been incorrect because otherwise they would mention something simple like this in the article. Could you please explain it to me?
EDIT: Here's why I thought it should be the total energy divided by the volume rather than by the number of particles: because if we divided energy by a number, it would still be energy, and we measure energy in joules, not kelvins.
 A: Temperature is related to average energy per degree of freedom via the equipartition theorem. For example, as the kinetic energy is quadratic in the velocity and corresponds to three degrees of freedom (the three spatial directions), on average each molecule will have a kinetic energy of $\frac32k_BT$ where $k_B$ is the Boltzmann constant.
This means that temperature and energy are indeed intimately related (temperature can be considered a measure of average energy) and thus there are so-called natural systems of units which set $k_B=1$. This means that temperature will have the same unit as energy, eg electron volt in case of particle physics.
While the equipartition theorem probably provides the most intuitive visualization of temperature, it also has its problems: As Arnold Neumaier points out, it only holds under specific assumptions and in particular breaks down in case of non-ergodic systems or in cases where continuity is no longer a good approximation for quantized energy levels.
An example of such a system would be a non-atomic gas, which adds quantized internal degrees of freedom to the mix. The heat capacity of diatomic gases provides a good illustration for this as it can be derived classically via the equipartition theorem. A reasonably good explanation of the measurements is that 'quantum mechanical' degrees of freedom do not contribute at low temperatures and start approching the classical contribution as temperature increases. Rotational degrees of freedom contribute almost fully at room temperature, whereas the vibrational degrees of freedom only contribute for heavier molecules as the spacing of the vibrational energy levels depends on the reduced mass of the system.
A: In equilibrium, temperature and energy are rigorously related by the first law of thermodynamics. 
For one mole of a simple system (chemically homogeneous matter), the first law relates for arbitrary reversible processes the infinitesimal changes $dU$, $dS$, and $dV$ of the internal energy $U$, the entropy $S$ (a measure of microscopic complexity), and the volume $V$, respectively, by the differential equation $dU=TdS-PdV$, where the temperature $T$ and the pressure $P$ appear as factors. 
The term $TdS$ is the infinitesimal amount of heat generated or absorbed by the process, which gives some intuitive meaning for entropy as a suitably normalized measure of heat. The term $PdV$ is the infinitesimal amount of mechanical work done by or on the system. 
Thus temperature is an ''intensive'' quantity analogous to the pressure. Equilibrium is characterized by constancy of the intensive quantities. Just as pressure differences cause mechanical motion, so temperature differences cause heat flow.
In statistical mechanics, one learns how to express $U$ as a function $U=U(S,V)$ of $S$ and $V$ that depends on the microscopic structure of the material. Keeping $V$ constant (no mechanical work done), the first law implies $T=\partial U(S,V)/\partial S$; keeping $S$ constant (no heat exchange), the first law implies $P=\partial U(S,V)/\partial V$. 
For an ideal gas, exact formulas can be derived, leading to the ideal gas law, which say that $PV/T$ is a universal constant $R$ (independent of the composition of the gas).
A: Consider a huge number of particles, each one is characterized by its energy and velocity. The number is so great that one can not access the speed or energy of a test particle. Physicists have devised a mean to gain some information about this set of particles. They do average position, mass, momentum, energy, ... But to effectively compute this average one needs to know how many particles do have a specific energy. It is the same situation when you compute the average of your marks at school. You need to know how many tests you have got A, B, c, etc.. There is a function, called distribution function which precisely tells us how many particles do have a specific velocity. When the system is in equilibruium, this function depends on a parameter that can be identified with the temperature T. For equilibrium, the macroscopic temperature coincides with the average kinetic energy of a particle. Out of equilibrium temperature may not be unique or even defined.
o you get it right  for the most common case. For the unit, temperature at the microscopic scale always appears combined with kb, the Boltzmann constant, and is often given in eV (1 ev=1.6 10^-19 J)
