TITLE: A puzzling "failure" of the Chain Rule
QUESTION [5 upvotes]: Consider the standard transformation equations between Cartesian and polar
coordinates:
\begin{align*}
x&=r \cos \theta\\
y&=r \sin \theta
\end{align*}
and the inverse: $r=\sqrt{x^2+y^2}, \theta=\arctan\frac{y}{x}$.
Now consider the following product of derivatives: ${\displaystyle f=\frac{\partial r(x,y)}{\partial y}\frac{\partial y(r,\theta)}{\partial r}}.$
By the chain rule ${\displaystyle f=\frac{\partial r(x,y)}{\partial y}\frac{\partial y(r,\theta)}{\partial r} = 
\frac{\partial r}{\partial r} = 1}.$ However, if we calculate each multiplicand in isolation, then transform the 
mixed-coordinate result into a single coordinate system, we get:
\begin{align*}
\frac{\partial r(x,y)}{\partial y}& =\frac{y}{\sqrt{x^2+y^2}}=\sin\theta\\
\frac{\partial y(r,\theta)}{\partial r}& = \sin\theta
\end{align*}
and therefore, ${\displaystyle f=\frac{\partial r(x,y)}{\partial y}\frac{\partial y(r,\theta)}{\partial r} = \sin^2\theta}$ 
But we've shown by the chain rule that
$f=1$!
:giantfireball:
I must be abusing the chain rule in some way (in the original context in which I stumbled on this, the correct result is $\sin^2\theta$), but I can't see what I did wrong.  What's going on?

REPLY [3 votes]: One of my favorites in the hall of shame of differential cancellation: Consider the plane $x+y+z=0.$ At every point on this plane, each of the variables can be solved explicitly(!) as a function of the other two. We easily find
$$\frac{\partial x}{\partial y}=\frac{\partial y}{\partial z} = \frac{\partial z}{\partial x}=-1.$$
Now consider
$$\frac{\partial x}{\partial y}\cdot\frac{\partial y}{\partial z} \cdot \frac{\partial z}{\partial x}$$
This is a merry canceler's delight: All differentials cancel and so the product is $1$! But as we've seen, each factor is $-1,$ so the product is  actually $-1.$