Units and the momentum eigenstate in position basis

Consider $\psi(x)=\langle x|\psi\rangle$. Such a wavefunction must have dimensions of inverse square root length to satisfy the normalization condition. Why then does $\langle x | p \rangle = \frac{1}{\sqrt{2\pi\hbar}}e^{-ikx}$ have units of inverse square root action? (We can flip this question around and ask why $\langle p | x\rangle$ doesn't have units of inverse root momentum too.)

This came up when I considered the expectation value of operator $X^n$ for a momentum eigenket. What's wrong with this calculation? The units make no sense!

\begin{align} \langle X^n\rangle &=\langle p|X^n|p\rangle \\ &= \langle p |\int dx |x\rangle \langle x|X^n|p\rangle \\ &= \int dx\ x^n \langle p |x\rangle \langle x|p\rangle \\ &= \int \frac{dx}{2\pi\hbar} x^n \\ &= \lim_{a\to\infty}\frac{x^{n+1}}{(n+1)2\pi\hbar} \bigg|_{-a}^a \end{align} such that $\langle X^n\rangle$ seems to vanishes for $n$ odd and diverge for $n$ even. That's strange enough, but prior to evaluation, the units of the formal integral are those of $[x^n]/[p]$ - not what I expected... I feel the issue may be rooted in the first part of my question, and perhaps is linked to the assumptions in QM behind defining position and momentum eigenkets.

In quantum mechanics, we often want to decompose our state into a basis. There are two qualitatively different types of bases, discrete and continuous. In the discrete case, we can simply write $$| \psi \rangle = \sum_n c_n | n \rangle \ ,$$ where $| \psi \rangle$, $| n \rangle$, and the $c_n$ are all dimensionless.
In the continuum case, we need an integral. For example, for the questioner's momentum states, we could write $$| \psi \rangle = \int dp \, | p \rangle \langle p | \psi \rangle \ .$$ The wave packet $|\psi \rangle$ is dimensionless and assumed to be properly normalized $\langle \psi | \psi \rangle = 1$. But now the $dp$ in the measure has units of momentum. It follows that $| p \rangle$ and $\langle p |$ should have units of the square root of the inverse of momentum. We could run a similar argument for the position eigenstates $|x \rangle$ from which we could conclude that $|x \rangle$ and $\langle x |$ have units of the inverse of the square root of length. Furthermore, $\langle x | p \rangle$ has units of the square root of the inverse of momentum times length, or the same units as $1 / \sqrt{\hbar}$, as the questioner has observed.
When we take an expectation value of an operator like $\hat x^n$, we should take it with respect to a wave-packet $|\psi \rangle$ that is properly normalized. With respect to the wave packet, we find $$\langle \hat x^n \rangle = \langle \psi | \hat x^n | \psi \rangle .$$ We can then further decompose $| \psi \rangle$ into momentum eigenstates or position eigenstates, but it should be clear at this point that the expectation value will have the correct units. The measure factors $dp$ or $dx$ will cancel the extra dimensional factors from the $|p\rangle$'s, $\langle p |$'s, $|x \rangle$'s, and $\langle x|$'s.
• So since $|p\rangle$ is non-normalizable, we cannot compute $\langle p | X^n|p\rangle$. Is this correct? – zahbaz Oct 20 '17 at 4:50