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?