The study of energy is called thermodynamics. Thermodynamics describes how different forms of energy relate to each other and how they interconvert. Energy exists as several forms, such as heat, sound etc. Thermodynamics describe how these forms of energy behave in a thermodynamic system. There are four thermodynamic laws. Out of these, the second law was the first to be discovered. It was discovered by Sadi Carnot in 1824.
The zeroth law of thermodynamics states that if two systems are in equilibrium with a third system, they are also in equilibrium with each other. To make it easy to understand, think that A in equilibrium with C and B is also in equilibrium with C. This automatically makes A and B to be in equilibrium with each other. This law was established as a law after the other laws. But later it was appreciated that this law was the fundamental to other laws and then it was named as the zeroth law.
The first law of thermodynamics describes that energy cannot be created or destroyed, but it can be converted from one form to another. For example, think that a certain system is provided with a certain amount of heat and the system does an amount of work. In such case the change in internal energy equals the difference between the amount of heat given and the work done. The total amount of energy remains constant all the time. This is referred to as conservation of energy.
The second law of thermodynamics describes the phenomenon of reversibility and irreversibility of a process. It states that when one state is converted to another, the potential energy of the latter is always less than the former. This happens because some of the energy is lost as heat during the conversion. So, it is impossible to transfer heat from a cool body to a hot body without adding energy from outside. This is also known as entropy. According to this theory, perpetual motion machines do not exist. Perpetual motion machines are machines that work indefinitely when started. But, this is impossible because there is always a quantity of lost energy, so users will always have to keep on fueling the machine for it to run.
The third law of thermodynamics states that it is impossible to cool a system to a temperature of zero. Therefore, all entropy is to have a positive value. According to this, the entropy of a crystal of an element reaches zero as the temperature is also reduced down to the absolute zero.