When heat is supplied to a body, it is generally used up in two ways:
If dQ is the heat energy supplied to a body, dU is the increase in its
internal energy and dW is the external work done by the body, then
dQ = dU + dW
The above expression represents the first law of thermodynamics. This expression denotes the relationship between heat and mechanical energy.
Steam engines and internal combustion engines use the first law of thermodynamics to perform mechanical work. Refrigerators are known as heat pumps. They function to remove heat and lower the temperatures.
The first law of thermodynamics is essentially a restatement of the law of conservation of energy i.e. energy can neither be created nor be destroyed but may be converted from one form to another. It is applicable to every process in nature and to all the three phases of matter i.e solid, liquid and gas.