Explore Standing Waves of a Particle in a Box

Try adjusting the parameters yourself:

Trap a Particle in a Box

Imagine trapping an electron in a tiny square box. The walls are solid, so it cannot get out. In everyday life, you might picture it as a tiny ball bouncing around inside.

But the quantum world works differently: An electron cannot simply be pictured as a little ball moving along a fixed path. Describing its quantum state requires a mathematical object called a wave function. A wave function has wavelike properties and can form patterns like a wave, but it is not a real wave of matter.

When a quantum state like this is confined to a box, something remarkable happens.

Waves Can Only “Stand”

Think of a guitar string: both ends are fixed, and when you pluck it, it can form certain standing waves. The string must fit exactly 1, 2, 3, … half-wavelengths—not “one and a half half-wavelengths.” This pattern is called a standing wave.

A particle in a box has similar mathematical patterns. At the box walls, the wave function must be zero, so along each direction it can fit only a whole number of half-wavelengths. The number that fit is represented by an integer n = 1, 2, 3, …, called a quantum number. Here, we mean the standing-wave pattern of the wave function when the particle is in a state with a definite energy; not every quantum state stays unchanged.

The larger the quantum number, the more closely spaced the wave-function pattern in the box.

A 2D Box Needs Two Integers

The box on this page is a square, so the wave function must satisfy the boundary conditions in both the horizontal and vertical directions. That takes two quantum numbers: nx tells us how many half-wavelengths fit horizontally, and ny tells us how many fit vertically.

Each pair (nx, ny) corresponds to a wave-function pattern with a definite energy in the box—in other words, a quantum state.

Places where the wave function passes through zero are called nodal lines. In a single standing-wave state in this square box, there are nx − 1 vertical nodal lines and ny − 1 horizontal ones. Try (3, 2): two vertical lines and one horizontal line divide the box into six cells.

What Do the Colors Mean?

Start with the “Wave function” view. In quantum mechanics, the mathematical object used to describe a particle’s quantum state is called its wave function.

The colors in the image are a visualization: the color wheel represents the phase of the wave function, while brightness represents its magnitude. These are not the electron’s actual colors, and they do not mean the electron is literally colored like a water wave.

For the single standing-wave state shown on this page, the wave function can be real-valued. Red and cyan therefore represent positive and negative values of the wave function, respectively; the black lines are where the wave function is zero—the nodal lines.

Where Is the Particle? The Probability Cloud

The wave function itself is not the probability of finding a particle. According to the quantum-mechanical Born rule, the modulus squared of the wave function, |ψ|², gives the particle’s probability density: it tells us where the particle is more likely to be found. To calculate the probability of finding it in a region, we must add up the probability density over that region (integrate it in the continuous case).

Switch to the “Probability” view: brighter areas have a higher probability density of finding the particle. For the single standing-wave state shown here, the probability density is zero along the black nodal lines, so the particle cannot be measured on a nodal line in this state. In a superposition state, the probability pattern and the locations of the nodal lines can change.

Now try a state with large quantum numbers, such as (12, 9): finer and finer light and dark stripes fill the box. Look closely and the nodes and texture are still there. If we do not resolve those details and instead average the probability over larger regions, the distribution looks more uniform. This hints at a connection between the quantum description and the classical picture, but it does not mean the particle has become a little ball bouncing around in the box.

Energy Also Comes in Steps

For a two-dimensional square infinite potential well with side length L and particle mass m, the energy is: E₍nx,ny₎ = (ℏ²π² / 2mL²) × (nx² + ny²). In other words, the energy depends only on the sum of the squares of the quantum numbers in the two directions. It can take only these specific values, like steps on a staircase. These are called energy levels.

The page leaves out the common prefactor ℏ²π² / 2mL² and uses nx² + ny² directly as a dimensionless energy index. For example, the index for (1, 1) is 2, and for (3, 2) it is 13; these are not actual energies measured in joules.

Larger quantum numbers usually mean a more closely spaced wave-function pattern and higher energy. The lowest level is (1, 1): its wave function has one main lobe and no internal nodal lines. This is called the ground state.

The Quantum-Number Plane: Which States Have the Same Energy?

