second law of thermodynamics
French military engineer Nicolas Léonard Sadi Carnot laid the foundations for the second law of thermodynamics in his book Reflections on the Motive Power of Fire (1824). Carnot was postulating an ideal heat engine (one that converts thermal energy to mechanical work) to show how such a machine could achieve maximum efficiency. But he realized that no actual engine could ever attain the reversibility of motion of the ideal. Since all actual processes inevitably generate heat, relative to the external environment. Carnot had recognized a fundamental paradox: the laws of physics are reversible, but this law was not.
English physicist James Joule, fascinated by electricity and working to improve the efficiency of his industry, decided in 1834 that heat and mechanical work are essentially related. An exchange of letters with Belfast-born mathematician and physicist William Thomson (Lord Kelvin) led the latter to coin the term "thermodynamics" in 1849. Meanwhile, German physicist Rudolf Clausius, after reading Carnot, spent fifteen years formulating his mechanical theory of heat. In 1854, he reformulated the second law: "The entropy of the universe tends to a maximum."
A simple example
A simple, everyday statement of the second law is that it is impossible for heat to flow 'uphill' of its own accord. If a pan of boiling water is put into contact with a pan containing ice, then the boiling water cools, while the ice melts and becomes warmer. Heat is exchanged between the boiling water and the ice, but more heat flows from the water to the ice than from the ice to the water.
One balance, the heat flow is always 'downhill' from the object at a higher temperature to the one at a lower temperature. It is impossible for heat of its own accord (in classical physics at least), to flow 'uphill', i.e., from something colder to something hotter.
The zeroth and first laws
Before we get to the second law, thermodynamics (the branch of physics which deals with moving quantities of heat from one place to another and with changing heat energy into energy of a different) also has what are the zeroth and first laws. The zeroth law of thermodynamics defines what is meant by temperature. The first law of thermodynamics says that if we have a certain amount of heat energy, we may be able to convert it into a different kind of energy, but whatever we do to it, it will be impossible to lose it all together.
Where the second law fits in
When there is a certain amount of energy held by two objects at different temperatures, then the second law governs the direction of flow of the heat energy from one object to the other. Thermodynamics is essentially a series of mathematical tricks, and there are many other ways of stating the second. For example, Clausius' formulation of the second law states that heat cannot be transferred from a colder to a hotter body without some other effect, i.e. without work being done. Corollaries include the impossibility of converting heat entirely into work without some other effect, and the impossibility of perpetual motion machines of the second kind. However, all the different formulations boil down to the simple statement that it is impossible for heat to flow 'uphill' of its own accord.
The second law and the refrigerator
In a domestic refrigerator, heat is made to flow uphill. Heat must be absorbed from the freezing compartment, the coldest place in the refrigerator. It is extracted from a cold place, and given up to a warmer place, the air surrounding the refrigerator. But the heat is unable to do this by itself. In most domestic refrigerators (those of the vapor compression type) the heat flows 'uphill', from cold to warm, is assisted by an electric motor, while the heat itself is carried by a vapor in the pipes. So energy is used up (by the motor) when the heat is transferred.
The vapor is allowed to condense, and then it is allowed to expand suddenly. As it expands, it cools, until its temperature is below the temperature of the coldest part of the freezing compartment. Only then can it extract heat from the freezing compartment, for in accordance with the second law, heat can flow only to a colder object. After this, the vapor is compressed by the motor. Its temperature rises again, and it can now get rid of its heat to the air outside. Then it is expanded, cooled, and the whole cycle repeats itself continuously.
It would be far simpler to make a refrigerator is the second law were untrue. If, for example, heat could be made to flow, of its own accord, from the pan of ice to the pan of boiling water, then the ice would automatically become colder, and the boiling water would boil more furiously. Heat extracted from the ice could be put to good use in boiling the water. Refrigerators would need neither moving parts nor moving liquids.
Unfortunately, this is out of the question and its impossibility is the main evidence in support of the second law.