Suppose we had a function $f(x,y(x))$ and we wanted to find $\frac{d}{dx}f(x,y(x))$. I know how to apply the multivariable chain rule with unspecified functions. But suppose we had: $f(x,y)=x^2y+ \sin(y)$ with $y=2x$. For the sake of understanding the theory behind this all I'm not going to substitute the $y=2x$.

How do I find $\frac{\partial f}{\partial x}$ and $\frac{\partial f}{\partial y}$. My general understanding was that we would look at all the other variables as constants but in this case $y$ is a function of $x$ so do we still consider $y$ a constant when evaluating $\frac{\partial f}{\partial x}$?

In that case: $\frac{\partial f}{\partial x} = 2xy$. But is this correct? Do we still consider $y$ a constant when calculating the partial derivative to $x$ even though we know that $y$ depends on $x$?

• Consider $y$ as what it is - function of $x$ and apply chain rule to find derivative. In your case, $\dfrac{\partial f}{\partial x}=2xy + x^2y'$. Derivative $\dfrac{\partial }{\partial x}$ of $\sin y$ would be $(\cos y) y'$. Oct 7 '16 at 13:22

There are two approaches to finding $\frac{df(x,y(x))}{dx}$ in your example:

1) do the substitution first to get $$f(x,2x)= 2x^3+\sin(2x)$$ $$\frac{df(x,2x)}{dx} = 6x^2 +2\cos(2x)$$

2) use partial derivatives first
$$\frac{df(x,y(x))}{dx} = \frac{\partial f}{\partial x} + \frac{d y}{d x} \frac{\partial f}{\partial y} = 2xy +\frac{d y}{d x} \left(x^2 + \cos(y) \right)$$ $$\frac{df(x,2x)}{dx} = 4x^2 +2\left(x^2 + \cos(2x) \right) = 6x^2+2\cos(2x)$$

and as you might hope they give the same answer.

You asked "do we still consider $y$ a constant when evaluating $\frac{\partial f}{\partial x}$?" Yes, as in $2xy$ term in the start of (2) above. The impact of varying $y$ is found in the $\frac{d y}{d x}$ and $\frac{\partial f}{\partial y}$ terms and that enables the full derivative $\frac{df}{dx}$ to be found

No. You still have to considerate all the functions of the variable you want to differentiate with respect to (unless otherwise stated). In fact, you could differentiate as follows:

$$f_x'=2xy+x^2y'+y'\cos y\;\stackrel{\text{if}\;y=2x}=4x^2+2x^2+2\cos2x=6x^2+2\cos2x$$

Or, first susbtituting $\;y=2x\;$ :

$$f(x,2x)=x^2\cdot2x+\sin2x=2x^3+\sin 2x\implies f'_x=6x^2+2\cos 2x$$

• By "yes" I believe you mean "no", in response to the OP's question "do we still...?" Oct 7 '16 at 13:23
• @GFauxPas Thanks, that is true. I shall edit. Oct 7 '16 at 13:34