In physics, the first law of thermodynamics deals with energy conservation. One of the forms of energy involved is the internal energy that resides in the motion of the atoms and molecules (vibrations and random jostling). Another of the terms in this law is heat, which is a transfer of thermal energy. And finally, there is work, which is a transfer of mechanical energy; for example, work is done on a gas when it is compressed. The first law of thermodynamics states that these energies, together, are conserved. The initial internal energy in a system, Ui, changes to a final internal energy, Uf, when heat, Q, is absorbed or released by the system and the system does work, W, on its surroundings (or the surroundings do work on the system), such that

Q is positive if heat flows into the system, and W is positive if the system does work on its surroundings. For mechanical energy to be conserved, you have to work with systems where no energy is lost to heat — there could be no friction, for example. All that changes now. Now you can break down the total energy of a system, which includes heat, work, and the internal energy of the system.

These three quantities — heat, work, and internal energy — make up all the energy you need to consider. When you add heat, Q, to a system, and that system doesn’t do work, the amount of internal energy in the system, which is given by the symbol U, increases by Q. A system can also lose energy by doing work on its surroundings, such as when an engine lifts weight at the end of a cable. When a system does work on its surroundings and gives off no waste heat, its internal energy, U, decreases by W. In other words, you’re in a position to think in terms of heat as energy, so when you take into account all three quantities — heat, work, and the internal energy — energy is conserved.

The first law of thermodynamics is a powerful one because it ties all the quantities together. If you know two of them, you can find the third.