Quantum mechanics

Particle in a Box Calculator

Confine an electron, proton or any mass between two walls and see its quantised energy levels, the probability density of any state and the exact probability of finding it in any region.

Real Larzscript running in your browser454 automated checksOpen source · MITNo sign-up · your inputs never leave your device

Set the box

Energy of level n
—
Photon emitted for n → n−1
—
Probability of finding it in the region
—
Classical (uniform) expectation
—

Probability density for level n

The first eight levels

Show the Larzscript program that just ran
Run a calculation to see the exact program.

This is the real program the page sent to the Larzscript interpreter (compiled to WebAssembly) in your browser. The library it imports is the same code the automated tests check.

Energy levels of a particle in a box

Put a particle of mass m in a one-dimensional box of length L with hard walls. Its allowed wavefunctions are sine waves that vanish at both walls, ψn(x) = √(2/L) sin(nπx/L), with energies

En = n² h² / (8 m L²)   ·   |ψn(x)|² = (2/L) sin²(nπx/L)

The probability of finding the particle between x1 and x2 is the exact integral of |ψ|², which this page evaluates in closed form — no numerical integration.

Numbers to remember

An electron in a box 1 nm wide has a ground-state energy of 0.376 eV; shrink the box to an atom-sized 1 Å and it jumps a hundredfold to 37.6 eV, because E scales as 1/L². In the third level the electron of the 1 nm box has 3.384 eV, exactly 9 times the ground state. A proton in a 10 fm nucleus-sized box has E1 = 2.048 MeV — the scale of nuclear binding energies. (The 1 nm and 1 Å values and the n² scaling are asserted in the library's test suite.)

The ground state puts 81.83% of the probability in the middle half of the box, compared with 50% for a classical particle bouncing uniformly between the walls: a quantum particle in its lowest state prefers the centre.

What is verified

Energies are checked against the textbook values (0.376 eV for an electron in 1 nm, 37.6 eV in 1 Å), the scaling En = n²E1, normalisation (total probability exactly 1 for every n), the exact ground-state result 1/3 + √3/(2π) = 0.609 for the middle third, and the nodes of the higher states.

Limits: an infinitely deep, one-dimensional, non-relativistic box. Real wells are finite (the particle leaks into the walls — see the tunneling calculator) and real particles move in three dimensions, where the energies add: E = (nx² + ny² + nz²)h²/(8mL²) for a cubic box.

Frequently asked questions

What is the particle-in-a-box model?

It is the simplest exactly solvable quantum system: a particle confined between two impenetrable walls a distance L apart. The Schrödinger equation gives standing-wave solutions and energies En = n²h²/(8mL²), showing in the plainest possible way why confinement produces discrete energy levels.

Why can't the particle have zero energy?

Confining a particle to a region forces its momentum to be uncertain (Heisenberg's uncertainty principle), so it can never be perfectly at rest. The lowest allowed energy, E1, is the zero-point energy. For an electron in a 1 nm box it is 0.376 eV.

Why does the energy grow as n²?

Higher states have more half-wavelengths fitting into the box, hence shorter wavelength and larger momentum. Energy goes as momentum squared, and the wavelength is 2L/n, so E is proportional to n². The gaps between levels therefore widen: En+1 − En = (2n+1)E1.

How does this model appear in real technology?

Quantum wells, wires and dots in semiconductors are box-like traps for electrons; their sizes set the colour of quantum-dot light. Conjugated dye molecules are often modelled as a one-dimensional box for their pi electrons, and nuclear physics uses a similar picture for nucleons in a nucleus.

What is the classical limit?

As n grows, the density |ψ|² oscillates so fast that any region of finite width holds the classical fraction of probability. A quick check: on this page raise n to 50 and the probability in the middle half approaches 50%.

Every number on this page is computed by the open-source larzscript-cosmos library (qmech, physconst, physmath), written in Larzscript, and checked against independent references in its test suite. How it is verified →

All physics calculators → · Science calculators hub · Chemistry calculators →