The first law of thermodynamics is a form of law of conservation of energy applied to
a system. Mathematically it can be written as
where Q is heat energy, U is the change in the internal energy and W is work done.
Q is positive if heat is supplied to the system and negative if it is removed from the
system. U is positive if there is increase in internal energy and negative if there is
decrease in internal energy of the system. Work done W is positive if work is done
by the system (during expansion) and negative if work is done on the system (during
contraction). The heat energy supplied to a system can be used for increasing its
internal energy and for doing work.