# Visualizing the 2-D Particle in a Box

[Total: 3    Average: 3.7/5]

The particle in a box is a staple of entry-level Quantum Mechanics classes because it provides a meaningful contrast between classical and quantum dynamics. It is one of the few problems that can be solved exactly, without approximations. Despite this, I would wager that most of you solved only the 1-D particle in a box problem, and didn’t worry too much about the bigger picture, visualizing the solution, or higher dimensional examples. Many other people reading this might be involved in a scientific discipline other than physics, but nevertheless might be interested in the peculiarities of Quantum Mechanics (QM).

In this Insight, I’ll briefly outline why the particle in a box problem is important, what the solutions mean, and what the solution to higher dimensional (2-D) boxes looks like. Along the way, you might even pick up some useful MATLAB code for creating your own visualizations.

### Problems with Intuition

In the 1-D example, a particle is free to move (potential energy $V = 0$) backward and forward along a straight line of length $L_x$. No forces act on the particle when it is in the box. The walls of this 1-D “box” are considered to be impenetrable, as the space outside the box has an infinitely large potential energy ($V = \infty$).

Let’s say that the box is 1 meter long. Classical mechanics says that the particle can move at any speed along the line, and it is equally likely to be found at any point along the line. Pretty straightforward, right?

Now, let’s say that the box is 1 nanometer long (1e-9m). On this scale, QM is applicable, rather than classical mechanics. The quantum mechanical solution (briefly outlined below) says the following:

1. The particle is more likely to be found in certain positions than others, depending on its energy.
2. There are “blind spots”, or places where the particle can never be detected.
3. The energy of the particle must obey a discrete set of energy levels.
4. The particle can not have zero energy, so it is always moving.

Needless to say, the QM solution stands in stark contrast to the simple and intuitive classical solution!

### The Schrödinger Equation

To solve this problem with QM, the time-dependent Schrödinger equation is used. I’m going to omit many details in this discussion, as our primary focus is in understanding the basic problem. I encourage you to read the references for the full details.

$$i \hbar \frac{\partial}{\partial t} \Psi(x,t) = -\frac{\hbar^2}{2m} \frac{\partial^2}{\partial x^2} \Psi(x,t) + V(x)\Psi(x,t)$$

The variables in this equation, if you aren’t familiar, are:

•  $\Psi$ is the wave function for the particle. The wave function is important as the position, energy, and momentum of the particle can all be obtained from it.
• $V$ is the potential energy of the particle.
• $x$ is the position of the particle.
• $t$ is time.
• $\hbar$ is the reduced Planck’s constant.
• $m$ is the mass of the particle.
• $i$ is the imaginary unit.

Since the potential energy $V$ is time-independent (it depends only on the position $x$), we can perform a separation of variables by assuming that $\Psi(x,t) = \psi(x) \phi(t)$. Substituting this into the above equation creates a situation where the left side depends only on time $t$, and the right side depends only on position $x$. This can only be the case if both sides are equal to the same constant, which we call $E$.

$$-\frac{\hbar^2}{2m}\frac{\partial^2 \psi(x)}{\partial x^2} + V(x)\psi(x) = E\psi(x)$$

$$i\hbar \frac{\partial \phi(t)}{\partial t} = E\phi(t)$$

This means that the solutions to the position equation are time-independent, and for this reason these solutions are called stationary states. The stationary states correspond to definite values of the energy.

### The 1-D Wavefunction

After solving the time-dependent equation, you end up with two solutions: one that describes the position, and the other that describes the time dependence.

$$\psi(x) = A\sin(kx) + B\cos(kx)$$

$$\phi(t) = e^{-i \omega t}$$

But as we said before, the potential walls need to be impenetrable, so the boundary requirement is that $\psi(0) = \psi(L_x) = 0$. This boundary requirement results in:

$$\psi(x) = A\sin(kx)$$

where $k$ must be equal to $n\pi/L_x$ to satisfy $\psi(L_x)=0$. The variable $k$ is called the wavenumber, as it is related to the total energy of the particle:

$$E_n = \hbar \omega = \frac{\hbar^2 k^2}{2m}$$

### Simulating the 1-D Solution

So the above solutions tell us everything. If $n=3$, for instance, then the energy of the particle is $E_3$, its momentum is $p=\sqrt{2E_3m}$, its position is described by $\psi(x)$, the time dependence is $\phi(t)$, and $A = \sqrt{2/L_x}$ is the normalization:

$$\Psi(x,t) = \psi(x) \phi(t) = \sqrt{\frac{2}{L_x}} \sin(kx) e^{-i \omega t}$$

You can make a .gif movie of the time evolution in MATLAB as follows. Note that I assign a value of 1 to all of the constants for simplicity and plot only the real part of the function. Click the link to view the code, or click the image to view the animation.

View the code for the 1-D time-simulation

In particular note the spots where the wavefunction is always zero. These are the places where the particle will never be found!

### Simulating the 2-D Solution

In 2-D, the problem is similar except that the particle is confined to a box of width $L_x$ and height $L_y$. Remember how we used separation of variables to solve the 1-D equation? Well, it turns out that after applying the same method once to the 2-D equation, you end up with:

$$-\frac{\hbar^2}{2m}\left( \frac{\partial^2 \psi(x,y)}{\partial x^2} + \frac{\partial^2 \psi(x,y)}{\partial y^2} \right) + V(x,y)\psi(x,y) = E\psi(x,y)$$

$$i\hbar \frac{\partial \phi(t)}{\partial t} = E\phi(t)$$

To continue the solution, you can actually use separation of variables again to separate the x and y components, $\psi(x,y) = f(x)g(y)$. This leads to an equation very similar to the 1-D case (details here and here), so we know that $f(x)$ is just the solution to the 1-D model, and $g(y)$ has a similar form (note how the normalization changed):

$$\Psi(x,y,t) = \psi(x,y) \phi(t) = f(x) g(y) \phi(t)$$

$$\Psi(x,y,t) = \sqrt{\frac{4}{L_x L_y}} \sin(k_x x) \sin(k_y y) e^{-i \omega t}$$

Armed with the 2-D expression, you can make some simple adjustments to the previous MATLAB code to view a time-simulation of the function.

Here is the time-simulation for $(n_x,n_y) = (4,4)$. In this case, the spots where the wave function is always zero are more numerous, and form a grid.

View the code for the 2-D time-simulation of (4,4)

In this last simulation I take it a step further and do the simulation for several combinations of  $(n_x,n_y)$:

View code for the full 2-D time-simulation

### Feedback

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

### Learn More

Tags:
11 replies
1. 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.

2. 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 ;)

3. Josh Meyer says:

Thanks guys, glad it was clear enough for non-physicists to follow!If you have any suggestions for future topics please let me know.

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 chorent wave frequency or pattern across the whole box was accomodated. Is that threshold Plank 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. 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?

6. 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:

to something like this:

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. :

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$$

7. 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. :?: 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.