# Inconsistent derivatives with respect to a function when using the chain rule

I am trying to derive an expression for some partial derivatives in two different ways, but they seem to lead to inconsistent results.

I have got the Cartesian components of a two-dimensional position vector $$x(t)$$ and $$y(t)$$ and I need to evaluate their sensitivity with respect to the angle $$\varphi(t)$$, which is defined as $$\varphi(t) = \tan^{-1} \left( \frac{y(t)}{x(t)} \right)$$

According to the answers to this question, by using the chain rule, I can compute the partial derivative of $$x(t)$$ with respect to $$\varphi(t)$$ as $$\frac{\partial x}{\partial \varphi} = \frac{\partial x / \partial x}{\partial \varphi / \partial x} = \frac{1}{\partial \varphi / \partial x} = \left( \frac{\partial}{\partial x} \left( \tan^{-1} \left( \frac{y(t)}{x(t)} \right) \right) \right)^{-1} = -\frac{x(t)^2 + y(t)^2}{y(t)}$$

However, by expressing the position in polar coordinates $$x(t) = r(t) \cos(\varphi(t))$$ $$y(t) = r(t) \sin(\varphi(t))$$ the derivative of $$x(t)$$ with respect to $$\varphi(t)$$ appears to be $$\frac{\partial x}{\partial \varphi} = -r(t) \sin(\varphi(t)) = -r(t) \frac{y(t)}{r(t)} = -y(t)$$ This is a completely different result from the one obtained using the chain rule. So, which one is correct and why? Also, what am I doing wrong?