In physics, the first law of thermodynamics deals with energy conservation. The law states that internal energy, heat, and work energy 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

The most confusing part about using this equation is figuring out which signs to use. The quantity Q (heat transfer) is positive when the system absorbs heat and negative when the system releases heat. The quantity W (work) is positive when the system does work on its surroundings and negative when the surroundings do work on the system.

To avoid confusion, don’t try to figure out the positive or negative values of every mathematical quantity in the first law of thermodynamics; work from the idea of energy conservation instead. Think of values of work and heat flowing out of the system as negative:

Say that a motor does 2,000 joules of work on its surroundings while releasing 3,000 joules of heat. By how much does its internal energy change? In this case, you know that the motor does 2,000 joules of work on its surroundings, so its internal energy (U) will decrease by 2,000 joules. And the system also releases 3,000 joules of heat while doing its work, so the internal energy of the system decreases by an additional 3,000 joules. Thinking this way makes the total change of internal energy the following:

The internal energy of the system decreases by 5,000 joules, which makes sense. On the other hand, what if the system absorbs 3,000 joules of heat from the surroundings while doing 2,000 joules of work on those surroundings? In this case, you have 3,000 joules of energy going in and 2,000 joules going out. The signs are now easy to understand:

In this case, the net change to the system’s internal energy is +1,000 joules.

You can also see negative work when the surroundings do work on the system. Say, for example, that a system absorbs 3,000 joules at the same time that its surroundings perform 4,000 joules of work on the system. You can tell that both of these energies will flow into the system, so the system’s internal energy goes up by 3,000 J + 4,000 J = 7,000 J. If you want to go by the numbers, use this equation:

Then note that because the surroundings are doing work on the system, W is considered negative. Therefore, you get the following equation:

Say that the system absorbs 1,600 joules of heat from the surroundings and performs 2,300 joules of work on the surroundings. What is the change in the system’s internal energy? Use the equation

Here, Q is positive, because energy is absorbed by the system, and work is also positive, because work is done by the system, so you have

So the internal energy of the system decreases by 700 joules.

Now say that the system absorbs 1,600 joules of heat while the surroundings do 2,300 joules of work on the system. What’s the change in the internal energy of the system?

In this case, the work done by the system is negative — that is, the surroundings do work on the system. So using

you do the following calculations:

So in this case, where the system absorbs heat and work is done on it, the change in internal energy is 3,900 joules.