# Position operator in momentum space

In the script of our Quantum Mechanics class the position operator in momentum space ($\rvert p\rangle, \rvert q\rangle$ are momentum states) is derived:

$\langle p \rvert \widehat{x}\lvert q\rangle = \int y \ \langle p \rvert y\rangle\langle y \rvert q\rangle\, \mathrm{d}y$
$\hspace{1.4cm} = \int \langle p \rvert y\rangle (-i\hbar \frac{\partial}{\partial q})\frac{1}{\sqrt{2\pi\hbar}}e^{i\frac{qy}{\hbar}} \, \mathrm{d}y$
$\hspace{1.4cm} = (-i\hbar \frac{\partial}{\partial q}) \int \langle p \rvert y\rangle\langle y \rvert q\rangle\, \mathrm{d}y$
$\hspace{1.4cm} = (-i\hbar \frac{\partial}{\partial q})\langle p \rvert q\rangle = (-i\hbar \frac{\partial}{\partial q})\delta(p - q)$

Where we have used the 1D wavefunction $\langle x\rvert p\rangle = \frac{1}{\sqrt{2\pi\hbar}}e^{i\frac{px}{\hbar}}$.
This result is then used to calculate $\langle p\rvert \widehat{x}\rvert\psi\rangle$:
$\$
$\langle p\rvert \widehat{x}\rvert\psi\rangle = \int \langle p \rvert \widehat{x} \rvert q\rangle\langle q \rvert \psi\rangle\, \mathrm{d}q$
$\hspace{1.5cm} = -i\hbar \frac{\partial}{\partial q} \int \delta(p-q) \langle q \rvert \psi\rangle \mathrm{d}q$
$\rightarrow \langle p\rvert \widehat{x}\rvert\psi\rangle = -i\hbar \frac{\partial}{\partial p}\langle p \rvert \psi \rangle$
$\$
However in books and online I found the relation with the sign reversed:
$\langle p\rvert \widehat{x}\rvert\psi\rangle = i\hbar \frac{\partial}{\partial p}\langle p \rvert \psi \rangle$
This seems odd and when I calculate $\langle p \rvert \widehat{x}\lvert q\rangle$ with the same procedure but plugging in the wavefunction on the first bracket I get the right sign:

$\langle p \rvert \widehat{x}\lvert q\rangle = \int y \ \langle p \rvert y\rangle\langle y \rvert q\rangle\, \mathrm{d}y$
$\hspace{1.4cm} = \int (i\hbar \frac{\partial}{\partial p})\frac{1}{\sqrt{2\pi\hbar}}e^{-i\frac{py}{\hbar}} \langle y \rvert q\rangle \, \mathrm{d}y$
$\hspace{1.4cm} = (i\hbar \frac{\partial}{\partial p}) \int \langle p \rvert y\rangle\langle y \rvert q\rangle\, \mathrm{d}y$
$\hspace{1.4cm} = (i\hbar \frac{\partial}{\partial p})\langle p \rvert q\rangle = (i\hbar \frac{\partial}{\partial p})\delta(p - q)$
Which then gives me $\langle p\rvert \widehat{x}\rvert\psi\rangle = i\hbar \frac{\partial}{\partial p}\langle p \rvert \psi \rangle$ as expected.

I cannot find the error in the calculation from the script, but I don't think that my calculation and the one from the script can both be correct. I suspect that at some point we would need to do a conjugation, maybe when the derivative is pulled out of the integral.
Any help would be greatly appreciated.

Edit: Corrected typos in my calculation.

• In your attempt, you convert $\langle p | y \rangle$ to $e^{- i q y / \hbar} / \sqrt{ 2 \pi \hbar}$ in the last step. That $q$ should be a $p$. This error propagates downward to create a sign error in the last step.
• In your "script", the last step converts $\partial / \partial q$ to $\partial / \partial p$ without any reason. This causes another sign error because both derivatives act on a delta function $\delta(p-q)$.
• Thank you for your help. You are right about the q instead of the p, this got lost in the TeX when I was writing the post. However I don't agree on your second point, if the integral in $-i\hbar \frac{\partial}{\partial q} \int \delta(p-q) \langle q \rvert \psi\rangle \mathrm{d}q$ is evaluated first before the derivative is applied, the derivative only acts on $\langle p \rvert \psi \rangle$. Commented Jan 10, 2018 at 7:26
• @Fornito You can't do the integral first because then the $q$ in $\partial / \partial q$ has no meaning. The mistake you're making here is like asking what $n \sum_{n=1}^2 f(n)$ is. If you do the sum, it's $n (f(1) + f(2))$, but now what does $n$ mean? Commented Jan 10, 2018 at 7:49