For an introduction of Second law of Thermodynamics read this:
If you want to study any subject you must first define what you
mean. There are two definitions:
1) One simple statement of the law is that heat always moves from
hotter objects to colder objects (or "downhill"), unless energy is
supplied to reverse the direction of heat flow.
(Text copied from Wikipedia)
2) The second definition starts from an experiment:
We start with an empty container. We place a divider in the container.
One half we fill with hot water and one half with cold water.
We remove the divider. We measure with a thermometer the water
and we observe what happens.
Initial the water temperature on one side is higher than on the
other side, but slowly this difference decreases and after a certain
time this difference disappears and the temperature becomes in
equilibrium. What is also possible that there after the average
temperature of the container slower drops.
This process we call the Second Law of Thermodynamics.
The physical explanation is that two water molecules in close contact
exchange heat from the hotter molecule towards cooler molecule, such
that the hotter one becomes cooler and the cooler one becomes hotter.
Someone could claim that the result of both definitions is the same.
That is true. But the second definition is more complete; you
should always start with an experiment.
With an experiment you can also establish the following rules.
When you want to increase the average temperature, you have to add
more hot water.
When you want to decrease the average temperature, you have to add
more cold water.
For an introduction of Maxwell's demon read this:
Also, in this case there are two definitions:
1) In the thought experiment, a demon controls a small massless
door between two chambers of gas. As individual gas molecules
(Or atoms) approach the door, the demon quickly opens and closes
the door to allow only fast-moving molecules to pass through in
one direction, and only slow-moving molecules to pass through
in the other.
Etc. the demon's actions cause one chamber to warm up and the
other to cool down.
2) The purpose of the experiment to cool down chamber A
and to heat up chamber B. To do that the experimenter has to take
A1) To select the molecule with the highest temperature in chamber A
and transport this molecule to chamber B.
A2) To select the molecule with the lowest temperature in chamber B
and transport this molecule to chamber A
Both these molecules have to be exchanged 'simultaneous'.
As a result of this action the average temperature in chamber A will
decrease and in chamber B will increase.
B1) The two actions should stop when in (A1) the temperature of the
molecule with the highest temperature in chamber A is lower than
the average temperature in B.
B2) The same when in (A2) the temperature of the molecule with the
lowest temperature in chamber B is higher than the average
temperature in A.
The problem is that as part of the two actions A1 and A2 each time
it becomes more difficult to decide which molecules to select.
To state this more realistic: that more energy is involved.
Each of the two actions requires energy.
The conclusion of this experiment is in contradiction with
definition 1 of maxwell's demon.
When you combine the two experiments the situation becomes:
Considering two chambers with different temperatures, combining
these two gives one chamber with the average temperature.
This process evolves without 'any' effort.
In a second phase, trying to go back to the original situation
costs a lot of effort. This is because specific molecules in
A have to be selected to be transported to B and vice versa.
This process will stop before the original situation is reached.
To reach the original situation extra energy is required.