Can a ‘demon’ teach thermodynamics? our pedagogical simulation of maxwell’s paradox
We built a computer simulation to help students intuitively understand one of the most famous and challenging thought experiments in physics: maxwell’s demon.
Thermodynamics is hard. Concepts like entropy, statistical mechanics, and the second law are notoriously difficult for students because they are abstract and statistical. You can’t just see entropy.
To help explain these concepts, James Clerk Maxwell proposed a famous thought experiment in 1871: Maxwell’s Demon. He imagined a tiny, intelligent “demon” controlling a door between two chambers of gas. This demon could see individual particles, allowing fast (hot) particles to pass one way and slow (cold) particles the other way, thus violating the second law of thermodynamics… or could it?
This paradox is a cornerstone of statistical physics. In our 2004 paper for the Journal of Chemical Education, we decided to stop just talking about the demon and actually build one.
🧐 The problem: a thought experiment is still abstract
Even with the demon analogy, students struggle. They can’t visualize the microscopic actions that lead to the macroscopic laws they have to learn. How does a single particle’s velocity relate to the overall “temperature” of the gas? How does “information” (what the demon “knows”) relate to “entropy”?
💡 Our solution: a hands-on demon
We developed a program called “A Pedagogical Simulation of Maxwell’s Demon”. It’s a virtual lab that simulates, at the microscopic level, two gas chambers with an opening between them.
The key idea is to let the student become the demon.
Instead of just reading about it, students can set up simulations and directly control the rules for the demon’s door. They can see how their choices affect the entire system in real-time. This turns a passive thought experiment into an active, hands-on learning tool.
🛠️ How it works: a look at the simulation
The program (built for Windows) shows two chambers filled with particles, all moving and bouncing according to physical laws. The user can define the “demon’s logic”:
- What kind of demon is it? (e.g., one that separates by velocity, by direction, etc.)
- How big is the opening?
- How many particles are there?

🚀 What students can learn (the results)
The goal of this “game” isn’t to win, but to observe. By running simulations, students can intuitively discover fundamental concepts for themselves. The tool is designed to help them:
- See the relationship between entropy and information.
- Study how thermal equilibrium is reached (or broken!).
- Observe random fluctuations in temperature and entropy, a key statistical concept.
- Measure things like thermodynamic relaxation time.
- Understand the distribution of velocities (Maxwell-Boltzmann distribution) at different temperatures.
🔬 Why does this matter?
This tool makes the invisible visible. It directly connects the microscopic world of single particles (which students can see) with the macroscopic world of entropy and temperature (which the graphs plot).
By allowing students to “play god” (or at least, “play demon”), it helps them build a robust, intuitive understanding of statistical mechanics that staring at equations in a textbook often fails to provide.
📖 The full paper
For a complete description of the software and the pedagogical activities you can do with it, you can read the original article.
A pedagogical simulation of maxwell’s demon. Authors: Domingo López, Carlos Criado. Journal: Journal of Chemical Education (vol. 81, issue 11)