Transformation connecting two representations - Quantum mechanics I am working on Dirac's paper The Lagrangian in Quantum Mechanics. He looks for the analogy between a classical transformation between two sets of coordinates and momenta $p_r$, $q_r$ and $P_r$, $Q_r$ ($r = 1,2,\dots n$) and the transformation in quantum theory between two representations, in which the $q$'s are diagonal to another in which the $Q$'s are.
The transformation function is $\langle q|Q\rangle$. Now he takes an operator $\alpha$ with "mixed representatives" $\langle q|\alpha|Q\rangle$, and using the completeness identity
$$\langle q|\alpha|Q\rangle = \int \langle q|\alpha|q^\prime\rangle 
 \mathrm{d}q^\prime \langle q^\prime|Q\rangle = \int \langle q|Q^\prime\rangle 
 \mathrm{d}Q^\prime \langle Q^\prime|\alpha|Q\rangle$$
He now sets $\alpha = p_r$, and says that from the first integral we find
$$\langle q|p_r|Q\rangle = -i\hbar \frac{\partial}{\partial q_r} \langle q|Q\rangle$$
I don't understand how is the momentum operator now acting on the whole transformation function. And it is clear that that is what it means, since later on the same paper he sets $\langle q|Q\rangle = \exp(iU/\hbar)$ and from this equation he gets
$$\langle q|p_r|Q\rangle = \frac{\partial U}{\partial q_r} \langle q|Q\rangle$$
Just to clarify, I don't understand how is it that the momentum gets out the bra and ket, and once it does, how is it that it is now operating on the transformation.
 A: Note that 
$$\langle q|p_r|q'\rangle 
= -i\hbar \frac{\partial}{\partial q_r}\langle q|q'\rangle 
= -i\hbar \frac{\partial}{\partial q_r}\delta(q-q').$$
A: You want to know what $$\hat p\psi (x)$$ is.
In matrix algebra it's
$$\left\langle x \right|\hat p\left| \psi \right\rangle $$
In wave mechanics it's
$$
\hat p\psi (x) = {\hbar  \over i}{\partial  \over {\partial x}}\psi (x) = {\hbar  \over i}{\partial  \over {\partial x}}\left\langle {x}
 \mathrel{\left | {\vphantom {x \psi }}
 \right.}
 {\psi } \right\rangle \, .
$$
They should be equal so that
$$
\langle x|\hat p\left| \psi  \right\rangle  = {\hbar  \over i}{\partial  \over {\partial x}}\left\langle {x}
 \mathrel{\left | {\vphantom {x \psi }}
 \right.}
 {\psi } \right\rangle \, .
$$

\begin{align}
P \psi(x)
&= \langle x | P | \psi \rangle \\
&= \int \langle x | P x' \rangle \langle x' | \psi \rangle \, dx \\
&= i \hbar \int \delta'(x' - x) \psi(x') \, dx' \\
&= -i \hbar \left.\frac{\partial \psi(x')}{\partial x'} \right \rvert_{x'=x} \\
&= -i \hbar \frac{\partial \psi(x)}{\partial x}
\end{align}

Although I always forget the derivation in the quote box above I remember they should be equal.
