# 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? Jan 12, 2017 at 23:13
• @tparker So for the relevant physical system --- a particle in a box with periodic boundary conditions, the correct basis of the Hilbert space should be the discrete momentum eigenstates, right ? Jul 18, 2020 at 3:59
• @KaiLi Well, which basis of a Hilbert space is "correct" depends on what you're trying to do. But yes, for a purpose like determining whether or not this Hilbert space is separable, the discrete momentum eigenbasis is indeed "better", in the sense that it makes it clear that the Hilbert space is indeed separable because it has a countable orthonormal basis. Jul 18, 2020 at 14:17
• @tparker My understanding is: Just like the harmonic oscillator (or the free-particle) system, the position states do not belong to the true Hilbert space and hence they can not be the basis. Moreover, as pointed in joshphysics's answer, the continuous position states and the discrete basis do not have equal cardinality, so they can't both be the basis of the true Hilbert space. Jul 18, 2020 at 16:39
• @KaiLi Yes, that's correct. What I meant to say is that the discrete momentum eigenstates form a true basis of the Hilbert space of a box with periodic boundary conditions. That is not the only basis. But the position eigenstates do not form a true basis, because as you say they do not actually lie in the true Hilbert space. Jul 18, 2020 at 18:03

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.

• So, here may be an interesting fact: The position states $\left | x \right \rangle$ can not be expressed as a superposition of the energy eigenstates $\left | n \right \rangle$ , since $\left | x \right \rangle$ does not belong to the true Hilbert space. But $\left | n \right \rangle$ can be indeed expressed as a superposition of $\left | x \right \rangle$ . Jul 17, 2020 at 17:24
• @KaiLi I don't think that's correct; see my comment to joshphysics's answer below. Jul 18, 2020 at 14:48
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? Aug 21, 2017 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. Aug 21, 2017 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. Oct 13, 2018 at 22:57
• $\uparrow$ I agree. I updated the answer. Oct 14, 2018 at 5:50

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.

• So the wavefunction and the physical state is many to one correspondence (beyond just the overall phase factor). But if we restrict the wavefunctions to be continuous, then the continuous wavefunction and the physical state become one to one correspondence? And there are only countable continuous wavefunctions which form the basis? Jul 17, 2020 at 9:49
• Changing the value at any set of points of Lebesgue measure zero may change a continuous wavefunction to an uncontinuous one, right? Jul 17, 2020 at 9:52
• @KaiLi Correct, the map from wavefunctions to physical states is many-to-one, even beyond the global phase factor. In fact, the map is uncountably infinitely many-to-one, because there are uncountably infinitely many different functions with Lebesgue measure zero. Jul 17, 2020 at 21:43
• Since many comments below joshphysics's answer, I move to here. Below joshphysics's answer, I understand your comment "...because you are only allowed to take a finite linear combination of basis vectors in order to span a space..." as: Each vector in the Hilbert space is a finite linear combination of basis vectors (do you mean this? ). But the coherent states (which belong to $L^2(R)$, right? ) of the harmonic oscillator are infinite linear combination of basis vectors $\left | n \right \rangle$. Jul 20, 2020 at 17:19
• I see, thanks for your detailed explanations, I have learned much. Jul 20, 2020 at 21:12

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? Nov 24, 2016 at 15:47
• @P.C.Spaniel By moving to the dual space (this is possible by en.wikipedia.org/wiki/Riesz_representation_theorem) Nov 23, 2017 at 20:00
• @DanielC The dual space of any Hilbert space is the Hilbert space itself (up to an isomorphism of course). So if $\delta$ isn't contained in $L^2$, it isn't contained in its dual either. Jun 1, 2020 at 11:40
• @KaiLi I'd recommend reading about "rigged Hilbert space." Jul 17, 2020 at 23:43
• @tparker Very interesting, thanks. And now I get comfortable with the fact that "an infinite linear combination of basis vectors can converge to a vector outside the Hilbert space". My understanding is to make an analogy: For example, the space of rational numbers is closed under finite additions, but infinite addition of rational numbers can converge to an irrational number outside the space of rational numbers, e.g., $e=\sum _{n=0}^\infty \frac{1}{n!}$. Maybe the underlying philosophy is more is different, ha-ha. Jul 19, 2020 at 16:42