I'm dealing with some basic calculations with plane waves and I'm having some trouble with an idea.
It has been said in another question that if you take to momenta like, for example $\boldsymbol{p}=(p_{1},p_{2},p_{3})$ and $\boldsymbol{p}'=(p_{1}',p_{2}',p_{3}')$, and calculate the transition probability for the position operator the result is
\begin{equation} ⟨\boldsymbol p'|\hat{X}|\boldsymbol p⟩=-i\hbar\frac{\partial}{\partial p_{x}}\delta(\boldsymbol{p}'-\boldsymbol{p}),\text{ where } ⟨\boldsymbol r|\boldsymbol p⟩=e^{i \boldsymbol{p}\cdot\boldsymbol{r}/\hbar}, \end{equation}
where the differentiation is taken with respect to the variable $\boldsymbol p$ because the $\hat{X}$ operator is acting to the right, but if you take the operator acting to the left then you get a similar result with the sign changed and the derivation is not taken with respect to $\boldsymbol{p}'$ that is
\begin{equation} (⟨\boldsymbol p'|\hat{X})|\boldsymbol p⟩=i\hbar\frac{\partial}{\partial p_{x}'}\delta(\boldsymbol{p}'-\boldsymbol{p}) \end{equation}
And, from my knowledge, both results must be the same. But what happens when you have that $⟨\boldsymbol r|\boldsymbol p⟩= f(\boldsymbol p) e^{i\boldsymbol{p} \cdot \boldsymbol{r}/\hbar}$ and $⟨\boldsymbol p'|\boldsymbol r⟩=g^{*}(p')e^{-i\boldsymbol{p}\cdot\boldsymbol{r}/\hbar}$? Then these two results,
\begin{align} &⟨\boldsymbol p'|(\hat{X}|\boldsymbol{p}⟩)=-i\hbar g^{*}(\boldsymbol p')f(\boldsymbol p)\frac{\partial}{\partial p_{x}}\delta(\boldsymbol{p}'-\boldsymbol{p})=i\hbar g^{*}(\boldsymbol p')\frac{\partial}{\partial p_{x}}(f(\boldsymbol p))\delta(\boldsymbol{p}'-\boldsymbol{p}) \\ & (⟨\boldsymbol p'|\hat{X})|\boldsymbol p⟩=i\hbar g^{*}(\boldsymbol p')f(\boldsymbol p)\frac{\partial}{\partial p_{x}'}\delta(\boldsymbol{p}'-\boldsymbol{p})=-i\hbar \frac{\partial}{\partial p'_{x}}(g^{*}(\boldsymbol p'))f(\boldsymbol p)\delta(\boldsymbol{p}'-\boldsymbol{p}) \end{align}
are clearly not the same. Can you help me understanding this?