Thermodynamics seeks to describe and predict the behavior of a gas. This is done by looking at the internal energy of the gas. Gas's temperature, in Kelvins, is directly proportional to the internal energy. Temperature is an indicator of how the internal energy changes. When the temperature rises so does the internal and kinetic energies of the gas. When the temperature decreases, the internal and kinetic energies of the gas also decreases.
There are two ways to change the internal energy, and therefore the temperature.
 Change the volume by squeezing or expanding the gas's volume.
 Change the temperature by adding or removing thermal energy.
The image gives an interpretation of how these changes on the gas could occur.

To raise the temperature, internal energy, of the gas in the container,
 The surroundings can decrease the volume. This is positive work by the surroundings.
 Thermal energy can be added, (by the flames.) This is positive thermal work from the surroundings.
The first law of thermodynamics says all energy is conserved. This leads to the mathematical expression of the 1st law of thermodynamics.
The expression on the left, ΔU, is about the gas and the expression on the right, W+Q, is about the surroundings. In detail the 1st law can be expressed as
Note: When using a PV diagram, the work that is calculated is the work of the gas and not the work by the surroundings. So the area under the curve from a PV diagram cannot plug into the 1st law equation directly. It will need to be adjusted.
The change in internal energy can be calculated from
 algebra equation
 PV diagram
 1st law of thermodynamics
Work can be calculated from
 algebra equation
 PV diagram or
 1st law
Thermal energy, Q can be found from
 1st law of thermodynamics
Note: In reality, Q can be found in other ways (e.g. latent heat of fusion, latent heat of vaporization, latent heats, thermal energy changes due to phase changes, etc.) This text is not covering this because it is beyond the scope of the curriculum.
Indicators 
When describing a problem, you will rarely be told the work is "blahblah." Or the internal energy is "blahblah." Instead you will look for clues about the internal energy, work, and thermal energy.
Clues
 Internal energy change, ΔU: Any time the system experiences a change in temperature. If the temperature does not change, then there is no change in internal energy.
 Work, W: Then the system expands or contracts. If the system does not change size, then the work is zero.
 Thermal energy, Q: When thermal enerrgy is added or removed to a system. A heat source such as a fire adds thermal energy to a system. An ice pack removes thermal energy from a system.

