The study of the relationship between heat, work, temperature and energy, now encompassing the general behavior of physical system is called thermodynamics.
A central consideration of thermodynamics is that any physical system, whether or not it can exchange energy and material with its environment, will spontaneously approach a stable condition (equilibrium) that can be described by specifying its properties, such as pressure, temperature, or chemical composition. If the external constraints are changed (for example, if the system is allowed to expand), then these properties will generally alter. The science of thermodynamics attempts to describe mathematically these changes and to predict the equilibrium conditions of the system. The first law of thermodynamics is often called the law of the conservation of energy (actually mass-energy) because it says, in effect, that, when a system undergoes a process, the sum of all the energy transferred across the system boundary–either as heat or as work–is equal to the net change in the energy of the system.
The second law of thermodynamics states that, in a closed system, the entropy does not decrease. Cars rust, dead trees decay, buildings collapse; all these things are examples of entropy in action, the spontaneous movement from order to disorder. There is one more influence of cosmological relationships upon macroscopic physics, which arises in connection with thermodynamics.
The existence of irreversible processes in thermodynamics indicates a distinction between the positive and negative directions in time. As Clausius recognized in the 19th century, this irreversiblity reflects a quantity, first defined by him, called entropy, which measures the degree of randomness evolving from all physical processes by which their energies tend to degrade into heat. Entropy can only increase in the positive direction of time. In fact, the increase in entropy during a process is a measure of the irreversiblity of that process.
The measure of entropy must be global. For example, you can pump heat out of a refrigerator (to make ice cubes), but the heat is placed in the house and the entropy of the house increases, even though the local entropy of the ice cube tray decreases.
In a closed system, entropy never decreases. In open systems, entropy can decrease in local regions (e.g., the ice tray), but an increase in order in the open system is always paid for by a decrease in order (decrease in entropy) somewhere else (e.g., the outside room). In the growth of crystals, for example, the ordered arrangement of ions in a lattice produces heat which flows away to the nearby environment.
Classical or Newtonian physics is incomplete because it does not include irreversible processes associated with the increase of entropy. The entropy of the whole Universe always increases with time. We are simply a local spot of low entropy and our destiny is linked to the unstoppable increase of disorder in our world => stars will burn out, civilizations will die from lack of power.
The approach to equilibrium is therefore an irreversible process. The tendency toward equilibrium is so fundamental to physics that the second law is probably the most universal regulator of natural activity known to science.
The concept of temperature enters into thermodynamics as a precise mathematical quantity that relates heat to entropy. The interplay of these three quantities is further constrained by the third law of thermodynamics, which deals with the absolute zero of temperature and its theoretical unattainability.
Absolute zero (approximately -273 C) would correspond to a condition in which a system had achieved its lowest energy state. The third law states that, as this minimum temperature is approached, the further extraction of energy becomes more and more difficult.