# Finding $\frac{\partial g\left(x,x+y\right)}{\partial x}$?

Suppose I have a function such that \begin{align} f\left(x,y\right)&=x^2+y^2+xy, \end{align} now let $v=x+y\implies y=v-x$, therefore \begin{align} f\left(x,v-x\right)&=x^2+\left(v-x\right)^2+x\left(v-x\right)\\ \require{cancel}&=x^2+v^2-\cancel{xv}+\cancel{x^2}+\cancel{xv}-\cancel{x^2}-2vx\\ &=x^2-2vx+v^2. \end{align} Now I'm going to let \begin{align} g\left(x,v\right)=x^2-2vx+v^2. \end{align}

Suppose now that I want to find $\displaystyle\frac{\partial g}{\partial x}$? It seems I would have to add in the piece from before since $v=y+x$, but how do I do that throughout the chain rule of partial differentials? This is what I think might happen: \begin{align} \frac{\partial g}{\partial x}&=\frac{\partial g}{\partial x}+\frac{\partial g}{\partial v}\frac{\partial v}{\partial x},\tag{1} \end{align} and if I might want to find $\displaystyle\frac{\partial g}{\partial y}$ I would have to do something like \begin{align} \frac{\partial g}{\partial y}&=\frac{\partial g}{\partial v}\frac{\partial v}{\partial y},\tag{2} \end{align} but are $\left(1\right)$ and $\left(2\right)$ right?

• Equation (1) is necessarily wrong as $\frac{\partial g}{\partial v}\frac{\partial v}{\partial x} \neq 0$. – Mahdi Mar 15 '15 at 4:46

$$\frac{\partial g(x,v(x,y))}{\partial x} = 2x - 2 v -2x \frac{\partial v}{\partial x} + 2v \frac{\partial v}{\partial x}= 0.$$
$$g(x,v) = (x-v)^2 = y^2 \Rightarrow \frac{\partial g}{\partial y}= 2y .$$
• $v$ is not a function of one variable though. So it should be $\displaystyle\frac{\partial g\left(x,v\left(x,y\right)\right)}{\partial x}$...? – jm324354 Mar 15 '15 at 4:55
• Also, note that this two equations are correct only if we know a priori that $v=v(x,y)$ otherwise $\partial_{y}g=0$. – Mahdi Mar 15 '15 at 5:04