PDF for a function of random variables

If $g=f(x,y)$ is a function of independent random variables $x$ and $y$ then how do we arrive at the expression for the probability density function of $g$,

$$f_G(g) = \iint f_X(x)f_Y(y)\delta(g-f(x,y))\mbox{d}x\mbox{d}y\ ?$$

I have been looking at some statistics books but cannot find it. Neither am I able to derive it myself. Any help would be appreciated.

-

Changing the variable from $g$ to $u = g - f(x,y)$ gives
\eqalign{ \int_{-\infty}^{t}\delta(g - f(x,y))dg =\int_{-\infty}^{t-f(x,y)}\delta(u)du = I_{t - f(x,y) \ge 0} = I_{f(x,y)\le t} }
(where $I$ is an indicator function). This is the definition of $\delta$. Now write the CDF for $g$ as an integral; namely,
\eqalign{ \int_{-\infty}^{t} f_G(g)dg = &G(t) \\ = &\mathbb{P}[f(x,y)\le t] \\ = &\iint_{\{f(x,y)\le t\}}f_X(x)f_Y(y)dx dy \\ = &\iint I_{f(x,y)\le t}f_X(x)f_Y(y)dx dy \\ = &\iint\left(\int_{-\infty}^{t}\delta(g - f(x,y))dg\right)f_X(x)f_Y(y)dx dy \\ = &\int_{-\infty}^{t} \left(\iint\delta(g - f(x,y)) f_X(x)f_Y(y)dx dy\right) dg. \\ } Every step of this but the last merely applied a definition (of the pdf, of the CDF, of $\mathbb{P}$, and of the integral, in that order) or the preceding result. The last step is Fubini's Theorem extended to distributions.
The idea to do it this way comes from the fundamental intuition for working with generalized functions ("distributions") like $\delta$: they are defined in terms of integration by parts. Taking this as an invitation to integrate $\delta(g - f(x,y))dg$ leads to the first observation and everything follows readily.