# Express the density of a function of two random variables using the Gradient and the joint density

I would like to know if it is possible to express the density $f_Z(z)$ of a function $Z = g(X,Y)$ of two continuous "nice" random variables $X$ and $Y$ only using the joint density $f_{XY}(x,y)$ and the gradient $\bigtriangledown g(x,y)$ asuming that the function $g(x,y)$ is "nice" (I mean, I don't care about complicated cases, just the easy ones, assuming $g(x,y)\ \epsilon \ C^\infty$ and it is monotone).

I know how to proof the usual cases when the function $g$ is a Vector Field $g:R^p \rightarrow R^p$:

Case $p=1$:

$$g(x): R \rightarrow R \\ Y = g(X) \ \ and \ \ \exists \ \ g^{-1} \ \ s.t \ \ x_0 = g^{-1}(y_0) \ \forall \ y_0 \Rightarrow f_Y(y_0) = f_X(g^{-1}(y_0)) \frac{1}{|g'(g^{-1}(y_0))|} \\ \\$$ Case $p = 2$: $$g(x): R^2 \rightarrow R^2 \\ (Z,W)=g(X,Y)=(g_1(X,Y),g_2(X,Y)) \ \ \\ z_0 = g_1(x,y), w_0 = g_2(x,y) \Rightarrow \exists h_1,h_2 \ \ s.t \ \ \ x_0 = h_1(z_0,w_0) \ , \ y_0 = h_2(z_0,w_0) \\ \\ \exists J(x,y) = det\begin{pmatrix} \frac{\partial g_1(x,y)}{\partial x} & \frac{\partial g_1(x,y)}{\partial y} \\ \frac{\partial g_2(x,y)}{\partial x} & \frac{\partial g_2(x,y)}{\partial y} \\ \end{pmatrix} and \ \ J(z,w) = det\begin{pmatrix} \frac{\partial h_1(z,w)}{\partial z} & \frac{\partial h_1(z,w)}{\partial w} \\ \frac{\partial h_2(z,w)}{\partial z} & \frac{\partial h_2(z,w)}{\partial w} \\ \end{pmatrix} \\ s.t \ \ |J(z,w)|= \frac{1}{|J(x,y)|} \\ \Rightarrow f_{ZW}(z_0,w_0)= f_{XY}(x_0,y_0)\frac{1}{|J(x_0,y_0)|}$$

Where $J()$ is the Jacobian, i.e, the determinant of the Jacobian Matrix and $|J()|$ is the abolute value of the Jacobian. I am just trying to know if there is some equation relating $f_Z(z)$ with $f_{XY}(x,y)$ and $\bigtriangledown g(x,y)$ because in this case the funciont $g$ is not a vector field but a function $g: R^2 \rightarrow R$ so the Jacobian matrix becomes the gradient vector. I assume that if there is a way, it may imply some integration. I know that the anwer without using the gradient is something like the line integration of $f_{XY}(xy)$ over the curve on the $R^2$ plane $z=g(x,y)$. I have tried to "improve" this formula using the gradient but I don't know how.