AP subjects/AP Chemistry/Ideal Gas Law Simulator
CED 3.4AP Chemistry

Ideal Gas Law Simulator

Use this free ideal gas law simulator to hold one variable fixed, drag another, and see Boyle's, Charles's and Gay-Lussac's laws emerge as special cases of PV=nRTPV = nRT, with a live check that both sides of the equation match.

Controls
lawindependent-variable

How to use the simulator

The simulator always uses n=1.00n = 1.00 mol and R=0.08206 L atm mol−1K−1R = 0.08206\ \text{L atm mol}^{-1}\text{K}^{-1}. Pick a law from the Law menu, then drag the single slider. A coral dot moves along the curve on the graph and the readout panel updates.
  • Boyle (T fixed: P vs V): T is held at 300 K. The slider sets volume V from 1.0 L to 25.0 L in steps of 0.1 L (default 10.0 L), and the graph plots P against V as a curve.
  • Charles (P fixed: V vs T): P is held at 1.00 atm. The slider sets temperature T from 100 K to 600 K in steps of 5 K (default 300 K), and the graph plots V against T as a straight line through the origin.
  • Gay-Lussac (V fixed: P vs T): V is held at 10.0 L. The same temperature slider drives P, again a straight line through the origin.
  • Readout: the law's name and the fixed quantity, the proportionality in words, the computed dependent variable (for example P = 2.46 atm), and a Check line that prints PV and nRT side by side so you can see they are equal.
The y-axis tick labels are rounded to whole numbers, so read exact values from the Computed line rather than from the gridlines.

The equations

The ideal gas law, with T always in kelvin: PV=nRTPV = nRT
Holding n and one more variable constant gives each simple law:
  • Boyle, constant n and T: P1V1=P2V2P_1V_1 = P_2V_2, so P∝1/VP \propto 1/V.
  • Charles, constant n and P: V1T1=V2T2\dfrac{V_1}{T_1} = \dfrac{V_2}{T_2}, so V∝TV \propto T.
  • Gay-Lussac, constant n and V: P1T1=P2T2\dfrac{P_1}{T_1} = \dfrac{P_2}{T_2}, so P∝TP \propto T.
All three come from the combined form P1V1n1T1=P2V2n2T2\dfrac{P_1V_1}{n_1T_1} = \dfrac{P_2V_2}{n_2T_2}, where you cancel whatever stays the same. Choose R to match your units: 0.08206 L atm mol−1K−10.08206\ \text{L atm mol}^{-1}\text{K}^{-1} with atmospheres and liters, or 8.314 J mol−1K−18.314\ \text{J mol}^{-1}\text{K}^{-1} with pascals and cubic meters. Related forms on the exam include molar mass from density, M=dRTPM = \dfrac{dRT}{P}, and Dalton's law of partial pressures, PA=Ptotal⋅XAP_A = P_{total} \cdot X_A.

Worked example

Question. 1.00 mol of an ideal gas is held at 300 K in a 10.0 L container. (a) What is its pressure? (b) The gas is compressed to 5.0 L at constant temperature. What is the new pressure? (c) Starting again from 10.0 L and 300 K, the gas is heated to 450 K in the rigid container. What is the pressure?
(a) P=nRTV=(1.00)(0.08206)(300)10.0=2.46 atmP = \dfrac{nRT}{V} = \dfrac{(1.00)(0.08206)(300)}{10.0} = 2.46\ \text{atm}.
(b) Constant n and T is Boyle's law: P2=P1V1V2=(2.46)(10.0)5.0=4.92 atmP_2 = \dfrac{P_1V_1}{V_2} = \dfrac{(2.46)(10.0)}{5.0} = 4.92\ \text{atm}. Halving the volume doubles the pressure.
(c) Constant n and V is Gay-Lussac's law: P2=P1⋅T2T1=2.46×450300=3.69 atmP_2 = P_1 \cdot \dfrac{T_2}{T_1} = 2.46 \times \dfrac{450}{300} = 3.69\ \text{atm}.
Check it in the simulator. Choose Boyle and set V = 10.0 L: the readout shows P = 2.46 atm and the Check line shows PV = 24.62 and nRT = 24.62. Slide to 5.0 L: P = 4.92 atm, and PV is still 24.62. Now choose Gay-Lussac and set T = 450 K: P = 3.69 atm. In Charles mode, 300 K gives V = 24.62 L and 600 K gives 49.24 L, double the volume for double the kelvin temperature.

Common mistakes on the AP exam

  • Using °C. Every gas law calculation needs kelvin. Doubling from 100 °C to 200 °C does not double the volume (373 K to 473 K is a factor of 1.27).
  • Mismatched R. 0.08206 needs atm and L; 8.314 needs Pa and m3 (or kPa and L). Convert mL to L and torr or mmHg to atm (760 mmHg = 1 atm).
  • Inverting Boyle's law. Pressure and volume are inversely related; a smaller volume means a higher pressure.
  • Extrapolating V vs T to 0 °C. The Charles's law line passes through the origin only on the kelvin scale, at 0 K.
  • Forgetting when gases are not ideal. Real gases deviate most at high pressure and low temperature, where particle volume and intermolecular attractions matter (Topic 3.6).
  • Treating n as constant when it is not. If gas is added or a reaction changes the moles of gas, include n in the comparison.

When the AP exam uses this

PV=nRTPV = nRT appears in Unit 3 and again in stoichiometry with gaseous products, in partial-pressure problems, and in equilibrium questions involving KpK_p. Multiple-choice items often ask you to read a graph like the ones here and identify which variables were held constant, or to predict how pressure changes when two variables change at once. The simulator's straight lines and curve are the shapes to recognize.
Embed this simulator on your class page

Free for classroom use. Paste this into your site, LMS page or blog; keep the credit link under it.