# Quantum expressions involving Dirac delta function

As @Qmechanic points out in the comment above, they are both correct. This is because they are both equivalent.

I'm not an expert at the rigorous math, but the way I think about it is that "functions" like the Dirac Delta are actually *distributions*, meaning that they only make sense inside of an integral of the form:

$$\int_{a}^b \text{d}x\,\,f(x)\delta(x),$$

for any arbitrary $f(x)$ is an arbitrary **test function** that is "well-behaved" (smooth, with a compact support over the interval, etc.).

In this sense, we can show that both the quantities that you have derived are equal, in the sense that (let's ignore all factors of $\hbar$ and $i$ since they're the same on both sides anyway) $$\int_{-\infty}^\infty \text{d}x\,\,\, x' \delta'(x-x') f(x) = \int_{-\infty}^\infty \text{d}x\,\,\, \Big(\, \delta(x-x') + x \delta'(x-x')\,\Big) f(x),$$

for every test function $f(x)$. The math isn't too hard to do, but I'll outline it here anyway.

### Evaluating the LHS

the left hand side is pretty easy to evaluate (remember, $x'$ is a *constant*)

$$\int_{-\infty}^\infty \text{d}x\,\,\, x' \delta'(x-x') f(x) = x' \int_{-\infty}^\infty \text{d}x\,\,\, \delta'(x-x') f(x) = - x' f'(x'), \tag{1}\label{1}$$

where I've used the well known result that $$\int_{-\infty}^\infty \text{d}x\,\, \delta'(x-x') f(x) = -\frac{\text{d}f(x)}{\text{d}x}\Bigg|_{x=x'}.$$

### Evaluating the RHS

Now, let's look at the right hand side. You can break the sum into two parts, the first of which is trivially $f(x')$, by the definition of the $\delta$ function. The second term is more interesting:

$$\int_{-\infty}^\infty \text{d}x\,\,\, x \delta'(x-x') f(x)$$

It *almost* looks like the left-hand-side of Equation (\ref{1}), except that instead of $x'$ here you have $x$. But $x$ isn't a constant, and it shouldn't be too hard for you to see (using the relations we've used above) that

$$\int_{-\infty}^\infty \text{d}x\,\,\, x \delta'(x-x') f(x) = -\frac{\text{d}}{\text{d}x}\left(x f(x)\right)\Bigg|_{x=x'} = -f(x') - x'f'(x')$$

Plugging the two terms together, the RHS is thus just: $$\int_{-\infty}^\infty \text{d}x\,\,\, \Big(\, \delta(x-x') + x \delta'(x-x')\,\Big) f(x) = -x' f'(x').\tag{2}\label{2}$$

Since Equations (\ref{1}) and (\ref{2}) are the same, we can say that the two distributions are "equal". So to answer your question, they are both right, as they should be.