# Hilbert space of harmonic oscillator: Countable vs uncountable?

Hm, this just occurred to me while answering another question:

If I write the Hamiltonian for a harmonic oscillator as $$H = \frac{p^2}{2m} + \frac{1}{2} m \omega^2 x^2$$ then wouldn't one set of possible basis states be the set of $\delta$-functions $\psi_x = \delta(x)$, and that indicates that the size of my Hilbert space is that of $\mathbb{R}$.

On the other hand, we all know that we can diagonalize $H$ by going to the occupation number states, so the Hilbert space would be $|n\rangle, n \in \mathbb{N}_0$, so now the size of my Hilbert space is that of $\mathbb{N}$ instead.

Clearly they can't both be right, so where is the flaw in my logic?

• Isn't this basically the same question as whether a periodic function has a countable or uncountable number of degrees of freedom, since it can be defined by specifying $f(x)$ for each of the uncountably many $x$, or by specifying the countably many Fourier coefficients? – tparker Jan 12 '17 at 23:13

This question was first posed to me by a friend of mine; for the subtleties involved, I love this question. :-)

The "flaw" is that you're not counting the dimension carefully. As other answers have pointed out, $$\delta$$-functions are not valid $$\mathcal{L}^2(\mathbb{R})$$ functions, so we need to define a kosher function which gives the $$\delta$$-function as a limiting case. This is essentially done by considering a UV regulator for your wavefunctions in space. Let's solve the simpler "particle in a box" problem, on a lattice. The answer for the harmonic oscillator will conceptually be the same. Also note that solving the problem on a lattice of size $$a$$ is akin to considering rectangular functions of width $$a$$ and unit area, as regulated versions of $$\delta$$-functions.

The UV-cutoff (smallest position resolution) becomes the maximum momentum possible for the particle's wavefunction and the IR-cutoff (roughly max width of wavefunction which will correspond to the size of the box) gives the minimum momentum quantum and hence the difference between levels. Now you can see that the number of states (finite) is the same in position basis and momentum basis. The subtlety is when you take the limit of small lattice spacing. Then the max momentum goes to "infinity" while the position resolution goes to zero -- but the position basis states are still countable!

In the harmonic oscillator case, the spread of the ground state (maximum spread) should correspond to the momentum quantum i.e. the lattice size in momentum space.

## The physical intuition

When we consider the set of possible wavefunctions, we need them to be reasonably behaved i.e. only a countable number of discontinuities. In effect, such functions have only a countable number of degrees of freedom (unlike functions which can be very badly behaved). IIRC, this is one of the necessary conditions for a function to be fourier transformable.

ADDENDUM: See @tparker's answer for a nice explanation with a slightly more rigorous treatment justifying why wavefunctions have only countable degrees of freedom.

1. The Hilbert space $${\cal H}$$ of the one-dimensional harmonic oscillator in the position representation is the set $$L^2(\mathbb{R})={\cal L}^2(\mathbb{R})/{\cal N}$$ (of equivalence classes) of square integrable functions $$\psi:\mathbb{R}\to\mathbb{C}$$ on the real line. The equivalence relation is modulo measurable functions that vanish a.e.

2. The Dirac delta distribution $$\delta(x-x_{0})$$ is not a function. It is a distribution. In particular, it is not square integrable, cf. this Phys.SE post.

3. One may prove that all infinite-dimensional separable complex Hilbert spaces are isomorphic to the set $${\ell}^{2}(\mathbb{N})~:=~\left\{(x_n)_{n\in\mathbb{N}}\mid\sum_{n\in\mathbb{N}} |x_n|^2 <\infty\right\}$$ of square integrable complex sequences.

• I was going to ask the same question as the OP till I found this and your answer. I still have one question though: what do physicists then mean when they talk about the $|x\rangle$ basis? Whatever it is, if these ket vectors are distinguishable then there must be uncountably many? – Alex Zeffertt Aug 21 '17 at 8:45
• Yes, $|x\rangle$ is labelled by the real numbers $x\in\mathbb{R}$, which is uncountable. See also e.g. rigged Hilbert spaces & this Phys.SE post. – Qmechanic Aug 21 '17 at 9:07
• The Hilbert space $L^2(\mathbb{R})$ is not "the space of square-integrable functions $\psi: \mathbb{R} \to \mathbb{C}$ on the real line" $\mathcal{L}^2(\mathbb{R})$, which in fact is not a Hilbert space at all. It's the quotient of $\mathcal{L}^2(\mathbb{R})$ by the kernel of the $L^2$ norm, as I explain in my answer. This isn't just a mathematical technicality: this quotient is both physically necessary and provides the "subtraction by the cardinality of the continuum" that reduces the dimensionality of the vector space from uncountable down to countable. – tparker Oct 13 '18 at 22:57
• $\uparrow$ I agree. I updated the answer. – Qmechanic Oct 14 '18 at 5:50

One needs to be careful about what one mean by the "size" of a vector space.

A theorem of functional analysis tells us that any two Hilbert bases for a Hilbert space must have the same cardinality. This allows us to define the Hilbert dimension of a Hilbert space as the cardinality of any Hilbert basis.

