Thermodynamics — Heat, Work, and Energy

Heat a gas, push a piston and watch ΔU = q + w add up — then see entropy decide which way heat flows

Chemistry Thermochemistry intermediate 7 min

This concept builds on Chemical Bonding — How Atoms Stick Together. Consider exploring it first for the best experience.

Step 1 of 6

System and surroundings

On the canvas, the gas in the right-hand cylinder, sealed under a piston, is the system. The hot body on the left and the piston are its surroundings. Energy can cross the boundary in only two ways: as heat (q), through the bar joining the two boxes, or as work (w), when the piston moves. An isolated system exchanges neither.

Heat flows from hot to cold (q)

Watch the arrows on the connecting bar and the 'Heat into gas (q)' card. Heat flows only because of a temperature difference, so energy leaves the hot body and enters the gas, whose dots speed up as it warms. On the plot below, the red and blue lines close in on each other. Positive q means the system absorbed heat; negative q means it released heat.

Work done by the piston (w)

Set 'Piston work' to 20 J and press 'Compress'. The piston plate drops, the gas volume shrinks by a tenth of the cylinder and the gas jumps 4 °C warmer: work done on the system counts as positive (w > 0). Press 'Expand' and the gas pushes the piston back out, doing work on its surroundings (w < 0), and cools. A yellow tick on the plot marks every stroke.

Worked Example: the First Law, ΔU = q + w

If the gas absorbs q = 50 J of heat while the piston does w = 20 J of work on it, its internal energy changes by ΔU = q + w = 50 + 20 = 70 J; at 5 J per °C, the gas ends 14 °C warmer. Try it: choose 'Insulated', press 'Pause' as the 'Heat into gas (q)' card nears 50 J, then press 'Compress'. The ΔU card jumps by 20 J to about 70 J.

Equilibrium and the Second Law

Let the run finish. The red and blue lines meet on the dashed equilibrium line and the arrows fade. Heat never flows on its own from the cooler body to the hotter one: the Entropy meter in the top corner fills to 100% because the evened-out state has far more microscopic arrangements. The total entropy of an isolated system never decreases, and every spontaneous process raises it.

Speed versus destination

Choose 'Insulated', then 'Default'. Both start at 80 °C and 20 °C and settle at the same 50 °C; only the speed differs, because the transfer rate k sets how fast heat crosses the bar, not where the temperatures meet. Work does move that meeting point: 20 J of compression warms the gas by 4 °C and lifts the shared equilibrium by 2 °C, as the dashed line shows.

How It Works — Step by Step

Step 1 of 6
  1. 1

    System and surroundings

    On the canvas, the gas in the right-hand cylinder, sealed under a piston, is the system. The hot body on the left and the piston are its surroundings. Energy can cross the boundary in only two ways: as heat (q), through the bar joining the two boxes, or as work (w), when the piston moves. An isolated system exchanges neither.

  2. 2

    Heat flows from hot to cold (q)

    Watch the arrows on the connecting bar and the 'Heat into gas (q)' card. Heat flows only because of a temperature difference, so energy leaves the hot body and enters the gas, whose dots speed up as it warms. On the plot below, the red and blue lines close in on each other. Positive q means the system absorbed heat; negative q means it released heat.

  3. 3

    Work done by the piston (w)

    Set 'Piston work' to 20 J and press 'Compress'. The piston plate drops, the gas volume shrinks by a tenth of the cylinder and the gas jumps 4 °C warmer: work done on the system counts as positive (w > 0). Press 'Expand' and the gas pushes the piston back out, doing work on its surroundings (w < 0), and cools. A yellow tick on the plot marks every stroke.

  4. 4

    Worked Example: the First Law, ΔU = q + w

    If the gas absorbs q = 50 J of heat while the piston does w = 20 J of work on it, its internal energy changes by ΔU = q + w = 50 + 20 = 70 J; at 5 J per °C, the gas ends 14 °C warmer. Try it: choose 'Insulated', press 'Pause' as the 'Heat into gas (q)' card nears 50 J, then press 'Compress'. The ΔU card jumps by 20 J to about 70 J.

  5. 5

    Equilibrium and the Second Law

    Let the run finish. The red and blue lines meet on the dashed equilibrium line and the arrows fade. Heat never flows on its own from the cooler body to the hotter one: the Entropy meter in the top corner fills to 100% because the evened-out state has far more microscopic arrangements. The total entropy of an isolated system never decreases, and every spontaneous process raises it.

  6. 6

    Speed versus destination

    Choose 'Insulated', then 'Default'. Both start at 80 °C and 20 °C and settle at the same 50 °C; only the speed differs, because the transfer rate k sets how fast heat crosses the bar, not where the temperatures meet. Work does move that meeting point: 20 J of compression warms the gas by 4 °C and lifts the shared equilibrium by 2 °C, as the dashed line shows.

Key Takeaways

Energy is always conserved

ΔU = q + w. Every joule that enters or leaves the system is accounted for: 50 J of heat in plus 20 J of work done on a gas raises its internal energy by exactly 70 J.

Work is the second route

Compressing a gas does work on it (w > 0) and warms it; letting it expand makes it do work on its surroundings (w < 0) and cools it. Heat and work are two routes to the same ΔU.

Heat flows down temperature gradients

Energy moves spontaneously from hotter regions to cooler ones. Thermal equilibrium is the state where temperatures equalise and net heat flow stops; the transfer rate only sets how quickly that happens.

Entropy sets the direction

Natural processes increase total entropy. A hot–cold pair evens out because the mixed state has vastly more microstates than the separated one — which is why heat never flows back uphill unaided.

Added
Updated
  • — New piston with Compress and Expand, live q, w and ΔU readouts, and a worked First Law example: 50 + 20 = 70 J.