The ideal gas law connects pressure, volume, temperature, and the amount of gas in a single equation. It's the foundation for predicting how gases respond to changing conditions. The first law of thermodynamics then builds on this by tracking where energy goes: into heating a gas, changing its internal energy, or doing mechanical work. Together, these ideas explain everything from balloon inflation to diesel engines.
Thermodynamic Systems and Properties

Ideal gas law relationships
The ideal gas law is , where is pressure, is volume, is the number of moles, is absolute temperature (in Kelvin), and is the universal gas constant (). This single equation contains several simpler gas laws as special cases, depending on which variable you hold constant:
- Isothermal (constant ): and are inversely proportional. . Squeeze a balloon and the pressure inside rises as the volume drops.
- Isobaric (constant ): and are directly proportional. . A hot air balloon expands as the air inside is heated.
- Isochoric (constant ): and are directly proportional. . A sealed pressure cooker builds pressure as it heats up.
All temperatures in these relationships must be in Kelvin. Using Celsius will give you wrong answers.

Pressure-volume work calculations
When a gas expands, it pushes on its surroundings and does work. When it's compressed, the surroundings do work on it. The general expression for work done on the gas is:
The negative sign here follows the convention where positive means energy is added to the system. Be careful: some textbooks define as work done by the gas, which flips the sign. Know which convention your course uses.
- Isobaric process: Since is constant, the integral simplifies to , where . If the gas expands (), is negative, meaning the gas loses energy by doing work on its surroundings.
- Isochoric process: Volume doesn't change, so . No work is done in a rigid container.
- Path dependence: Work depends on how you get from state 1 to state 2, not just the endpoints. On a PV diagram, work equals the area under the curve, and different paths between the same two states enclose different areas.

First law of thermodynamics
The first law is energy conservation applied to thermal systems. It says:
where is the change in internal energy, is heat added to the system, and is work done on the system. (With the sign convention used above, where , the first law is . If your textbook defines work done by the system as positive, the equation becomes . Both are correct; they just define differently.)
A few key consequences:
- is a state function. It depends only on the initial and final states, not on the path. Heat and work individually are path-dependent, but their combination always gives the same for the same endpoints.
- Isolated systems: No heat enters or leaves, and no work is done, so .
- Cyclic processes: The system returns to its starting state, so and the net heat added equals the net work done by the gas over the full cycle.
Applications of the first law
Each special thermodynamic process eliminates one variable, making the first law simpler to apply:
-
Adiabatic (): No heat exchange with surroundings. All energy transfer is through work.
- (work done on the gas increases its internal energy)
- Examples: rapid compression in a diesel engine heats the air enough to ignite fuel; expansion of gas in a sound wave
-
Isothermal (constant , so ): For an ideal gas, internal energy depends only on temperature, so constant means no change in .
- , meaning all heat absorbed is converted to work done by the gas (or vice versa)
- Examples: slow, controlled expansion or compression where the gas stays in thermal contact with a reservoir
-
Isobaric (constant ): Work is straightforward to calculate.
- Example: heating air in an open-top cylinder with a free piston
-
Isochoric (constant , so ): All heat goes directly into changing internal energy.
- Example: heating gas in a sealed, rigid container
Thermodynamic processes and state functions
- Thermodynamic equilibrium means all macroscopic properties (pressure, temperature, volume) are uniform throughout the system and constant over time. You can only assign a single , , and to a system that's in equilibrium.
- State functions (like , , , ) depend only on the current state, not on history. Heat () and work () are not state functions because their values depend on the process path.
- Reversible processes are idealizations where the system moves through a continuous series of equilibrium states. They're infinitely slow in principle, but they set the theoretical limit for efficiency.
- Irreversible processes involve sudden changes (like free expansion or friction) and are what actually happens in real life. They always produce less useful work than the equivalent reversible process.