Derivative of a Position Eigenket I was flicking through Zettili's book on quantum mechanics and came across a 'derivation' of the momentum operator in the position representation on page 126. The author derived that $\langle\vec{r}|\hat{\vec{P}}|\psi\rangle = -i\hbar\vec{\nabla}\langle\vec{r}|\psi\rangle$ (I've omitted the full derivation). However, from this relationship he concluded that $\hat{\vec{P}} = -i\hbar\vec{\nabla}$. I'm sure this is very basic but why can you immediately conclude this? Surely this assumes that $\langle\vec{r}|(-i\hbar\vec{\nabla})|\psi\rangle = -i\hbar\vec{\nabla}\langle\vec{r}|\psi\rangle$. I'm not sure why this is necessarily true.   
 A: $-i\hbar\vec{\nabla}|\psi\rangle$ is not a valid notation. The nabla operator is defined in three-dimensional Euclidean space, not the in the Hilbert space of quantum states.
When the author says $\hat{\boldsymbol{P}}=-i\hbar\vec{\nabla}$ he does not mean the momentum operator defined in the state space, but the space of wavefunctions. Then $\hat{\boldsymbol{P}}\psi(\boldsymbol{r})=-i\hbar\vec{\nabla}\psi(\boldsymbol{r})$.
A: The $\hat{P}$ operator is a matrix, and you can write it out as a continuous analog of a matrix between two continuous indices x and x'
$$ \hat{P}_{xx'} = i\delta'(x-x') $$
Then the action of $\hat{P}$ on a ket $\psi(x)$ is by the continuous analog of matrix multiplication:
$$ \hat{P}\psi(x) = \int \hat{P}_{xx'} \psi_{x'} dx' = -i \psi'(x) $$
after formally integrating by parts and popping the delta function. For learning these things, Dirac's book is best.
To understand this, always think of a lattice, in which case
$$ \hat{P}_{xx'} = \Delta'(x-x') $$
Where $\Delta(0)=-{1\over \epsilon}$ and $\Delta(\epsilon) ={1\over \epsilon}$ on a lattice of step $\epsilon$. 