Switch to the “Quantum-number plane”: each point (nx, ny) is a quantum state. The pink arc marks the points with the same energy as the state you selected; blue points are states with lower energy.

You will find that different states can sometimes have the same energy. Try (5, 5): its dimensionless energy index is 50, the same as for (1, 7) and (7, 1). Different quantum states with the same energy are called degenerate.

Degeneracy can have different origins. (1, 7) and (7, 1) have the same energy because the square box is perfectly symmetric horizontally and vertically: swapping the two quantum numbers does not change the energy. The inclusion of (5, 5), on the other hand, comes from the properties of sums of integer squares: 50 can be written as either 1² + 7² or 5² + 5². How many ways an energy value can be represented as a sum of allowed integer squares affects the degeneracy of the corresponding energy level.

Use this plot to count how many states have less energy than a selected state—the number of blue points.

Superposition: The Particle Moves Back and Forth in the Box

So far, we have looked at states in which the particle has a definite energy: its probability-density pattern does not change over time. Quantum mechanics also allows a more interesting possibility: combining two states with different energies in a superposition.

Try the “Oscillate” preset: combine (1, 1) and (2, 1). The probability cloud no longer stays still. Instead, it shifts back and forth across the box, with the probability density of finding the particle on the left and right taking turns getting stronger.

How fast it changes depends on the energy difference ΔE between the two states. It is important to distinguish angular frequency from ordinary frequency: the angular frequency of the probability-density variation is ω = ΔE / ℏ, while the ordinary frequency is f = ΔE / h. Here, ℏ is the reduced Planck constant and h is Planck’s constant. A larger energy difference means a faster change.

But if the two superposed states have exactly the same energy (for example, (1, 2) and (2, 1)), their relative phase does not change over time, so the probability-density pattern does not shift back and forth. Time on this page is illustrative: each back-and-forth cycle is set to 5 seconds, rather than calculated from a real particle mass and box size.

For a superposition, you can choose which state to combine with the first one: increase nx by 1, increase ny by 1, swap the two quantum numbers, or increase both by 1.

What If the Box Had a Different Shape?

The energy levels in a square box are neatly determined by nx² + ny². In the classical picture, a particle bouncing around a square billiard table moves regularly, and its motion can be described using conserved quantities.

A stadium-shaped box is different: the paths of classical particles in this kind of billiard system can be chaotic. Physicists have found that, under suitable conditions, the statistics of spacings between quantum energy levels in these systems often resemble the patterns described in the “Random Matrices” section. Integrable systems like the square box typically do not show the same statistics.

This research is called quantum chaos: it asks what traces chaotic motion in the classical world leaves in the energy-level statistics of the quantum world. A complicated-looking shape does not automatically produce quantum chaos; what matters is whether the corresponding classical system has chaotic dynamics. That is also where random matrix theory becomes useful.

Try It Yourself: Choose a State

Click “Next” below the image to switch between views. You can also change the parameters below and click “Try it”:

Quantum numbers nx and ny: 1 to 40. Larger numbers mean a more closely spaced wave-function pattern and higher energy.

You can also drag the box with your mouse and zoom in or out with the scroll wheel.

Keep Exploring the World of Physics

A quantum state confined in a box can form only certain standing-wave patterns. Its energy can take only specific stepwise values, and the modulus squared of the wave function gives the probability density, telling us where the particle is more likely to be found. These are basic clues to understanding the quantum world.

When states with different energies are combined in a superposition, the probability cloud changes over time. Changing the shape of the box can also reveal traces of classical chaos in the energy-level statistics. A simple box already connects quantum mechanics with random matrix theory and classical dynamics.

If you enjoy patterns generated by rules, explore more of the Physics Wonder Box and discover other fascinating demonstrations of waves, motion, and randomness. You can also read the Wikipedia article about the particle in a box.

Further Reading

  • Random Matrices From the perspective of energy-level statistics: why do the eigenvalues of random matrices repel one another and follow patterns resembling those of quantum systems?
  • Particle in a Box: Standing Waves From the perspective of quantization: how does a particle confined in a box form standing waves that correspond to discrete energy levels?

Want to see these stunning physics visuals every time you open a new tab? Install the Chrome extension now and set "Science Wonder Box" as your new tab page.🚀

Learn More
↑