Thermodynamics studies the laws governing the conversion of heat into work and vice versa, dealing with macroscopic systems described by state variables such as pressure, volume and temperature. Two systems are in thermal equilibrium when they have the same temperature. The zeroth law of thermodynamics states that if two systems are each in thermal equilibrium with a third, they are in equilibrium with each other, which justifies temperature as a property. Heat and work are both forms of energy in transit; the internal energy of a system is a state variable. The first law of thermodynamics,
, is the principle of conservation of energy applied to heat. Specific heats at constant pressure and constant volume differ by
for an ideal gas. Thermodynamic processes include isothermal, adiabatic, isochoric and isobaric changes. The second law of thermodynamics expresses the one-way nature of heat flow: heat cannot flow spontaneously from a colder to a hotter body (Clausius), and no engine can convert heat completely into work (Kelvin-Planck). Processes are reversible or irreversible, and the Carnot engine, operating between two temperatures, has the maximum possible efficiency
, independent of the working substance.