# Applying an operator to a function vs. a (ket) vector

I have a question regarding the effect of quantum mechanical operators. The definition that I'm familiar with says that an operator $A$ acts on a vector from a Hilbert space, $|\psi\rangle$, and the result is another vector, $|\psi'\rangle$: $$A |\psi\rangle = |\psi'\rangle$$

However, in class I've also seen operators applied to scalar-valued functions, such as the momentum operator in position space: $$P = - i \hbar \frac{\partial}{\partial x},\quad P \psi(x) = - i \hbar \frac{\partial}{\partial x} \psi(x)$$

However, mathematically, that doesn't make sense to me, since $P$ should operate on a vector, not a (scalar) function! I know that wave functions can be viewed as the coefficients of a state vector when the vector is written in a particular basis, such as $$|\psi\rangle = \int_{-\infty}^\infty |x\rangle \langle x| \,\mathrm{d}x\; |\psi\rangle = \int_{-\infty}^\infty |x\rangle \langle x|\psi\rangle \,\mathrm{d}x = \int_{-\infty}^\infty \psi(x) |x\rangle \,\mathrm{d}x$$ with $$\psi(x) = \langle x|\psi\rangle$$ but, as far as I can tell, the operator should still act on a vector, not on a function alone.

On the Wikipedia article "Operator (physics)", under "Linear operators in wave mechanics", I found the following:

$$A \psi(x) = A \langle x | \psi \rangle = \langle x | A | \psi \rangle$$

However, that last step seems dubious to me. Is it valid to just swap the operator into the inner product like that? In general, I don't see the mathematical meaning of expressions like $A\psi(x)$ or $A \langle x|$, since $A$ can neither act on a scalar value nor on a bra. Does it only work for self-adjoint operators, since we'd then have $A^\dagger = A$, which might help with $A$ acting on bras?

-
Briefly, $\psi(x)$ is to $|\psi \rangle$ as $v^i$ is to $\vec v$. The former are the components of the vector (on some basis) and the later is the vector proper. Similarly, there are the matrix elements of an operator (on some basis) and the operator proper. Operating on the components of a vector with the matrix representation of an operator, even when the components and matrix elements are continuous functions, is not particularly mysterious if you think about it a bit. –  Alfred Centauri Jun 20 at 0:30
$A \psi (x)$ means working in coordinate representation, $$A \psi (x):= \langle x | \hat{A} | \psi \rangle$$. –  user26143 Jun 20 at 9:57
@user26143 This is similar to the comment I posted on Trimok's answer, but your comment creates the same question for me: Does that mean that the example I quoted from Wikipedia is incorrect? After all, with your definition, that would mean $$A \psi(x) = \langle x | A | \psi \rangle \ne A \langle x | \psi \rangle$$ That last expression doesn't make mathematical sense to me to begin with. Am I correct with this? –  Socob Jun 20 at 19:14
For me, abstract operator acts on abstract vector. It's not clear to me what does $A \langle x | \psi \rangle$ mean. It may mean regarding $\langle x | \psi \rangle$ as a $c$-number , then $A \langle x | \psi \rangle = \langle x | \psi \rangle A$, which seems not the wiki suppose to say. –  user26143 Jun 21 at 5:13

Your confusion stems from the fast that this is a mixture of abuse of notation and having different Hilbert spaces to work with:

Generally the abstract operator $A$ acts on some abstract vector $|\psi\rangle$, for example the momentum operator $\hat p$ acts on its eigenstates $|p\rangle$ by $\hat p |p \rangle = p |p \rangle$.

In the wavefunction formalism, we say that for a Hilbert space that has some position basis $|x\rangle$, we can switch to the space of square-integrable functions $L^2(\mathbb{R})$ without loss of information by defining $\psi(x) = \langle x | \psi \rangle$. This $\psi(x)$ now is a scalar function, and it is a vector as an element of the Hilbert space $L^2(\mathbb{R})$. Now, operators on this Hilbert space must be operators on the functions, and it just so hpapens that the explicit form of the momentum operator is $\hat p = \mathrm{i}\hbar \partial_x$. This can be seen by considering the momentum operator as the generator of translations as per $T(\delta x) = 1 - \frac{\mathrm{i}}{\hbar}\hat p \delta x$ which must act as $T(\delta x) |x\rangle = |x + \delta x\rangle$ and then appying this to some $|\psi\rangle$. Let me know if you wish me to carry out that (not overly long) calculation.

