#### [SOLVED] 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?

#### @Siva 2013-05-16 22:25:12

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.

#### @Kai Li 2020-07-17 17:24:48

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

#### @tparker 2020-07-18 14:48:03

@KaiLi I don't think that's correct; see my comment to joshphysics's answer below.

#### @Qmechanic 2013-05-16 22:23:46

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.

#### @Alex Zeffertt 2017-08-21 08:45:02

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?

#### @Qmechanic 2017-08-21 09:07:13

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.

#### @tparker 2018-10-13 22:57:17

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.

#### @Qmechanic 2018-10-14 05:50:31

$\uparrow$ I agree. I updated the answer.

#### @tparker 2018-01-27 23:28:42

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.

#### @Kai Li 2020-07-17 09:49:57

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?

#### @Kai Li 2020-07-17 09:52:50

Changing the value at any set of points of Lebesgue measure zero may change a continuous wavefunction to an uncontinuous one, right?

#### @tparker 2020-07-17 21:43:21

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

#### @Kai Li 2020-07-20 17:19:47

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

#### @tparker 2020-07-20 20:27:08

@KaiLi No, that's not what I mean by my comment. The point is that strictly speaking, the a linear combination is finite by definition. Any time you talk about an "infinite linear combination," you're speaking loosely. Therefore, the definition of a "basis" becomes subtle for infinite-dimensional vector spaces. If you take the usual definition of basis - "a set of (lin. indep.) vectors that span the space under linear combinations", which remember must be finite - and apply it to an infinite-dimensional vector space, then you get the notion of a Hamel basis. But these are actually not ...

#### @tparker 2020-07-20 20:30:04

... very useful for infinite-dimensional spaces. In particular, they can never be orthonormal. So in practice we prefer to use an "orthonormal basis of a Hilbert space", which is not actually a basis under the standard definition. An O.N. basis of a Hilbert space is a set of O.N. vectors whose span (under finite linear combinations) is dense in the Hilbert space, but does not necessarily equal the whole Hilbert space. Since it's dense, you can get closer and closer to any particular vector in the Hilbert space by choosing a sequence of "better" finite linear combinations.

#### @tparker 2020-07-20 20:32:30

... This is what we mean when we loosely talk about an "infinite linear combination": a (Cauchy) sequence of finite linear combinations that gets closer and closer to a particular vector in the Hilbert space. For any fixed O.N. basis of a Hilbert space, the vast majority of the vectors in the Hilbert space cannot be expressed as a finite linear combination of basis vectors.

#### @Kai Li 2020-07-20 21:12:16

I see, thanks for your detailed explanations, I have learned much.

#### @Kai Li 2020-07-21 16:50:40

Hi, I still have some questions about the space of square-integrable continuous functions, let's denote this space as $L^2_c$. By definition, $L^2_c$ should be a Hilbert space, because a finite linear combination of vectors is still a vector inside $L^2_c$, and $L^2_c$ has a valid inner product as defined in your above answer. Am I right? If so, then $L^2_c$ should be a subspace of $L^2(R)$. Now my question is: What are the basis vectors of $L^2_c$?

#### @Kai Li 2020-07-21 17:15:50

My understanding is: $L^2_c$ and $L^2(R)$ share the same basis vectors $\left | n \right \rangle$, and the discontinuous functions, which are infinite linear combinations of $\left | n \right \rangle$, lie outside $L^2_c$ but inside $L^2(R)$.

#### @tparker 2020-07-22 00:21:01

@KaiLi $L^2_c$ is not a Hilbert space. The fact that it is closed under finite linear combinations only makes it a vector space, and the inner product makes it an inner product space. However, this inner product space is not complete, because (roughly speaking) $L^2_c$ is not closed under infinite linear combinations. (More precisely: there exists a sequence of continuous functions in $L^2_c$ that is Caucy with respect to the distance function induced by the inner product, but which converges pointwise to a discontinuous function outside of $L^2_c$.) Therefore $L^2_c$ is a vector ...

#### @tparker 2020-07-22 00:24:30

subspace of $L^2$, but is not a Hilbert subspace of $L^2$. Since $L^2_c$ is infinite-dimensional but is not a Hilbert space, you can't talk about an "orthonormal basis" is the same sense that a Hilbert space has. There is no meaningful countable basis for $L^2_c$.

#### @Kai Li 2020-07-27 18:50:32

I see. You are right, $L^2_c$ is not complete and hence is not a Hilbert space.

#### @joshphysics 2013-05-17 00:49:21

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.

#### @P. C. Spaniel 2016-11-24 15:47:33

If Dirac deltas are not elements of L^2 then how can we expand eigenfunctions of the armonic oscillator in terms of that basis?

#### @DanielC 2017-11-23 20:00:19

@P.C.Spaniel By moving to the dual space (this is possible by en.wikipedia.org/wiki/Riesz_representation_theorem)

#### @Jannik Pitt 2020-06-01 11:40:03

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

#### @DanielC 2020-06-01 12:35:23

The space of temperate distributions is the dual of space of all Hamiltonian eigenfunctions.

#### @Kai Li 2020-07-17 18:04:56

