Unitary change of X Basis: Shankar Exercise 7.4.9 I'm currently working through Shankar's Quantum Mechanics and am stuck on one of his exercises. 
In Exercise 7.4.9 Shankar would like us to show that: 
if $\mid x \rangle$ is changed to $\mid \tilde{x}\rangle$ := $e^{ig(X)/\hbar}\mid x\rangle$ =  $e^{ig(x)/\hbar}\mid x\rangle$, where $g(x) = \int^x f(x')dx',$
then $\langle \tilde{x}'\mid X \mid \tilde{x}\rangle$ = $x\delta(x-x').$
This is my attempt:
$\langle\tilde{x}'\mid X \mid \tilde{x}\rangle = e^{-ig(x')/\hbar}\langle x'\mid X \mid x\rangle e^{ig(x)/\hbar}$ and, using the fact that $\langle x'\mid X \mid x\rangle = x\delta(x-x'),$ I obtain $$x\delta(x-x')e^{i(g(x) - g(x'))/\hbar}$$ Clearly the exponential function needs to be 1 in order to obtain Shankar's answer; but it isn't clear to me that $$e^{i(g(x) - g(x'))/\hbar} = 1.$$
Where did I go wrong?
 A: Actually, you got the right result, you just didn't see it. In the sense of distributions we have that
$$x\delta(x-x')e^{i(g(x) - g(x'))/\hbar}=x\delta(x-x')$$
These expressions, make no sense if not under an integration sign with a test function $h\in C^\infty_0(\Bbb{R})$ or $h\in\mathcal{S}(\Bbb{R})$, the smooth (infinitely differentiable) functions of compact support or the Schwartz space of functions of rapid decrease. In any case, let $h(x)$ be such a function.
Then we have that
\begin{align}\int_{\Bbb{R}}x\delta(x-x')e^{i(g(x) - g(x'))/\hbar}h(x)dx&=x'e^{i(g(x) - g(x'))/\hbar}h(x')\\
&=x'h(x')\\
&=\int_{\Bbb{R}}x\delta(x-x')h(x)dx\end{align}
Since the result is the same for any test function $h$, the distributions are the same, and you have your result.
A: So I actually was able to figure this out! It turns out I skipped a step.
So you begin with:
$\langle\tilde{x}'\mid X \mid \tilde{x}\rangle = e^{-ig(x')/\hbar}\langle x'\mid X \mid x\rangle e^{ig(x)/\hbar}$ = $\langle x'\mid X \mid x\rangle e^{i(g(x)-g(x'))/\hbar}$
Next since $X\mid x\rangle = x\mid x\rangle$, the previous formula becomes $x\langle x'\mid x\rangle e^{i(g(x)-g(x'))/\hbar}$
Now Shankar tells us that $\langle x'\mid x\rangle = 0$ for $x\neq x'$, so the previous formula is 0 unless $x = x'$.
This means that the exponential term becomes $e^{i(g(x)-g(x)/\hbar} = e^0 = 1$
And finally we use Shankar's final relation that $\langle x'\mid x\rangle$ = $\delta(x-x')$ to finally arrive at the solution $\langle \tilde{x}'\mid X \mid \tilde{x}\rangle$ = $x\delta(x-x').$