In general, the kets $|\psi\rangle$ are elements of an abstract Hilbert space $\mathcal{H}$, we know nothing more about them.

In the context we are discussing, $\mathcal{H}$ is the space of states of a particle moving in one dimension, which we will call $\mathcal{H}_{1D}$. It is constructed by saying that there is an operator $\hat x$ on $\mathcal{H}_{1D}$ and a set of states $X := \{|x\rangle | x \in \mathbb{R} \}$ which are the eigenvectors of $\hat x$, i.e $\hat x | x \rangle = x | x \rangle\forall |x\rangle \in X$, and demanding that $X$ is a basis of $\mathcal{H}_{1D}$.

Now, consider the Hilbert space of square integrable functions $f : \mathbb{R} \rightarrow \mathbb{C}$, denoted $L^2(\mathbb{R},\mathbb{C})$. To every function $\psi :\mathbb{R} \rightarrow \mathbb{C}$ with $\psi \in L^2(\mathbb{R},\mathbb{C})$, we define the map $$\mathrm{Ket}: L^2(\mathbb{R},\mathbb{C})\rightarrow \mathcal{H}_{1D}, \psi \mapsto|\psi\rangle := \int_{-\infty}^\infty\psi(x)|x\rangle\mathrm{d}x$$

Certainly, different functions $\psi,\psi'$ cannot generate the same ket this way, since for $\psi \neq \psi'$, we must have $\psi(x_0) \neq \psi'(x_0)$ at some $x_0 \in \mathbb{R}$, so the generated kets will differ, since the coefficient of at least one basis ket differs between them. Thus, this map is injective, and no information is lost.

Conversely, for a given ket $|\psi\rangle$ define the map

$$\mathrm{Func} : \mathcal{H}_{1D} \rightarrow L^2(\mathbb{R},\mathbb{C}), |\psi\rangle\mapsto (\psi : \mathbb{R} \rightarrow \mathbb{C}, x \mapsto \langle x | \psi \rangle)$$

Ignoring that fact that the $\psi$ here is not always really a function, but belongs to the larger space of tempered distributions containing $L^2(\mathbb{R},\mathbb{C})$, we can again see that different kets cannot produce the same function $\psi$, since $\langle x | \psi\rangle$ gives the coefficents in the basis $X$, and two vectors with identical basis coefficents are identical. Thus, this map is also injective, and so also does not forget information.

