Partial differential equation switching to polar coordinates I'am trying to find out the expression of$~~~g:\mathbb{R}^2\rightarrow \mathbb{R}~~$ by using polar coordinates : 
$x\frac{\partial g}{\partial x}(x,y)+y\frac{\partial g}{\partial y}(x,y)=\sqrt{x^2+y^2}~~~~~~~~~~(1)$
by substitution : $~~~~~~x=r\cos(\theta) ~~~~,~~y=r\sin(\theta)$
so $(1)$ becomes : $\cos(\theta)\frac{\partial g}{\partial x}(x,y)+\sin( \theta)\frac{\partial g}{\partial y}(x,y)=r$
do I have to turn $~~\frac{\partial g}{\partial x}(x,y)~~$ and $~~\frac{\partial g}{\partial y}(x,y)~~$into a function of $(r,\theta)$ ? 
is this equation correct :  $\cos\theta\frac{\partial g}{\partial (r\cos\theta)}(r,\theta)+\sin \theta\frac{\partial g}{\partial (r\sin\theta)}(r,\theta)=r$ 
Any hint/correction ?
,
 A: Well, with the exercises of this kind, it seems to be worth to have at least an idea of what precisely is happening, otherwise you are lost in nonsensical symbolic manipulations. So what you have is a function $g$ of two independent variables $x$ and $y,$ let's write it like $z = g(x,y).$ You can identify it with its graph actually as a subset in $\mathbb{R}^3.$ What you are interested most is,loosely speaking, whether there is a function, say $h,$ such that if you perform a change of variables
\begin{eqnarray*}
x & = & a(r,\phi,\psi)\\
y & = & b(r,\phi,\psi)\\
z & = & c(r,\phi,\psi),
\end{eqnarray*}
the graph of $g$ transforms into the graph of $h$ parametrized by two of the three coordinates $r,\phi,\psi.$ The theorem on implicit functions (TIF) tells you that this can be done everywhere the Jacobian matrix $\frac{D(a,b,c)}{D(r,\phi,\psi)}$ is nonsingular.
Now if you put $a(r,\phi,\psi) = r \cos{\phi},$ $b(r,\phi,\psi) = r \sin{\phi}$ and $c(r,\phi,\psi) = \psi$ (this is the so called change of independent variables because the dependent variable transforms like identity), you can figure out (directly or by checking the determinant $\frac{D(a,b,c)}{D(\psi, x, y)}$ and using the TIF) that
\begin{eqnarray}
x & = & r \cos{\phi} \\
y & = & r \sin{\phi}\\
g(x,y) & = & h(r,\phi) (= g(r \cos{\phi}, r \sin{\phi}))
\end{eqnarray}
for certain function $h$ of the independent variables $r,\phi$ (it is better to think like there are NO dependent and independent variables and to view the equations above as implicit relationship between $x,y,r,\phi,\psi.$) Now you want the $g_x$ and $g_y$ in terms of $h_r$ and $h_{\phi}.$ Note that
\begin{equation}
g_x = h_r r_x + h_{\phi} \phi_x
\end{equation}
(yes, in general $r$ and $\phi$ also depend on $x$ and $y,$ a consequence of TIF again) and that
\begin{equation}
g_y = h_r r_y + h_{\phi} \phi_y
\end{equation}
Differentiating the first two of the three equations above with respect to $x$ you have
\begin{eqnarray}
1 & = & r_x \cos{\phi} - (r \sin{\phi}) \cdot \phi_x \\
0 & = & r_x \sin{\phi} + (r \cos{\phi}) \cdot \phi_x
\end{eqnarray}
and eliminating you obtain
\begin{equation}
r_x = \cos{\phi}, \quad \phi_x = - \frac{\sin{\phi}}{r},
\end{equation}
so that in fact
\begin{equation}
g_x = h_r \cos{\phi} - \frac{1}{r} h_{\phi} \sin{\phi}.
\end{equation}
Similarly differentiating the same two equations of the three above with respect to $y$ gives
\begin{eqnarray}
0 & = & r_y \cos{\phi} - (r \sin{\phi}) \cdot \phi_y \\
1 & = & r_y \sin{\phi} + (r \cos{\phi}) \cdot \phi_y
\end{eqnarray}
and eliminating you end up with
\begin{equation}
r_y = \sin{\phi}, \quad \phi_y = \frac{\cos{\phi}}{r},
\end{equation}
so that
\begin{equation}
g_y = h_r \sin{\phi} + \frac{1}{r} h_{\phi} \cos{\phi}.
\end{equation}
Now put everything together and here we go: your equation is equivalent to $r h_r = r$ in the new coordinates.
