---
title: The infinite square well
heading: The simplest confined particle, solved completely
eyebrow: B10 · Lesson 6 · The infinite square well
xp: 40
---

::: hook
A quantum-well laser, a quantum-well infrared photodetector and the channel of a thin-body transistor all trap electrons in a layer a few nanometers thick. The simplest model of that is the **infinite square well**: a particle free to move between two walls it can't pass. It's worth solving completely, because every idea of the formalism shows up in it in a form you can compute by hand: quantized energies, orthogonal eigenfunctions, expanding any starting state in them with a Fourier series, and the motion that follows.
:::

::: play
- The solid curve is a starting state, $\Psi(x, 0) = \sqrt{30}\,x(1 - x)$ in a well from 0 to 1. The dashed curve adds up its first few eigenstates, $\sum c_n\psi_n$; raise N to include more.
- With only the ground state the match is already close: $\lvert c_1\rvert^2$ = 0.9986. The parabola looks almost exactly like a half sine.
- The readout adds up $\lvert c_n\rvert^2$ for the terms included. It approaches 1, because the eigenstates are complete: any state that vanishes at the walls is some mixture of them.
:::
:::

```sim plot
view: graph
x: x = 0..1
y: y = -0.2..1.8
slider: N = 1..9 step 2 = 1
plot: sqrt(30)*x*(1 - x) | label: Ψ(x, 0)
plot: 8*sqrt(30)/pi^3*(sin(pi*x) + step(N - 2.5)*sin(3*pi*x)/27 + step(N - 4.5)*sin(5*pi*x)/125 + step(N - 6.5)*sin(7*pi*x)/343 + step(N - 8.5)*sin(9*pi*x)/729) | dashed | label: sum through n = N
readout: probability in the terms so far = 960/pi^6*(1 + step(N - 2.5)/729 + step(N - 4.5)/15625 + step(N - 6.5)/117649 + step(N - 8.5)/531441)
```

::: predict
## Which energies are possible for an electron in an infinite well?

- [ ] Any energy above zero
- [ ] Any energy above $E_1$
- [x] Only $E_1, 4E_1, 9E_1, \ldots$
- [ ] Only $E_1, 2E_1, 3E_1, \ldots$

::: reveal
Only $n^2E_1$. A wave confined between two walls where it must vanish fits only if a whole number of half wavelengths spans the well, so $k = n\pi/L$, and the energy $\frac{\hbar^2k^2}{2m}$ goes as $n^2$. The gaps grow with n, unlike a harmonic oscillator's (lesson 7).
:::
:::

::: nameit
## Solving it

Inside the well V = 0, so $\psi'' = -k^2\psi$ with $k = \sqrt{2mE}/\hbar$, giving $\psi = A\sin kx + B\cos kx$. Outside, ψ = 0. Continuity at x = 0 kills the cosine; at x = L it needs $\sin kL = 0$, so

$$k_n = \frac{n\pi}{L}, \qquad E_n = \frac{n^2\pi^2\hbar^2}{2mL^2}, \qquad \psi_n = \sqrt{\frac2L}\sin\frac{n\pi x}{L}, \qquad n = 1, 2, 3, \ldots$$

ψ′ jumps at the walls, which is allowed only because V is infinite there.

## Properties

- **Nodes:** $\psi_n$ has n − 1 zeros inside. More wiggles means more kinetic energy.
- **Symmetry:** about the center, odd-n states are even and even-n states are odd.
- **Orthonormal:** $\int\psi_m^*\psi_n\,dx = \delta_{mn}$.
- **Complete:** any reasonable f(x) that vanishes at the walls is $\sum c_n\psi_n$.

## Fourier's trick

Orthonormality picks out each coefficient:

$$c_n = \int_0^L\psi_n(x)\Psi(x, 0)\,dx, \qquad \sum\lvert c_n\rvert^2 = 1, \qquad \langle H\rangle = \sum\lvert c_n\rvert^2E_n$$

Then $\Psi(x, t) = \sum c_n\psi_ne^{-iE_nt/\hbar}$. Since every $E_n$ is a whole multiple of $E_1$, the state returns exactly to its start after the **revival time** $T = h/E_1$.

## Real wells: effective mass

An electron in a semiconductor moves as though its mass were $m^*$; in GaAs, $m^* = 0.067m_e$. That multiplies every energy by 15: $E_n = \frac{5.61n^2}{L^2}$ eV with L in nm. Real wells have finite walls (lesson 12), which lowers the levels somewhat.
:::

::: example
## Find the $c_n$ for $\Psi(x, 0) = \sqrt{30}\,x(1 - x)$ in a unit well, and check ⟨H⟩.

::: solution
1. **Fourier's trick.**
   $$\begin{aligned} c_n &= \sqrt{60}\int_0^1x(1 - x)\sin(n\pi x)\,dx \\ &= \sqrt{60}\cdot\frac{2(1 - (-1)^n)}{(n\pi)^3} \end{aligned}$$