@P. C. Spaniel My understanding is that we can view Dirac deltas as the basis of some larger space which contains $L^2(R)$ as a subspace.

#### @tparker 2020-07-17 21:37:42

@KaiLi I don't think that's entirely correct. It's true that physicists consider formal "wavefunctions" that lie in spaces larger than $L^2(\mathbb{R}^N)$, such a the space of tempered distributions, which includes things like delta functions. But Dirac deltas do not form a "basis" (or at least a Hamel basis) of that space, because you are only allowed to take a finite linear combination of basis vectors in order to span a space, and for ...

#### @tparker 2020-07-17 21:38:36

... infinite-dimensional vector spaces you usually need to take "infinite linear combinations". The fact that you need "infinite linear combinations" is the source of all the complications - it's a tricky notion to formalize.

#### @Kai Li 2020-07-18 04:00:52

@joshphysics Ok, thank you.

#### @Kai Li 2020-07-18 10:57:26

@tparker So this equation $\left | x \right \rangle=\sum _{n=0}^\infty \left \langle n | x \right \rangle \left | n \right \rangle$ is wrong, right? where $\left | n \right \rangle$ are the orthonormal energy eigenstates of the harmonic oscillator.

#### @tparker 2020-07-18 14:40:58

@KaiLi No, that equation is actually correct. We have the completeness relation for the Hermite functions $\delta(y-x) = \langle y | x \rangle = \sum_{n=0}^\infty \langle y | n \rangle \langle n | x \rangle = \sum_{n=0}^\infty \psi_n(y) \psi_n^*(x)$. (The complex conjugate doesn't matter because the $\psi_n$ are all real.) Since this equation holds for all basis bras $\langle y |$, we can remove the $\langle y|$ get from the identity above and get your formula.

#### @Kai Li 2020-07-18 16:52:39

@tparker I'm a little confused now. If the above equation is correct (meaning that $\left | x \right \rangle$ can be expressed in terms of $\left |n \right \rangle$ ), then we can infer that $\left | x \right \rangle$ belong to the true Hilbert space. But, as we know, $\left | x \right \rangle$ do not belong to the true Hilbert space.

#### @joshphysics 2020-07-18 18:25:20

@KaiLi The fact that any vector in a Hilbert space can be expanded in the orthonormal basis doesn't mean that those same basis vectors can't also be used to represent things not in the Hilbert space. However, this is tricky because of what it means when you write the equals sign -- you have to be careful about what notion of convergence you're using. When we say that a distribution, like $|x\rangle$ "equals" an infinite linear combination of basis vectors, this means something different than when we say a Hilbert space vector does.

#### @Kai Li 2020-07-18 19:03:54

@joshphysics Ok, I am getting more clearer, thank you. So now my understanding is: If an infinite linear combination of basis vectors converge (in the usual sense), then this infinite linear combination must converge to (or equal to) a (usual) vector inside the Hilbert space. Right?

#### @Kai Li 2020-07-18 19:23:10

Furthermore, let's ignore the rigorous mathematics, life may be easier if we consider an infinite dimensional "physical Hilbert space" which allows two bases with different cardinality, e.g., a continuous (uncountable) basis vs. a discrete (countable) basis, and states like $\left | x \right \rangle$ belong to this "physical Hilbert space". IIRC, the name "physical Hilbert space" has indeed appeared in the physics community, but I don't know if its meaning the same as above.

#### @tparker 2020-07-18 20:25:24

@KaiLi Ah, I realize that I made a mistake in my earlier comments beneath my answer (which I have deleted). A Hilbert space's being "complete" only means that every Cauchy sequence of vectors converges to a vector in the Hilbert space. But you can have non-Cauchy sequences converge to vectors (in this case functions) that lie outside of the Hilbert space. (Although as joshphysics says, you need to be careful about what you mean by "converge".) So no, an infinite linear combination of basis vectors can converge (pointwise) to a vector that lies outside of the Hilbert space. The resolution...

#### @tparker 2020-07-18 20:27:23

... of the Dirac delta function in the eigenbasis of the harmonic oscillator is one such example. The reason that it's allowed to converge to a vector outside of the Hilbert space is that (I think) the sequence of partial sums is not Cauchy.

#### @tparker 2020-07-18 20:34:31

@KaiLi If we let $|x_0, N\rangle$ be the nascent delta function $\sum_{n=0}^N \psi_n(x_0) |n\rangle$ that is centered near (but not exactly at) the point $x_0$, then a straightforward calculation gives that the metric distance $d(|x_0, N \rangle, |x_0, N'\rangle) = \sum_{n=N+1}^{N'} |\psi_n(x_0)|^2$. I believe that this series diverges as $N' \to \infty$ with $N$ held fixed at any value, so the sequence of partial sums is not Cauchy, and so the full series is not required to converge to a vector in the Hilbert space.

#### @tparker 2020-07-18 20:45:53

@KaiLi Just checked on Mathematica, and indeed, at least for $x_0 = 0$ the series $\sum_n |\psi_n(x_0)|^2$ diverges, so the sequence of partial sums is not Cauchy and the infinite linear combination does not need to converge to a vector in the Hilbert space.

#### @Kai Li 2020-07-19 16:42:06

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