Question regarding multivariable chain rule... Suppose that $f : \mathbb R^2 \to \mathbb R$ is some function, and $g :\mathbb R^2 \to\mathbb R$ is deﬁned by $g(x, y) =
f(f(x, y), x)$. Write $d(g(x, y))/dx$ and $d(g(x, y))/dy$ in terms of partials of $f$. Verify your answer for $f(x, y) = x + y^2$.
Can you please explain how to go about solving this...
 A: $
\newcommand{\pwrt}[2]{\frac{\partial #1}{\partial #2}}
$
The idea with the multivariable chain-rule is to add up all "paths" that end with the variable that you are differentiating with respect to.  In this case we have
$g(x,y) = f(f(x,y),x)$.
In order to avoid any ambiguity, I will write this as
$$
g(x,y) = f(x_0(x,y),y_0(x,y))
$$
Where $x_0(x,y) = f(x,y)$ and $y_0(x,y) = x$.  The two paths we can take down to $x$ are $f \to x_0 \to x$ and $f \to y_0 \to x$.  So, we can write
$$
\begin{align}
\pwrt{g}{x} &= \pwrt{g}{x_0}\pwrt{x_0}{x} + \pwrt{g}{y_0}\pwrt{y_0}{x}\\
&= \pwrt{f}{x}(x_0,y_0)\cdot \pwrt{x_0}{x}+ \pwrt{f}{y}(x_0,y_0)\cdot \pwrt{y_0}{x}\\
&= \pwrt{f}{x}(x_0,y_0)\cdot \pwrt{f}{x}(x,y)+ \pwrt{f}{y}(x_0,y_0)\cdot 1\\
&= \pwrt{f}{x}(f(x,y),x)\cdot \pwrt{f}{x}(x,y)+ \pwrt{f}{y}(f(x,y),x)
\end{align}
$$
Let's confirm this for $f(x,y) = x + y^2$.  We note that
$$
\begin{align}
&f(f(x,y),x) = (f(x,y)) + x^2 = (x^2 + y) + x^2 = 2x^2 + y\\
&\pwrt{f}{x}(x,y) = 1\\
&\pwrt{f}{y}(x,y) = 2y\\
&\pwrt{f}{x}(f(x,y),x) = 1\\
&\pwrt{f}{y}(f(x,y),x) = 2x\\
\end{align}
$$
Now, just plug in and check.
A: Let's write this out.
$D_{1}G(x,y) = D_{1}f_{(f(x,y),x)}\cdot D_{1}f_{(x,y)} + D_{2}f_{(f(x,y),x)}\cdot D_{1}x 
= \frac{\partial f}{\partial x}(f(x,y),x)\cdot \frac{\partial f}{\partial x}(x,y) + \frac{\partial f}{\partial y}(f(x,y),x)$
and 
$D_{2}G(x,y) = D_{1}f_{(f(x,y),x)}\cdot D_{2}f_{(x,y)} +$ $D_{2}f_{(f(x,y),x)}\cdot D_{2}x = \frac{\partial f}{\partial x}(f(x,y),x)\cdot \frac{\partial f}{\partial y}(x,y) $.
So, let $f(x,y) = x + y^2$ and we have $D_{1}G = 1 + 2x$ and $D_{2}G = 2y$.
A: With $u = f(x, y)$ and $z = f(u, x) = g(x, y)$,
$$
\frac{\partial z}{\partial x} = \frac{\partial z}{\partial u} \cdot \frac{\partial u}{\partial x} + \frac{\partial z}{\partial x}
$$
and
$$
\frac{\partial z}{\partial y} = \frac{\partial z}{\partial u} \cdot \frac{\partial u}{\partial y}$$
Can you take it from there?