2. **Odd and even n.** So $c_n = \frac{8\sqrt{15}}{(n\pi)^3}$ for odd n and 0 for even n (the state is symmetric):
   $$\begin{aligned} c_1 &= 0.9993 \\ c_3 &= 0.0370 \end{aligned}$$
3. **⟨H⟩ directly.**
   $$\begin{aligned} \langle H\rangle &= -\frac{\hbar^2}{2m}\int\Psi\Psi''dx \\ &= \frac{\hbar^2}{2m}\cdot 60\int_0^1x(1 - x)\,dx \\ &= \frac{10\hbar^2}{2m} \end{aligned}$$
4. **Compare with the ground state.** That's $\frac{10}{\pi^2} = 1.013$ times $E_1$: just above the ground state, as a mixture that's 99.86% ground state should be.

**Answer:** $c_n = \frac{8\sqrt{15}}{(n\pi)^3}$ for odd n and 0 for even n ($c_1 = 0.9993$, $c_3 = 0.0370$), and ⟨H⟩ = 1.013 $E_1$.
:::
:::

::: example
## A 10 nm GaAs quantum well absorbs light by lifting electrons from level 1 to level 2. What wavelength?

::: solution
1. **Level 1.**
   $$\begin{aligned} E_1 &= \frac{0.376}{0.067 \times 100} \\ &= 56\ \text{meV} \end{aligned}$$
2. **The gap.**
   $$\begin{aligned} E_2 - E_1 &= 3E_1 \\ &= 168\ \text{meV} \end{aligned}$$
3. **Wavelength.**
   $$\begin{aligned} \lambda &= \frac{1240\text{ eV·nm}}{0.168\text{ eV}} \\ &= 7.4\ \text{µm} \end{aligned}$$
4. **Where that sits.** That's the thermal infrared, and the well width tunes it: this is how quantum-well infrared photodetectors and quantum cascade lasers choose their wavelengths.

**Answer:** the well absorbs at 7.4 µm.
:::
:::

::: example
## A particle in a box starts with a flat wave function, $\psi = \frac{1}{\sqrt L}$. What is the chance of finding it in the ground state, and in the third?

::: solution
1. **Fourier's trick.**
   $$\begin{aligned} c_n &= \int_0^L\sqrt{\frac2L}\sin\frac{n\pi x}{L}\frac{1}{\sqrt L}dx \\ &= \frac{2\sqrt2}{n\pi} \end{aligned}$$
   for odd n, and 0 for even n.
2. **Ground state.**
   $$\begin{aligned} |c_1|^2 &= \frac{8}{\pi^2} \\ &= 0.811 \end{aligned}$$
3. **Third state.**
   $$\begin{aligned} |c_3|^2 &= \frac{8}{9\pi^2} \\ &= 0.090 \end{aligned}$$
4. **Why the even states are missing.** The flat state is symmetric about the middle and they're antisymmetric.
5. **Check the total.** The probabilities add to 1 over the odd states, which is also a neat way to prove $\sum\frac{1}{n^2} = \frac{\pi^2}{8}$ over odd n:
   $$\frac{8}{\pi^2}\left(1 + \frac19 + \frac1{25} + \cdots\right) = 1$$

**Answer:** the chance of the ground state is 0.811, and of the third state 0.090.
:::
:::

::: check
given: n = 2 | 3 | 4; L = 5 | 8 | 12
answer: 5.6124*n^2/L^2*1000
unit: meV
tolerance: 0.5%

## What's $E_{\given{n}}$ for an electron in a GaAs well {L} nm wide, treated as infinite ($m^* = 0.067m_e$)?

::: right
Right. $\frac{5.61n^2}{L^2}$ eV = {answer} meV.
:::

::: misses
- [0.37603*n^2/L^2*1000] Use the effective mass: divide by 0.067.
- [5.6124*n/L^2*1000] The energy goes as $n^2$.
- [any] Not yet. $E_n = \frac{0.376n^2}{0.067L^2}$ eV.
:::
:::

::: check
given: L = 6 | 10 | 15
answer: 1.23984/(3*5.6124/L^2)
unit: µm
tolerance: 0.5%

## What wavelength does a GaAs well {L} nm wide absorb, going from level 1 to 2?

::: right
Right. $\lambda = \frac{hc}{3E_1}$ = {answer} µm.
:::

::: misses
- [1.23984/(5.6124/L^2)] The gap is $E_2 - E_1 = 3E_1$.
- [any] Not yet. $E_1 = 5.61/L^2$ eV; hc = 1.240 eV·µm.
:::
:::

::: check
given: n = 3 | 5 | 7
answer: 8*sqrt(15)/(n*pi)^3
tolerance: 0.1%

## For $\Psi(x, 0) = \sqrt{30}\,x(1 - x)$ in a unit well, what's $c_{\given{n}}$?

::: right
Right. $\frac{8\sqrt{15}}{(n\pi)^3}$ = {answer}.
:::

