The second law of thermodynamics is believed to be one of the most fundamental postulates of modern physics. Its most famous formulation is as the statement: the entropy of an isolated system never decreases; and it can be conveniently used as an excuse to never clean your room. This argument is ingeniously simple. Entropy of a macroscopic state is a measure of the number of possible corresponding microscopic configurations. In this case the macrostate is ‘a messy room’ and each microscopic configuration labels the positions of every object in that room such as the 10 books and a computer currently cohabiting your bed. Note that cleaning up a room involves ordering the objects in it. Since there are many possible configurations of these objects for which we say the room is messy but there may be only a small number of orderings for which we consider it clean; your efforts locally decrease the entropy of the room. However we know by the second law of thermodynamics that while we are doing the work to reordering the room we dissipate heat to the environment causing the universe to become more entropic globally; or in other words cleaning up your room contributes to the heat death of the universe and should only be undertaken at your own peril. Check out xkcd’s ideal room configuration.
This illustrates a perhaps more physical reinterpretation of the second law of thermodynamics; it is often restated as the impossibility of convert heat directly into work which ties into the following construction of a Heat engine. In this graphical representation we can see that not all the heat Q H transferred from the hot reservoir can be converted directly into useful work, only a fraction Q H – QC can be accessed; the remainder must be dissipated to the cold reservoir thereby increasing the entropy of the cold reservoir. If we could completely convert Q H directly into useful work then we could use this work to reduce the entropy (for example we could erase some information), at the same time we would have QC equal to zero so there would be no counterbalancing increase in the entropy of the cold reservoir. This would lead to a global entropy decrease thereby violating the second law. In our example of a messy room we realize that you are functioning as the hot reservoir and the universe (empty space has a temperature of about 3 Kelvin) is functioning as the cold reservoir. We can clearly see that it is sensible to define the amount of useful work which can be extracted from a system a concept called the Helmholtz free energy F. Making it possible to succinctly summarize everything we have said above by the statement that the change in Helmholtz free energy of the system can be at most equal to the average work done on a system: <W> ≥ ΔF. The averaging over the work distribution in this statement arises because in finite systems we can have quite large statistical fluctuations. This is an extremely powerful statement and a key tool in many active fields of research particularly in its relation to Szilard engines and generalized forms of the second law like Jarzynski equality which extends the second law of thermodynamics (relationship between free energy and work) to higher moments of the work distribution (the average work is the first moment).