How to write $\delta (f(x))$ in terms of $\delta (x)$?

I’ve seen this identity in my electrodynamics book:
$$\delta (f(x))=\sum_i{
\frac{1}{|{df\over dx}(x_i)|}\delta (x-x_i)}$$

Where $x_i$ shows the $i$th zero of $f(x)$.
How can I prove it? I’ve tried the integral definition of delta function, but doesn’t work.

Solutions Collecting From Web of "How to write $\delta (f(x))$ in terms of $\delta (x)$?"

Here’s an informal idea:

Start with the integral

$$
\int \delta(f(x)) g(x)\,dx
$$

and for every $x_i$, take disjoint neighborhoods $U_i$ where $f$ is a diffeomorphism (i.e. $f’ \neq 0$). So,

$$
\int \delta(f(x)) g(x)\,dx = \sum_i \int_{U_i} \delta(f(x)) g(x)\,dx
$$

use change of variables in each neighborhood: $u_i = f(x)$ so
$$
\int \delta(f(x)) g(x)\,dx = \sum_i \int_{f(U_i)} \delta(u_i) \frac{g(f^{-1}(u_i))}{|f'(f^{-1}(u_i))|}\,du
$$

then $u_i = 0$ exactly when $x = x_i$, so we have

$$
\int \delta(f(x)) g(x)\,dx = \sum_i \frac{g(x_i)}{|f'(x_i)|}
$$