::: misses
- [(8*sqrt(15)/(n*pi)^3)^2] That's $\lvert c_n\rvert^2$, the probability.
- [any] Not yet. $c_n = \int_0^1\sqrt2\sin(n\pi x)\sqrt{30}\,x(1 - x)\,dx$.
:::
:::

::: check
given: L = 1 | 2 | 5
answer: 10.998*L^2
unit: fs
tolerance: 0.5%

## A free electron's state in a well {L} nm wide: after how long does any state return exactly to its start?

::: right
Right. $T = \frac{h}{E_1}$ = {answer} fs.
:::

::: misses
- [10.998*L^2/(2*pi)] Use h, not ħ: the phases must all advance by whole multiples of 2π.
- [any] Not yet. $E_1 = 0.376/L^2$ eV and h = 4.136 eV·fs.
:::
:::

::: check
given: n = 1 | 3 | 5
answer: 0.25 - sin(n*pi/2)/(2*n*pi)
tolerance: 0.1%

## In state $\psi_{\given{n}}$ of a unit well, what's the probability of finding the particle in the first quarter, 0 to ¼?

::: right
Right. $\frac14 - \frac{\sin(n\pi/2)}{2n\pi}$ = {answer}.
:::

::: misses
- [0.25] Close for large n, but the walls and the wiggles make it differ.
- [any] Not yet. $\int_0^{1/4}2\sin^2(n\pi x)\,dx$.
:::
:::

::: check
kind: choice

## A state starts as $\Psi(x, 0) = \frac{1}{\sqrt2}(\psi_1 + \psi_3)$. Which is true?

- [ ] Its probability density never changes
- [x] Measuring the energy gives $E_1$ or $9E_1$, each half the time
- [ ] ⟨x⟩ swings from side to side
- [ ] Measuring the energy gives $5E_1$

::: misses
- [1] Two energies beat, so $\lvert\Psi\rvert^2$ changes at $(E_3 - E_1)/\hbar$.
- [3] Both states are symmetric about the middle, so ⟨x⟩ stays at the center; the density breathes.
- [4] That's ⟨H⟩; no single measurement gives it.
:::
:::

::: check
kind: parts
given: n = 3 | 5 | 7

## A box particle starts with the flat wave function $\frac{1}{\sqrt L}$.

::: part
answer: 8/(n^2*pi^2)
tolerance: 0.5%

### What is the chance of finding it in state {n}?

::: misses
- [8/(n*pi^2)] $c_n$ goes as $\frac1n$, so the probability goes as $\frac{1}{n^2}$.
- [any] $|c_n|^2 = \frac{8}{n^2\pi^2}$ for odd n.
:::
:::

::: part
answer: 0
tolerance: 0.5%

### What is the chance of finding it in state {n} + 1?

::: misses
- [any] Even states are antisymmetric about the middle; the flat state is symmetric.
:::
:::
:::

::: check
kind: derivation
vars: n = 1..7

## Fourier's trick on the flat state $\frac{1}{\sqrt L}$, for odd n.

::: step
answer: 2*sqrt(2)/(n*pi)

### What is $c_n$?
:::

::: step
answer: 8/(n^2*pi^2)

### What is the probability of state n?
:::

::: right
Right. The probabilities fall as $\frac{1}{n^2}$ and sum to 1 over odd n.
:::
:::

::: explain
## Why does a particle in an infinite well have only certain energies, while a free particle can have any?

::: model
The Schrödinger equation inside the well has solutions for any energy: sines and cosines of wavenumber $k = \sqrt{2mE}/\hbar$. What restricts them is the boundary conditions. The wave function has to vanish at both walls, and a sine that starts at zero at one wall only returns to zero at the other if a whole number of half wavelengths fits between them. That condition picks out $k = n\pi/L$ and so a discrete set of energies. A free particle has no walls to satisfy, so every k is allowed. It's the same reason a guitar string, held fixed at both ends, sounds only certain pitches.
:::
:::

::: practice

::: check
given: n = 1 | 2; L = 4 | 20
answer: 5.6124*n^2/L^2*1000
unit: meV
tolerance: 0.5%

## $E_{\given{n}}$ in a {L} nm GaAs well?

::: misses
- [any] $\frac{5.61n^2}{L^2}$ eV.
:::
:::

::: check
given: L = 5 | 6 | 10 | 12 | 15 | 20
answer: 1.23984/(3*5.6124/L^2)
unit: µm
tolerance: 0.5%

## Level 1 to 2 wavelength in a {L} nm GaAs well?

::: misses
- [any] $\frac{hc}{3E_1}$.
:::
:::

::: check
given: n = 1 | 3 | 5 | 7 | 9 | 11
answer: 8*sqrt(15)/(n*pi)^3
tolerance: 0.1%

## $c_{\given{n}}$ for the parabola $\sqrt{30}\,x(1 - x)$?

::: misses
- [any] $\frac{8\sqrt{15}}{(n\pi)^3}$.
:::
:::
:::
