The first law of thermodynamics states that:

where

is the variation of internal energy of the gas
Q is the heat absorbed by the gas
W is the work done by the gas
The container has a fixed volume, so there is no work done on/by the gas (because the work is proportional to the variation of volume:

). Therefore, W=0, and the equation becomes

and the variation of internal energy of the gas is simply equal to the heat added to it:
