In its simplest form, the second law of thermodynamics states that the entropy of a closed system never decreases. Entropy is defined as a quantity such that the rate of change of entropy of a system during a reversible change is equal to the rate of influx of heat divided by the temperature at the boundary between the system and the outside world.
Entropy also has a statistical definition – it is proportional to the logarithm of the number of micro-states corresponding to the observed macro-state, the macro-state being defined by the value of some macroscopically observable quantity. The scientist Ludwig Boltzmann is famous for identifying these two definitions. Boltzmann's constant is the constant that has to be introduced to make them mathematically identical.
It has been claimed that evolution by natural selection results in a decrease in the entropy of the genome, and thus breaks the second law. Can we equate some quantity that decreases during evolution with entropy?
A reasonable identification is as follows: the degree of fitness is a macroscopic variable, and each range of values corresponds to some number of micro-states of the genome. Each possible value that a genome can take, for example, every set of possible DNA base sequences of a set of chromosomes, subject perhaps to some probability distribution on overall chromosome lengths, is one micro-state. It seems plausible, although perhaps difficult to prove rigorously, that there are smaller sets of micro-states corresponding to macro-states of greater fitness. This allows us to interpret fitness as a macroscopic quantity such that entropy is a function of fitness, and greater fitness corresponds to lower entropy.
Stated in the form that entropy never decreases, the second law only applies to closed systems. It is often observed that life evolves in a world that is not a closed system, so that the second law does not apply. However a rigorous analysis should demand that we determine that it is not even possible in principle for evolution by natural selection to break the second law. At which point we must perform a strange and perhaps gruesome thought experiment.
But first a reconsideration of the second law. It is stated as an absolute prohibition against a decrease in entropy in a closed system, but entropy is defined as a statistical quantity, in particular the logarithm of a probability. On closer investigation, we find that the degree of prohibition relates to the probability in question. In considering macroscopic changes in entropy on the scale of everyday life, the probability corresponding to an observable decrease in entropy is so tiny that it is indistinguishable from zero.
A simple example may clarify this point. Consider a box that can be divided into two halves by a frictionless sliding partition, and which contains a certain number of molecules of ideal gas. If the partition is closed, and all the molecules are on one side, and then we open the partition, then eventually the molecules will be almost evenly divided between the two sides. If they start out evenly divided between the two sides with the partition closed and then we open the partition, all that we observe is that they continue to be evenly divided. The journey from uneven distribution to even distribution appears to be a one way trip. Yet the basic laws of physics that describe the molecular motions and interactions are symmetrical in time.
I understand that a fully rigorous explanation of why the second law applies eludes even expert mathematicians and physicists, but the following hand-waving explanation gives the right result: assume that the all possible micro-states are equally likely as end results, where a micro-state is a set of possible positions and energies of the molecules (and the total energy is fixed). Now define the macroscopic variable to be the degree of uneven-ness of distribution of molecules between the two sides of the box. It turns out that almost all the micro-states are contained in macro-states in which the distribution is very close to 50/50.
Without going into complicated mathematics, we can consider the entropy of the most unevenly distributed state where all the molecules are on one side. The probability of this happening is simply 2-n where n is the number of molecules. A typical box of gas might contain n = 1023 molecules, in which case 2-n is an unimaginably small number. Even 2-1000 is such a small number that we can state with certainty that we will never observe an event that has a probability that size. But if n is a very small number, like 5, then 2-n is equal to a bit more than 3 per cent, and such a probability is not at all unimaginable. If we had a box with 5 molecules in it, and suddenly closed the partition, and looked on one particular side, and observed that all of the 5 molecules were indeed on that side, we might be a bit surprised, but we would not regard it as proof that a miracle had occurred. In fact it would not be hard to perform such an experiment a sufficient number of times such that eventually the desired event would be observed.
We seem to have opened a crack in the door. Entropy is allowed to decrease in a closed system, but only by a very tiny amount. Even this little loophole caused consternation among scientists when it was discovered. If you can break a law a little bit, and do so any number of times, then you end up breaking it a lot. James Clerk Maxwell envisaged a system for accumulating tiny changes in entropy, involving a demon, and a box partitioned into two halves separated by a small frictionless door operated by the demon. His example involved separating hot and cold molecules, but I will alter it slightly to deal with the problem of a partitioned box where we hope to get all the molecules on one side of the partition.
The demon knows which side of the box the molecules are to be collected in, for example the left side. When it sees a molecule approaching the door from the right side, it opens the door and lets it in. When it sees a molecule approaching the door from the left side, it shuts the door, and the molecule bounces off the door (with no loss of energy) and stays on the left side. This way, eventually all the molecules will be accumulated on the left side.
Can this system be made to work? There are of course no such things as demons in real life, or if there are, we don't know how to get them to volunteer for this kind of work. But there is a subtle difficulty that arises, given any physically possible mechanism that performs the demon's work: the laws of physics are reversible, and in particular, this means the operation of detecting a molecule on the right, opening the door, letting it through and shutting it, must be reversible. But a reversal of this operation is opening the door to a molecule coming in from the left and letting it out to the right side, which was not meant to happen. Something has to be added to the mechanism to make it irreversible.
But now we come up against the converse of the second law. The second law effectively says that any change that increases entropy in a close system is irreversible, so that a decrease in entropy cannot occur. The converse states that a change can only be irreversible if it involves an increase in entropy. So that if we add something to the door to make its operation reversible, this something will have to increase entropy in some way, and we will have failed to decrease the overall entropy of the system.
But enough of demons, what about evolution? Well, evolution by natural selection is normally understood to involve two processes. The first is small random changes in the genome, called mutations, and the second process is natural selection, by which changes in the genome may result in increased or decreased reproductive success, and changes that result in increased reproductive success tend to become more common in the population. (It is a slight simplification to consider only point mutations, but this does not affect the logic of the discussion.)
Whether or not real-world mutations occur by reversible processes, it is certainly possible in principle for mutations to be reversible, and there is no requirement in the theory of evolution for them not to be so.
We can see that evolution described this way is very much like Maxwell's demon. Reversible point mutations are like the motions of individual molecules through the small door, and natural selection is like the demon that keeps the changes that move towards decreased entropy and throws away (or prevents) those that result in increased entropy. And it must be impossible for natural selection to break the second law of thermodynamics in the large for the same reason that Maxwell's demon cannot do so: because the selection process cannot be effective if it does not occur by irreversible processes.
In practice, increased reproductive success results from increased birth rates and decreased death rates. And both birth and death are normally irreversible processes. (I said that we were going to do a gruesome thought experiment, and now is the time.) If birth and death were not irreversible, what would happen to evolution by natural selection? Well, those mutations that died less often would also un-die less often (i.e. the dead would come to life), and those mutations that reproduced more efficiently would also un-reproduce more efficiently (i.e. babies would crawl back into their mothers' wombs and un-grow back into embryos, which would finally unfertilise back into separate eggs and sperm). In either case the supposedly fitter mutations would not actually have greater reproductive success. So the fitter mutations would not become more common in the population, and evolution as we know it would not occur, and the entropy of the genomes would not be continuously decreasing. In fact it would only increase, as the eventual result of point mutations would be to completely randomise the genomes being mutated.
So that's it. Maxwell's demon isn't just a figment of a scientist's imagination; it was here all the time, slowly and steadily decreasing the entropy of our genome and those of all other living organisms. And we couldn't file a patent on it as a method to produce a perpetual motion machine (of the "second kind"), not even if we could find a way to raise the dead and un-birth the living. And what seems like a silly question, raised by people whose motives have little to do with increasing scientific understanding of the world, turns out to have an answer both deep and subtle.
See also: a note on "The Evolution of biological complexity".