Again, if you ignore the mathematical subtleties (which you shouldn't after you have become comfortable with the basic concepts!), these maps are actually inverses of each other, and thus show that there is no difference in the information encoded in $\mathcal{H}_{1D}$ and $L^2(\mathbb{R},\mathbb{C})$.

What about operators? Let me just exemplfy this for the position operator $\hat x$. The scalar product of $L^2(\mathbb{R},\mathbb{C})$ is given by

$$(\psi,\phi) = \int_{-\infty}^\infty \phi(x)\bar\psi(x)\mathrm{d}x\forall \phi, \psi \in L^2(\mathbb{R},\mathbb{C})$$

and the defining property of the position operator is that $\hat x |x\rangle = x|x\rangle$, and so applying the map $\mathrm{Func}$ to it yields $\langle \psi | \hat x | x\rangle = x \langle \psi | x \rangle$, which immediately yields $\mathrm{Func}(\hat x | x \rangle) = x \mathrm{Func}(|x\rangle)$ and means that representing $\hat x$ on $L^2(\mathbb{R},\mathbb{C})$ is nothing more that multiplying a function $\psi$ by the identity function $id_\mathbb{R}(x) = x$.

-
Why are elements of a Hilbert space called "vectors" anyway? Can't we just call them elements? It seems kind of confusing to say a function is a type of vector. The word "vector" has always had the connotation of being a list of elements (at least in high school, undergrad, and grad school engineering courses), rather than an element itself... –  Nick Jun 20 at 0:06
A vector is just an element of a set that fulfills the axioms of being a vector space –  ACuriousMind Jun 20 at 0:09
I'm still having trouble understanding how $\psi = \psi(x)$ can both be the vector $|\psi\rangle$ and a coefficient in the basis expansion of the same vector, i.e. how can it be that $$|\psi\rangle = \int_{-\infty}^\infty |x\rangle\langle x|\psi\rangle \,\mathrm{d}x = \int_{-\infty}^\infty \psi(x) |x\rangle \,\mathrm{d}x \stackrel{?}{=} \psi(x)?$$ Or am I misunderstanding anything? –  Socob Jun 22 at 16:52
You are indeed misunderstanding something. $|\psi\rangle$ is not literally the same as $\psi(x)$, the two are related by $\psi(x) = \langle x|\psi\rangle$, which is a bijection (a Hilbert space isomorphism, to be precise) between the abstract space $\mathcal{H}$ where $|\psi\rangle$ lives and the concrete space $L^2(\mathbb{R},\mathbb{C})$ where $\psi(x)$ lives. Both spaces are Hilbert spaces, and both objects are vectors (as elements of their respective spaces), but they are not equal, they just encode the same information in two different ways. –  ACuriousMind Jun 22 at 16:57
(This is the "usual" story as presented by many textbooks and lectures. As mentioned in the other answers, the map $\psi(x) = \langle x | \psi \rangle$ is not really a bijection, since it can produce things that are not functions but distributions, but this is not relevant to the problem you seem to have) –  ACuriousMind Jun 22 at 17:07

I really appreciate this question. You are perfectly right and your confusion is understandable. Sadly, the physics world is somewhat sloppy in their use of notation at times.

Of course, when writing $P\psi(x)$ one does not intent to apply the operator to a scalar, but the $P$ is applied to the ket vector $\psi$.

But now comes the major source of confusion, IMO. While to you the wave function really is just

the coefficients of a state vector when the vector is written in a particular basis

and the state vector is element of some abstract Hilbert space, many people will argue that the Hilbert space is actually a function space. Which one precisely depends on the system under consideration but specifically for a free particle it'll be $L^2(\mathbb R,\mathbb C)$, i.e. the space of square-integrable function from $\mathbb R$ to $\mathbb C$. So in this space, the actual function $\psi$ is the vector. That space is linear (a.k.a. a vector space) and it also has a scalar product, defined via the integral. It is also complete which means that one can insert identities as you did above. That's actually what a Hilbert space is (to a mathematician): a complete vector space with a scalar product.

When taking on this view, it is legitimate to apply an operator to a function. Indeed, only now does the identification $P=-i\hbar\partial_x$ make any sense. It is a differential operator which can be applied to functions.

The advantage of the Dirac bra-ket-notation is that it allows you to step back from any concrete realizations of the underlying Hilbert space. This has some advantages:

• The analogy to linear algebra is more pronounced.
• Many general ideas which arise in quantum theory can be formulated independent of the system under investigation. In particular, the formalism is the same for infinite-dimensional Hilbert space like the $L^2$ and finite-dimensional Hilbert spaces like $\mathbb C^2$, the spin-1/2 space.
• Change of basis is very transparent. Specifically the connection of position and momentum space via the Fourier transform comes about naturally.

So why should we bother working in function spaces?

• It leads to differential equations which have a well-understood theory.
• There are some mathematical subtleties$^1$ involved when dealing with infinite-dimensional spaces. Those can best be understood in function spaces.
• Often we need to leave the blessed world of Hilbert spaces and go beyond that. The space is then no longer complete. Delta functions are such an example. They are certainly not square integrable, hell, the square of a delta function is not even defined. In won't go into depth here. The phrase you need to search for is Gelfand space triplet.

$^1$ For an overview of what can go terribly wrong in quantum mechanics upon getting to comfortable with Dirac's notation, I recommend this excellent article: F. Gieres, Mathematical surprises and Dirac's formalism in quantum mechanics, arXiv:quant-ph/9907069

-
"So in this space, the actual function ψ is the vector." I'm having some trouble understanding this. I know that the function space L² is an infinite-dimensional Hilbert space and that a function can be interpreted as an element of such a space, but how exactly is it done? Does this mean that ψ is identified as ψ(x) = |ψ⟩? That can't be it - ψ(x) = ⟨x|ψ⟩, not ψ(x) = |ψ⟩. Could you elaborate a bit? –  Socob Jun 19 at 23:49
The bra-ket notation is literally defining an inner product on whatever underlying vector space is being used, i.e. $\langle x | \psi(x) \rangle$ is the inner product of the vector $x$ and $\psi(x)$. The individual notation is useful when using operators (look into some Functional Analysis, Riesz Rep. Thm). For vectors, the bras and kets represent the same objects, but for operators they have a different meaning (because of the Riesz Thm), so that is where they become useful. –  daaxix Jun 20 at 3:58
@Socob in your statement $\psi(x)=|\psi\rangle$ the $\psi(x)$ is used as a function $\psi\colon \mathbb R\to\mathbb C$ instead of a value of this function $\psi|_x$. It's just abuse of notation. One should instead have written just $\psi$ not $\psi(x)$. –  Ruslan Jun 20 at 8:42
@daaxix Okay, but how does one actually evaluate the inner product $\langle x | \psi \rangle$? If $|\psi \rangle = \psi$ and with the inner product on $L^2$, that would mean to me that $\langle x | \psi \rangle$ = $\int_{-\infty}^\infty x \psi(x) \,\mathrm{d}x$, which isn't the same as $\psi(x)$. –  Socob Jun 20 at 18:55
$|x_0\rangle$ designates the eigenstate of the position operator with eigenvalue $x_0$. This is given by a $\delta$ function centered at $x_0$, i.e. the wave function is $\delta_{x_0}(x)=\langle x|x_0\rangle=\delta(x-x_0)$. –  Jonas Jun 20 at 20:40

To make it completely foolproof1, you'd need to define the operators via their eigenbasis: $$P|\psi\rangle = \int_\mathbb{R}\!\!\mathrm{d}p\ (p\cdot|p\rangle\langle p|\psi\rangle)$$ where (proportionality $\propto$ means, you'd still need to normalise the Fourier transform) $$|p\rangle \propto \int_\mathbb{R}\!\!\mathrm{d}x\ e^{-i(p/\hslash)x} |x\rangle.$$

