The problem is this. Given that I have a new x basis $$|\tilde{x} \rangle = e^{i g(X)/ \hbar} |x\rangle$$ I have to show that $$\langle \tilde{x} | P | \tilde{x}' \rangle = \left(-i \hbar \frac{d}{dx} + \frac{dg}{dx}\right) \delta (x-x').$$
Here is my attempt at a solution
$$\langle \tilde{x} | P | \tilde{x}' \rangle= \int \int \langle \tilde{x}| x \rangle \langle x | P | x' \rangle \langle x' | \tilde{x}' \rangle dx' dx$$
$$= \int e^{-ig(x)/ \hbar} \int -i \hbar \delta'(x-x') e^{i g(x')/ \hbar} dx' dx $$ But this doesn’t give the correct result. I suspect my mistake is thinking that the projection of $\tilde{x}$ in the old x basis is $e^{ig(x)/\hbar}$. If that is really my mistake, then what is the projection? If that isn't, well then what am I doing wrong and how do I do this correctly?