I was wondering what was incorrect about this procedure that seems to lead to a contradiction. In polar coordinates its true that:
$x^2 + y^2 = r^2$
If I differentiate the equation implicitly with respect to $x$ I get the following:
$2x = 2r\frac{\partial r}{\partial x} \implies \frac{x}{r} = \frac{\partial r}{\partial x},$
which finally yields:
$\frac{r\cos \theta}{r} = \frac{\partial r}{\partial x} \implies \frac{\partial r}{\partial x} = \cos \theta.$
However, if I differentiate $r$ with respect to $x$ from the definition of $x$ in polar coordinates, I get a different result:
$x = r\cos\theta \implies r = \frac{x}{\cos\theta} \implies \frac{\partial r}{\partial x} = \frac{1}{\cos\theta}.$