2D Animation

Particle in a Box: 1D & 2D Quantum Visualizations

📖Read Time: 4 minutes
📊Readability: Moderate (Standard complexity)
🔖Core Topics: particle, time, box, energy, lx

Introduction

The particle in a box is a staple of entry-level quantum mechanics courses because it provides a clear contrast between classical and quantum dynamics. It is one of the few problems that can be solved exactly, without approximations. I suspect most readers solved only the 1-D particle-in-a-box in class and did not explore the larger picture, visualizing solutions, or higher-dimensional examples. Others reading this may work in a scientific field other than physics but are curious about the peculiarities of quantum mechanics.

In this Insight I briefly outline why the particle-in-a-box problem is important, what the solutions mean, and what the solutions look like in higher dimensions (2-D). Along the way you can pick up MATLAB code for making your own visualizations.

Why classical intuition fails

In the 1-D model the particle is free to move (potential energy V = 0) along a line of length Lx. No forces act on the particle inside the box; the walls are treated as impenetrable because the region outside the box has infinitely large potential (V = ∞).

Classical mechanics says that a particle in a 1 m box can have any speed and is equally likely to be found at any position along the line. That prediction changes dramatically when the box length is on the order of a nanometer (1×10-9 m), where quantum mechanics applies. The quantum solution gives several nonintuitive results:

Key quantum results

  1. The particle is more likely to be found in certain positions than others, depending on its energy.
  2. There are nodes—positions where the probability density is always zero.
  3. The particle’s energy is restricted to a discrete set of allowed energy levels (quantization).
  4. The particle cannot have zero energy; it always has nonzero motion (zero-point energy).

The Schrödinger equation and separation of variables

We solve the problem using the time-dependent Schrödinger equation. I omit many mathematical steps; the references below fill in details.

i ħ ∂Ψ(x,t)/∂t = −(ħ² / 2m) ∂²Ψ(x,t)/∂x² + V(x) Ψ(x,t)

Here the variables are:

  • Ψ — the wave function (encodes position, momentum, and energy information)
  • V — potential energy
  • x — position
  • t — time
  • ħ — reduced Planck’s constant
  • m — particle mass
  • i — imaginary unit

With a time-independent potential we use separation of variables, assuming Ψ(x,t) = ψ(x) φ(t). Substituting and separating gives a spatial eigenvalue equation and a time equation, both equal to the same constant E (the energy):

−(ħ² / 2m) d²ψ(x)/dx² + V(x) ψ(x) = E ψ(x)

i ħ dφ(t)/dt = E φ(t)

The spatial solutions are time-independent and are therefore called stationary states; each corresponds to a definite energy.

The 1-D wavefunction and boundary conditions

Solving the spatial equation in a region of zero potential yields a general solution:

ψ(x) = A sin(kx) + B cos(kx)

Impenetrable walls impose boundary conditions ψ(0) = ψ(Lx) = 0, which forces B = 0 and restricts the wavenumber to k = n π / Lx for integer n = 1, 2, 3, …. Thus

ψn(x) = A sin(n π x / Lx)

The corresponding energy levels are

En = ħ ω = (ħ² k²) / (2 m) = (n² π² ħ²) / (2 m Lx²)

Normalized stationary state

Choosing normalization constant A = sqrt(2 / Lx) gives the full time-dependent wavefunction for mode n:

Ψn(x,t) = sqrt(2 / Lx) sin(n π x / Lx) e−i ω t

Simulating the 1-D solution

For visualization you can assign unit values to constants (for clarity) and plot the real part of Ψ(x,t) as it evolves in time. See the MATLAB code and animation below.

View the code for the 1-D time simulation

1D Particle Animation
Figure: Real part of Ψ(x,t) for a 1-D particle (example mode). Note the nodes where the wave function is always zero.

The 2-D particle in a box

In 2-D the particle is confined to a rectangle of width Lx and height Ly. The 2-D time-independent Schrödinger equation becomes

−(ħ² / 2m) (∂²ψ(x,y)/∂x² + ∂²ψ(x,y)/∂y²) + V(x,y) ψ(x,y) = E ψ(x,y)

Using separation of variables again, set ψ(x,y) = f(x) g(y). Each factor satisfies a 1-D-type equation, so the spatial eigenfunctions are products of sines:

Ψnx,ny(x,y,t) = sqrt(4 / (Lx Ly)) sin(kx x) sin(ky y) e−i ω t

Here kx = nx π / Lx, ky = ny π / Ly, and nx, ny = 1, 2, 3, …. The probability density has more nodes in 2-D, forming a grid of nodal lines depending on the two quantum numbers.

