Matrix elements of momentum operator in position representation I have two related questions on the representation of the momentum operator in the position basis.
The action of the momentum operator on a wave function is to derive it:
$$\hat{p} \psi(x)=-i\hbar\frac{\partial\psi(x)}{\partial x}$$
(1) Is it ok to conclude from this that:
$$\langle x | \hat{p} | x' \rangle = -i \hbar \frac{\partial \delta(x-x')}{\partial x}?$$
And what does this expression mean?
(2) Using the equations:
$$ \frac{\langle x | \hat{x}\hat{p} | x' \rangle}{x} = \frac{\langle x | \hat{p}\hat{x} | x' \rangle}{x'} = \langle x | \hat{p} | x' \rangle $$
and
$$\langle x | [\hat{x},\hat{p}]|x'\rangle=i\hbar \delta(x-x')$$
one can deduce that
$$\langle x | \hat{p} | x' \rangle = i \hbar \frac{\delta(x-x')}{x-x'}$$
Is this equation ok? Does it follow that
$$\frac{\partial \delta(x-x')}{\partial x} = - \frac{\delta(x-x')}{x-x'}?$$
 A: @joshphysics gave an excellent illustration of why your first part, i.e. 
⟨x|p^|x′⟩=−iℏ∂δ(x−x′)∂x?
is consistent with quantum mechanics;
Let's check your second part rather intuitively.
Since in general:
$$ \int xg(x)f'(x)dx=-\int f(x)\frac{d}{dx}(xg(x))dx=-\int f(x)(xg'(x)+g(x))dx $$
If $$ f(x)=\delta(x) $$
We conclude that:
$$ \int f(x)(xg'(x)+g(x))dx=\int\delta(x)g(x)dx=-\int xg(x)\delta'(x)dx
 $$
Thus 
$$ \delta'(x)=-\frac{1}{x}\delta(x) $$
Is true in mathematics 
A: 1) Notice that by inserting a complete set of position states we can write
$$
  \hat p \psi(x) = \langle x|\hat p|\psi\rangle = \int dx'\langle x|\hat p|x'\rangle\langle x'|\psi\rangle =\int dx'\langle x|\hat p|x'\rangle \psi(x')
$$
so if we set
$$
  \langle x|\hat p|x'\rangle = -i\hbar \frac{\partial}{\partial x}\delta(x-x') =i\hbar \frac{\partial}{\partial x'}\delta(x-x')
$$
then we can use integration by parts to obtain
$$
  \hat p \psi(x) =i\hbar \int dx'\frac{\partial}{\partial x'}\delta(x-x') \psi(x') = -i\hbar \int dx'\delta(x-x') \frac{d \psi}{dx'}(x') = -i\hbar \frac{d\psi}{dx}(x)
$$
So your expression is correct.  The derivative of a delta function is essentially defined by the integration by parts manipulation that I just performed; in fact derivatives of distributions in general are defined in an analogous way. See this lecture for example.
Hope that helps; let me know of any typos!
Cheers!
A: 1) User joshphysics has already correctly answered OP's 1st question. 
2a) Concerning OP's 2nd question, one derives
$$i\hbar \delta(x-x^{\prime})~=~i\hbar\langle x  | x^{\prime} \rangle ~=~\langle x | [\hat{x},\hat{p}] | x^{\prime} \rangle
~=~\langle x | \hat{x}\hat{p} | x' \rangle-\langle x | \hat{p} \hat{x} | x' \rangle$$
$$\tag{A}~=~(x-x^{\prime})\langle x | \hat{p} | x^{\prime} \rangle
~\stackrel{(1)}{=}~-i\hbar(x-x^{\prime})\frac{\partial}{\partial x}\delta(x-x^{\prime}).$$
In other words,
$$\tag{B}\delta(x-x^{\prime})~=~-(x-x^{\prime})\frac{\partial}{\partial x}\delta(x-x^{\prime}),$$
which also follows by differentiating the identity
$$\tag{C} (x-x^{\prime})\delta(x-x^{\prime})~=~0 $$
wrt. $x$.
2b) Eq. (B) should not be divide on both sides wrt. $x-x^{\prime}$. The problem is essentially that the distribution $\frac{1}{x}\delta(x)$ is ill-defined. 
One argument why this is so goes roughly as follows. Recall that one way to make sense of a distribution $u$ is to evaluate on smooth test functions $g:\mathbb{R}\to \mathbb{C}$. For instance, if the distribution $u$ is the Dirac delta distribution, then by definition
$$\tag{D} u[g] ~:= ~g(0), $$
or equivalently, in a perhaps more familiar notation,
$$\tag{E} \int_{\mathbb{R}}\! dx~\delta(x) g(x) ~:= ~g(0). $$
One can in general not multiply$^1$ two distributions, but one can multiply a smooth function $f:\mathbb{R}\to \mathbb{C}$ with a distribution $u$. The product $f\cdot u$ is by definition
$$\tag{F} (f\cdot u)[g] ~:= ~u[fg]. $$
So if $u$ is the Dirac delta distribution, one gets
$$\tag{G} (f\cdot u)[g] ~:= ~f(0) g(0). $$
In OP's case, if we try to set $f(x)=\frac{1}{x}$, then $f(0)$ would be ill-defined.
Another less formal argument is that if we wrongly accept $\frac{1}{x}\delta(x)$ as a distribution, then we are prone to seemingly meaningless contradictions a la
$$x\cdot (\frac{1}{x} \delta(x))~=~x\cdot (\frac{1}{x}\cdot \delta(x))~=~(x\cdot \frac{1}{x})\cdot \delta(x)$$
$$\tag{H}~=~( \frac{1}{x}\cdot x)\cdot \delta(x)~=~ \frac{1}{x}\cdot (x\cdot \delta(x))~=~ \frac{1}{x}\cdot 0~=~0, \quad \text{(Wrong!)} $$
i.e. we have lost associativity of multiplication.
--
$^1$ We ignore Colombeau theory. See also this mathoverflow post.