But because $P$ (like most anything you'll find operating on the Hilbert spaces of quantum-mechanics) is a linear operator, it isn't really necessary to give such a "proper definition" of the function $P : \mathcal{H} \to \mathcal{H}$. Instead, you can just define the result by giving all the possible scalar products2: $$\langle x|P|\psi\rangle = -i\hslash \frac{\partial \psi(x)}{\partial x} = -i\hslash \frac{\partial \langle x|\psi\rangle}{\partial x}.$$ This is, by means of partial integration3, equivalent to the other definition: \begin{align} \int_\mathbb{R}\!\!\mathrm{d}p\ (p\cdot\langle x|p\rangle\langle p|\psi\rangle) \propto& \int_\mathbb{R}\!\!\mathrm{d}p \int_\mathbb{R}\!\!\mathrm{d}x'\! \int_\mathbb{R}\!\!\mathrm{d}x'' \ p\cdot e^{-i(p/\hslash)(x'-x'')} \langle x|x''\rangle \langle x'|\psi\rangle \\=& \int_\mathbb{R}\!\!\mathrm{d}p \int_\mathbb{R}\!\!\mathrm{d}x' \ p\cdot e^{-i(p/\hslash)(x'-x)} \langle x'|\psi\rangle \\=& \int_\mathbb{R}\!\!\mathrm{d}p\ (i\hslash) \int_\mathbb{R}\!\!\mathrm{d}x' \ (\tfrac{\partial}{\partial x'} e^{-i(p/\hslash)(x'-x)}) \langle x'|\psi\rangle \\=& -i\hslash\int_\mathbb{R}\!\!\mathrm{d}p \int_\mathbb{R}\!\!\mathrm{d}x' \ e^{-i(p/\hslash)(x'-x)} (\tfrac{\partial}{\partial x'} \langle x'|\psi\rangle) \\\propto& -i\hslash \frac{\partial \langle x | \psi \rangle}{\partial x}. \end{align}

Simply writing $P = -i\hslash \frac{\partial}{\partial x}$ is a pretty natural shorthand for the scalar product definition.

1Actually, I've still been using sloppy notation there: $|x\rangle$ and $|p\rangle$ mean different things though both $x$ and $p$ are merely arbitrary integration-variable names... but alas, that's what physicist do all the time. Really strictly speaking, we'd need to write something like $|\mathrm{loc}_x\rangle$ and $|\mathrm{mom}_p\rangle$ for these eigenstates.

2I.e. you're basically defining the dyadic function $P: \mathcal{H}\to\mathcal{H}^\ast \to \mathbb{C}$.

3When working in an unbounded space (often also when we aren't...) we ignore boundary terms.

-

As said in @AlfredCentauri 's comment, you have to think as $|\psi\rangle$ as a complex vector, let us write is $\vec \psi$.

$|x\rangle$ is representing one element of a basis, so let us write it $\vec e_x$. Like any vector, we can decompose $\vec \psi$ on the $\vec e_x$ basis : $$\vec \psi = \sum \psi_x \vec e_x$$

$\psi_x$ is the component of the vector $\vec\psi$ on the $\vec e_x$ axis, and you have simply : $$\psi_x = \psi(x) = \langle x|\psi\rangle = (\vec e_x)^\star.\vec \psi \tag{1}$$

$A$ is an operator (say a matrix) applying on the vector $\vec \psi$, so $(A\psi)(x)$ is simply $(A\psi)_x$, the component of the vector $A\vec \psi$, on the $\vec e_x$ axis, and you may write it, applying (1) to the vector $A\vec \psi$ instead of $\vec \psi$:

$$(A\psi)_x = (A\psi)(x)=\langle x|A\psi\rangle= (\vec e_x)^\star. (A\vec \psi) \tag{2}$$

-
"Like any vector, we can decompose..." well, yeah. Though it should be noted that all this holds on far less obvious grounds than physicists like to pretend. Vectors in general vector spaces, or general Hilbert spaces, may allow no basis expansion. –  leftaroundabout Jun 20 at 9:56
Okay, so $|\psi\rangle = \vec{\psi} = \psi$? Looking at your equation (2), I can't help but think that the example from Wikipedia which I quoted above is incorrect, since $$A \psi(x) = (A \psi)(x) = (A|\psi\rangle)(x) = \langle x|(A|\psi\rangle) = \langle x | A | \psi \rangle \ne A \langle x | \psi \rangle$$ That last expression doesn't make mathematical sense to me to begin with. Am I correct with this or have I misunderstood anything? –  Socob Jun 20 at 19:09
@Socob : Yes, the correspondance is $|\psi\rangle = \vec \psi$, while I write $\psi_x$ as the component of $\vec \psi$ on the $\vec e_x$ axis. Wikepedia is correct. $A\langle x|\psi\rangle$ is meaningful. For instance, if $A$ is the momentum operator, this means $P\langle x|\psi\rangle = -i\hbar {\partial_x}\, \psi(x)$. The subtelty is that operators may have different representations. Applying to the vector $|\psi\rangle$, you may consider an operator like an (infinite) matrix. However, applying to a function of $x$, like $\psi(x)$, the representation of this operator depends on $x$, –  Trimok Jun 21 at 10:04
@Socob .... in the case of the momentum operator, the representation is the differential operator $-i\hbar {\partial_x}$. The equality $\langle x|A|\psi\rangle=A\langle x|\psi\rangle$ could be rewritten, with my notations : $(A\psi)_x = A (\psi_x)$. Here $(A\psi)_x$ and $\psi_x$ are respectively the components of the vectors $A \vec\psi$ and $\vec \psi$ on the axis $\vec e_x$, and, by consequence, are functions of $x$. So the operator $A$, in this representation, makes a relation between $2$ functions of $x$. –  Trimok Jun 21 at 10:05
@Socob : ...So the representation of $A$ here necessarily depends on $x$, for instance, for the momentum operator $P$, it is a differential operator. –  Trimok Jun 21 at 10:05