Skip to main content
Back to module
Computational & Modern Physics · Modern Physics

Quantum basics

Reading45mLesson 2 of 3 in this module

What you'll learn

  • Explain wavefunctions and energy levels
  • Compute particle-in-a-box energies and convert them to electronvolts
  • Find the photon wavelength emitted in a transition between levels
  • Estimate a probability by integrating |psi|^2 with the midpoint rule

Explain wavefunctions, probability and quantized energy levels using the particle in a box, and compute them in Python.

Why it matters

Quantum mechanics explains why atoms are stable, why materials conduct or insulate, why LEDs and quantum dots have the colours they do, and how lasers, transistors and MRI work. You do not need the full theory to start computing with it. The particle in a box is the standard first model: simple enough to solve by hand and rich enough to show every key idea.

The core ideas

  • Wavefunction. A particle is described by a wavefunction psi(x). It is not a physical wave you can see; it is a tool for predictions.
  • Probability. |psi(x)|^2 is a probability density. The chance of finding the particle between a and b is the integral of |psi|^2 from a to b. The total over all space must be 1 (the wavefunction is normalized).
  • Schrödinger equation. For a time-independent problem in one dimension:
-(hbar^2 / 2m) * psi''(x) + V(x) * psi(x) = E * psi(x)

Only some values of E give wavefunctions that obey the boundary conditions. That is why energy is quantized.

The particle in a box

Put a particle of mass m in a region 0 < x < L with zero potential inside and infinitely high walls outside. The wavefunction must be zero at both walls. Sine waves that fit a whole number of half-wavelengths into the box are the solutions:

psi_n(x) = sqrt(2/L) * sin(n * pi * x / L),   n = 1, 2, 3, ...
E_n = n^2 * h^2 / (8 * m * L^2)

What this tells you:

  • Energy grows as n^2: levels 1, 4, 9, 16 times the ground state.
  • The lowest energy is not zero. Confining a particle always costs energy (zero-point energy), a consequence of the uncertainty principle.
  • State n has n - 1 nodes inside the box where the particle is never found.
  • A smaller box or a lighter particle spreads the levels further apart (1/(m L^2)).

Worked example: an electron in a 1 nm box

h   = 6.62607015e-34 J s
m_e = 9.1093837e-31 kg
L   = 1.0e-9 m

E_1 = h^2 / (8 m L^2) = 4.390e-67 / 7.288e-48 = 6.025e-20 J
    = 6.025e-20 / 1.602e-19 = 0.376 eV

So E_2 = 4 * 0.376 = 1.504 eV and E_3 = 3.384 eV. If the electron drops from n = 3 to n = 2, it releases 5 * 0.376 = 1.880 eV, and the photon wavelength is

lambda = h c / dE = 1239.84 eV nm / 1.880 eV = 659 nm   (red light)

This is roughly how colour works in dye molecules and quantum dots: the size of the region the electron is confined to sets the colour. Real atoms have a different potential, so their levels follow other formulas. For hydrogen, E_n = -13.6 eV / n^2, and the 3 to 2 transition gives 656 nm, the red H-alpha line.

Worked example: probabilities

For the ground state, what is the chance of finding the particle in the middle half of the box?

P = integral from L/4 to 3L/4 of (2/L) sin^2(pi x / L) dx = 1/2 + 1/pi = 0.818

A classical particle bouncing at constant speed would spend exactly 50% of its time there. The quantum ground state piles probability up in the middle. Many such integrals have no neat closed form, so you compute them numerically:

Python
import math

def psi(n, x, L):
    return math.sqrt(2 / L) * math.sin(n * math.pi * x / L)

def prob(n, L, a, b, steps=10_000):
    dx = (b - a) / steps
    return sum(psi(n, a + (i + 0.5) * dx, L) ** 2 for i in range(steps)) * dx

print(prob(1, 1.0, 0.25, 0.75))   # 0.8183...

This is the midpoint rule: split the interval, evaluate at each centre, add up.

Common mistakes

  • Treating psi as the probability. The probability density is |psi|^2, and probabilities come from integrating it.
  • Starting n at 0. n = 0 gives psi = 0 everywhere, which is no particle at all.
  • Mixing h and hbar. The box formula above uses h. With hbar = h / (2 pi) it reads n^2 pi^2 hbar^2 / (2 m L^2); both give the same number.
  • Forgetting the eV conversion (1 eV = 1.602176634e-19 J) and quoting joules as if they were electronvolts.

Recap

  • |psi|^2 is a probability density; normalized wavefunctions integrate to 1.
  • Boundary conditions quantize energy: E_n = n^2 h^2 / (8 m L^2) in a box.
  • Transitions emit photons with lambda = h c / dE.
  • Numerical integration (midpoint rule) handles the probabilities you can't do by hand.

Try it

Open the Do tab to compute box energy levels, a transition wavelength and a probability by numerical integration.

Key terms (6)

wavefunction
The function psi(x) that describes a quantum particle and is used to make predictions; it is not itself a visible wave.
probability density
|psi(x)|^2; integrating it over a region gives the chance of finding the particle there.
normalized
Describes a wavefunction whose probability density integrates to 1 over all space.
zero-point energy
The non-zero lowest energy of a confined particle, a consequence of the uncertainty principle.
particle in a box
A model of a particle confined between infinitely high walls, with energies E_n = n^2 h^2 / (8 m L^2).
midpoint rule
A numerical integration method that splits the interval into steps, evaluates the function at each step's centre and adds up.

Recap

  • |psi|^2 is a probability density, and a normalized wavefunction integrates to 1.
  • Boundary conditions quantize energy: in a box, E_n = n^2 h^2 / (8 m L^2), so levels grow as n^2 and the lowest is not zero.
  • A transition emits a photon with lambda = h c / dE.
  • The midpoint rule computes probabilities you can't integrate by hand.
  • n starts at 1, and joules must be converted to eV before quoting eV.
Also in this lesson: