What is the total derivative of $f(x,y) = 2x+xy^2$?

69 Views Asked by At

There are some questions on this site about confusion with the total derivative, and to see if I got it after reading them, I tried to see the difference between the partial derivative w.r.t. x and the total derivative w.r.t. x of $f(x,y) = 2x+xy^2.$

This part itself is easy enough:

  1. Partial derivative - $\frac{\partial{}f}{\partial{}x} = 2+y^2$
  2. Total derivative - $\frac{df}{dx}=\frac{\partial{}f}{\partial{}x}+\frac{\partial{}f}{\partial{}y}\frac{dy}{dx}$ $\implies$ $\frac{df}{dx}=2+y^2+2xy\cdot\frac{dy}{dx}$

At this point, I wanted to see what would happen if there was a known relationship. I choose polar coordinates, $x=r\cos\theta$ and $y=r\sin\theta$. This leads to the relation $\frac{y}{x}=\tan\theta \implies y=x\tan\theta$

This is where I'm not sure what to do. What I did at first was use this to say $\frac{dy}{dx}=\tan\theta \implies \frac{dy}{dx}=\frac{y}{x}\implies\frac{df}{dx}=2+y^2+2xy\cdot\frac{y}{x}=2+3y^2$

Is this the correct solution? Or should I have said that $\frac{dy}{dx}=\tan\theta+\frac{\partial{}y}{\partial\theta}\frac{d\theta}{dx}$

Then you would end up with a more complicated answer that depends on the derivative of $\theta$ w.r.t. x. This anwser seems weird to me, since it starts from a relatively simple formula, but it also makes sense that it would still depend on $\theta$ in some way, because x and y depend on $\theta$ (if you eliminate r)

Which is correct? Or are both wrong and should I have done something else?