TITLE: Which of these two ways to take the derivative of a delta function times another function is correct?
QUESTION [6 upvotes]: A well known identity of the Dirac delta function is that for any function $f(x)$:
$$
 \delta(x) f(x) = \delta(x) f(0).
$$
If we take the derivative of the right hand side we get:
$$
 \delta'(x) f(0).
$$
But if we take the derivative of the left hand side we get
$$
 \delta'(x) f(x) + \delta(x) f'(x) = \delta'(x) f(0) + \delta(x) f'(0)
$$
Which one is correct?
P.S. I know that this problem has something to do with the fact that the delta function is not really a function, but rather a generalized function. However, the delta function and its derivatives are useful in calculations (especially in physics), and I want to know the correct rules for using them.

REPLY [6 votes]: OK I think I know the answer to my own question, and that I can put it in simple terms without getting to much into the mathematical background of delta functions.
My mistake was that I thought the similarly to this identity:
$$
 \delta(x) f(x) = \delta(x) f(0),
$$
which is correct, the following identity is also true:
$$
 \delta'(x) f(x) = \delta'(x) f(0),
$$
but this is wrong.
The correct identity is:
$$
 \delta'(x) f(x) = \delta'(x) f(0) - \delta(x) f'(0).
$$
If I use this identity when comparing the two results in the question, they turn out to be the same - meaning both ways of taking the derivative are correct.
In fact, the derivation in the question is a proof of this identity.
BTW it is a generalization of the well known identity: $\delta'(x) x = -\delta(x)$