The first law of thermodynamics states that:

where

is the variation of internal energy of the system
Q is the heat absorbed by the system
L is the work done by the system on the surrounding.
In this problem, the system absorbs 15 J of heat, so Q=+15 J (with positive sign, since it is heat absorbed by the system) while the work done by the system is L=+7 J (with positive sign, since it is work done by the system), so the variation of internal energy is