The Hilbert space for the one-dimensional harmonic oscillator is $L^2(\mathbb R)$. We know that there exists at least one countable orthonormal basis for $L^2(\mathbb R)$. It's the basis we commonly call $\{|0\rangle, |1\rangle, \dots\}$ when discussing the physics of the oscillator. Therefore, the Hilbert dimension of $L^2(\mathbb R)$ is $\aleph_0$.

Dirac deltas are not elements of $L^2(\mathbb R)$, so there is no contradiction.

• If Dirac deltas are not elements of L^2 then how can we expand eigenfunctions of the armonic oscillator in terms of that basis? – P. C. Spaniel Nov 24 '16 at 15:47
• @P.C.Spaniel By moving to the dual space (this is possible by en.wikipedia.org/wiki/Riesz_representation_theorem) – DanielC Nov 23 '17 at 20:00

The previous answers are all correct, but I thought I'd give a more conceptual explanation for why the delta-function basis is the "wrong" basis in which to expand when counting degrees of freedom. Since the situation is much, much more complicated in QFT, for simplicity I'll only consider first-quantized wavefunctions for a system with a fixed, finite number of particles, so that the configuration space is just $\mathbb{R}^n$ for some finite $n$. (If you don't know what "configuration space" is, all that really matters for this question is that for a single-particle system, it's the same as real space.)

Physicists often say that for these systems, "the Hilbert space $L^2(\mathbb{R}^n)$ is the space of square-integrable functions on $\mathbb{R}^n$, with inner product $\langle f | g \rangle := \int_{\mathbb{R}^n} d^nx\ f^*({\bf x})\, g({\bf x}).$" But this definition is wrong, because that isn't actually a valid inner product on that space! The problem is that it violates the positive-definiteness requirement for the inner product that $||\psi|| = 0 \implies | \psi \rangle = 0$: if a function $f$ is supported on a nonempty set of Lebesgue measure zero, then the "norm" $\int_{\mathbb{R}^n} d^nx\ |f({\bf x})|^2 = 0$. Since this "norm" is zero for some nonzero vectors, it is more properly only a seminorm on the space of square-integrable functions on $\mathbb{R}^n$. This function space is denoted $\mathcal{L}^2(\mathbb{R}^n)$ (note the different script for the "$\mathcal{L}$") and is therefore only a seminormed vector space.

To convert $\mathcal{L}^2(\mathbb{R}^n)$ into a true Hilbert space, we need to mod it out by the vector space of functions whose support has Lebesgue measure zero. In other words, we define an equivalence relation $f \sim g$ between functions $f({\bf x})$ and $g({\bf x})$ that agree almost everywhere, and then define the Hilbert space $L^2(\mathbb{R}^n)$ to be the space of equivalence classes under this equivalence relation. So two square-integrable functions $\psi({\bf x})$ and $\phi({\bf x})$ which are equal almost everywhere, but differ on a set of Lebesgue measure zero, actually correspond to the exact same state $|\psi\rangle$ in the Hilbert space. This fixes the problem, because now all those problematic functions whose support has Lebesgue measure zero correspond to the zero vector of the Hilbert space, so it's fine for them to have norm zero.

This is more than just a technical trick only performed in order to satisfy the mathematical definition of an inner product - it's actually the right thing to do physically. Remember that the value of $|\psi({\bf x})|^2$ at a particular point ${\bf x}$ isn't actually a probability - it's a probability density, which is not a directly physical quantity. You can't directly measure the probability density at a single point; you can only measure the probability $P(V) = \int_V d^nx\, |\psi({\bf x})|^2$ for a particle to be found in a (potentially very small) region $V$. But if two wavefunctions $\psi, \phi \in \mathcal{L}^2(\mathbb{R}^n)$ only differ on a set of Lebesgue measure zero, then $P(V) = \int_V d^nx\, |\psi({\bf x})|^2 = \int_V d^nx\, |\phi({\bf x})|^2$ will be the same for any region $V$. Therefore all physically measurable quantities will be the same for these two wavefunctions, and so they correspond to the same physical state $| \psi \rangle \in L^2(\mathbb{R}^n)$.

The point of all this is that any wavefunction $\psi({\bf x})$ carries a whole lot of extra, unphysical information (beyond just the overall phase factor, which you're probably used to). Changing its value at any set of points of Lebesgue measure zero doesn't actually change the state. The (uncountable) delta-function basis is too "fine" and picks out all these irrelevant unphysical degrees of freedom. The (countable) oscillator-eigenstate basis, on the other hand, is much less sensitive to the details of the wavefunction: changing $\psi({\bf x})$ on any set of Lebesgue measure zero doesn't change any of the expansion coefficients $\langle \psi_n | \psi \rangle$. These coefficients therefore only record information about the physical degrees of freedom, of which there are only countably many.

By the way, the Hilbert space $L^2 \left( \mathbb{R}^d \right)$ is the same for the free particle as for the harmonic oscillator, so everything in this answer carries over directly to the companion question about the free-particle Hilbert space.