Simulating the 2-D solution

You can extend the 1-D MATLAB code to 2-D by evaluating the product sin(kx x) sin(ky y) on a grid and animating the real part in time.

View the code for the 2-D time-simulation for (nx, ny) = (4,4)

2D Particle Animation (4,4)
Figure: Time evolution for the 2-D mode (nx, ny) = (4,4). Nodes form a grid of lines where the particle cannot be found.

For multiple mode combinations see the full simulation code and the combined animation below.

View code for the full 2-D time-simulation

2D Particle Multiple Modes Animation
Figure: Animation showing several (nx,ny) mode combinations.

Feedback

Please leave comments or send me a message with any feedback so I can improve future posts.

Learn More

  1. 2-D wells — University of Virginia
  2. Particle in a box — Wikipedia
  3. HyperPhysics: Particle in a box
  4. Short video demonstration
  5. Supplementary notes: Particle in a Box (2-D)
11 replies
  1. Jimster41 says:

    I think I made (or am working on) a connection that I hadn’t made, and I hope it is “not wrong”, but please tell me if it is.

    The periodic shape of wavefunction (the wavenumber?) for the given box “size” and the given energy, is dictated by way(s) that energy is divided by h (which, like the size dimension x of the box, is a “size”). The result is discrete scale invariant, is that correct?

    Sorry for treating the insights as a regular old thread, but they are little bit like a class where you would love to be able to raise your hand. o_O and get yourself squared up. Moreso IMHO than regular question threads which can be pretty chaotic and often you are just trying to figure out what the conversation is about. Or you are having to frame a question without such lucid context, and are not even sure if your terms are right.

  2. jtbell says:

    “Trying to picture what happens if you suddenly increase the size of the box.”

    This is actually a fairly common exercise for students studying the one-dimensional particle in a box. Basically you start by assuming that the wave function ##Psi(x,t)## does not change at the instant the box increases in size. If it was originally in the ground state, it goes from this:

    [ATTACH=full]83125[/ATTACH]

    to something like this:

    [ATTACH=full]83126[/ATTACH]

    Which doesn’t look very interesting, does it? But, just let some time elapse!

    In the original box, ##Psi## is an energy eigenstate ##psi_k(x) e^{-iE_k t / hbar}## with a fixed energy. The probability distribution ##|Psi|^2## maintains the same shape, so we call it a “stationary state”.

    In the new box, ##Psi## is a superposition (linear combination) of the new energy eigenstates, e.g. :

    [ATTACH=full]83127[/ATTACH]

    for the new ground state and first excited state. Each of these eigenstates oscillates at a different frequency, so the probability distribution of the superposition does not maintain the same shape, that is, it is not a “stationary state.” The probability distribution “sloshes” around inside the new box as time passes, starting from the probability distribution of the original wave function.

    To see what this actually looks like for a specific case, you have to work out the coefficients A[SUB]k[/SUB] of the linear combination that expresses the spatial part of the original ##psi(x)## in terms of the spatial part of the new energy eigenstates: $$psi(x) = Sigma {A_k psi_k^prime(x)}$$ Then you can find the new time-dependent wave function $$Psi(x,t) = Sigma A_k psi_k^prime(x) e^{-iE_k t / hbar}$$ and the new probability distribution $$P(x,t) = |Psi(x,t)|^2$$

  3. Atlas3 says:

    Can the plot above labeled by "Here is the time-simulation for (nx,ny)=(4,4). In this case, the spots where the wave function is always zero are more numerous, and form a grid."  fill a volume if stacked in another dimension?

  4. Jimster41 says:

    Re-reading after thinking about it. I’d like to ask questions in context, but I don’t want to distract from a great, clear tutorial. Trying to picture what happens if you suddenly increase the size of the box. My guess was that the response is sort of quantized (or harmonic) due to the periodicity of the wave equation, that there would be no noticeable change until a new peak, or a new coherent wave frequency or pattern across the whole box was accommodated. Is that threshold Planck size? Also, was picturing the overall energy density probability going down, which seems naively consistent with thermodynamic expectation? At the moment when a new wave function suddenly “fits” the “expectation” wave spontaneously re-forms instantaneously everywhere to take this new shape? What if the box is huge?

  5. PWiz says:

    Nice! The blog’s mathematical presentation is pretty simple and easy to understand as well. Gotta have one of these in the starting chapters of every introductory QM book ;)

  6. Fooality says:

    Absolutely excellent. I am not a physicist, but have an interest in understanding QM and this article was perfect: The visualizations and instructions for computer simulation relate the ideas better than anything I’ve read.

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply