Converting potential gradient into polar coordinate In polar coordinate, 
$$\nabla U = \frac{\partial U}{\partial r}\hat{\mathbf{r}} + \frac{1}{r}\frac{\partial U}{\partial \theta}\hat{\mathbf{\theta}} .$$
I tried to use chain rule to get this result, but what I got from $\nabla U = \frac{\partial U}{\partial x}\hat{\mathbf{x}}+\frac{\partial U}{\partial y}\hat{\mathbf{y}}$ is some gibberish. Can anyone explain in detail how to get this result?
 A: Given that
$$
r = \sqrt{x^2 + y^2},\qquad \theta = \arctan\left(\frac{y}{x}\right)
$$
and $U = U(x,y)$, using the chain rule in two variables, we have
$$
\frac{\partial U}{\partial x} = \frac{\partial U}{\partial r}\frac{\partial r}{\partial x} + \frac{\partial U}{\partial \theta}\frac{\partial \theta}{\partial x}
$$
$$
\frac{\partial U}{\partial y} = \frac{\partial U}{\partial r}\frac{\partial r}{\partial y} + \frac{\partial U}{\partial \theta}\frac{\partial \theta}{\partial y}
$$
Now,
$$
\frac{\partial r}{\partial x} = \frac{\partial}{\partial x} \sqrt{x^2+y^2} = \frac{x}{\sqrt{x^2 + y^2}} = \cos \theta
$$
$$
\frac{\partial r}{\partial y} = \frac{\partial}{\partial y} \sqrt{x^2+y^2} = \frac{y}{\sqrt{x^2 + y^2}} = \sin \theta
$$
and
$$
\frac{\partial \theta}{\partial x} = \frac{\partial}{\partial x} \arctan \left(\frac{y}{x}\right) = -\frac{y}{x^2 + y^2} = -\frac{\sin \theta}{r}
$$
$$
\frac{\partial \theta}{\partial y} = \frac{\partial}{\partial y} \arctan \left(\frac{y}{x}\right) = \frac{y}{x^2 + y^2} = \frac{\cos \theta}{r}
$$
hence
$$
\nabla U = U_r \begin{pmatrix} \cos \theta \\ \sin \theta \end{pmatrix} + \frac{1}{r} U_\theta \begin{pmatrix} -\sin \theta \\ \cos \theta \end{pmatrix}
$$
Lastly, the unitary vector in the radial direction $\hat{r}$ is 
$$
\hat{\textbf{r}} = \begin{pmatrix} \cos \theta \\ \sin \theta \end{pmatrix}
$$
and due orthogonality
$$
\hat{\theta} = \begin{pmatrix} -\sin \theta \\ \cos \theta \end{pmatrix}
$$
which leads to the desired form
$$
\nabla U = U_r \hat{\textbf{r}} + \frac{1}{r} U_\theta \hat{\theta}
$$
