Define $f, g: \mathbb{R}^2 \rightarrow \mathbb{R}^2$ as \begin{align*} f(x,y) := (x^2 + y^2, \sin(xy)) \\ g(x,y) := (xy, e^{y}) \end{align*} Compute the derivative $D(g \circ f)$ in two ways: using the chain rule and by first writing out the map $g \circ f: \mathbb{R}^2 \rightarrow \mathbb{R}^2$ explicitly.
I need help for this question..
My idea:
First we will calculate the derivative $D(g \circ f)$ using the chain rule. We have \begin{align*} Df(x,y) &= \begin{pmatrix} \frac{\partial f_1}{\partial x}(x^2 + y^2) & \frac{\partial f_1}{\partial y}(x^2 + y^2) \\ \frac{\partial f_2}{\partial x}(\sin(xy)) & \frac{\partial f_2}{\partial y}(\sin(xy)) \end{pmatrix} = \begin{pmatrix} 2x & 2y \\ y\cos(xy) & x\cos(xy) \end{pmatrix} \\ \end{align*} and \begin{align*} Dg(x,y) &= \begin{pmatrix} \frac{\partial g_1}{\partial x}(xy) & \frac{\partial g_1}{\partial y}(xy) \\ \frac{\partial g_2}{\partial x}(e^y) & \frac{\partial g_2}{\partial y}(e^y) \end{pmatrix} = \begin{pmatrix} y & x \\ 0 & e^y \end{pmatrix} \end{align*} Now we can calculate $D(g \circ f)(x,y)$: \begin{align*} D(g \circ f)(x,y) &= Dg(f(x,y)) \circ Df(x,y) \\ & = Dg(x^2 + y^2, \sin(xy)) \circ Df(x,y) \\ &= \begin{pmatrix} \sin(xy) & x^2 + y^2 \\ 0 & e^{\sin(xy)} \end{pmatrix} \circ \begin{pmatrix} 2x & 2y \\ y\cos(xy) & x\cos(xy) \end{pmatrix} \\ &= \begin{pmatrix} 2x\sin(xy) + x^2y\cos(xy) + y^3 \cos(xy) & 2y\sin(xy) + x^3\cos(xy) + xy^2\cos(xy) \\ e^{\sin(xy)}y\cos(xy) & e^{\sin(xy)}x\cos(xy) \end{pmatrix}. \end{align*} Now we will calculate the derivative $D(g \circ f)(x,y)$ by writing out the map $g \circ f: \mathbb{R}^2 \rightarrow \mathbb{R}^2$: \begin{align*} (g \circ f)(x,y) &= g(f(x,y)) \\ &= g(x^2 + y^2, \sin(xy)) \\ &= (x^2\sin(xy) + y^2\sin(xy), e^{\sin(xy)}) \end{align*} We can find the derivative again: \begin{align*} D(g \circ f)(x,y) &= \begin{pmatrix} \frac{\partial}{\partial x} (x^2\sin(xy) + y^2\sin(xy)) & \frac{\partial}{\partial y} (x^2\sin(xy) + y^2\sin(xy)) \\ \frac{\partial}{\partial x} (e^{\sin(xy)}) & \frac{\partial}{\partial y} (e^{\sin(xy)})\end{pmatrix} \\ &= \begin{pmatrix} 2x\sin(xy) + x^2y\cos(xy) + y^3\cos(xy) & x^3\cos(xy) + 2y\sin(xy) + xy^2\cos(xy) \\ e^{\sin(xy)}y\cos(xy) & e^{\sin(xy)} x\cos(xy) \end{pmatrix} \end{align*} Both methods give the same derivative.
$\def\<{\langle}\def\>{\rangle}$We have the functions in $\Bbb R^2\mapsto\Bbb R^2$.
$$\begin{align}f:\<x,y\>&\mapsto \<x^2+y^2, \sin xy \>\\ g:\<x,y\>&\mapsto\<xy,\mathrm e^y\>\end{align}$$
The chain rule is $\def\D{\mathcal D}\D(g\circ f)=(\D g\circ f)\D f $
Let's examine the latter. Remember to compose $\D g$ with $f$.
$$\begin{align} \D g:\<x,y\>&\mapsto\begin{bmatrix}y&x\\0&\mathrm e^y\end{bmatrix}\\\D g\circ f:\<x,y\> &\mapsto\begin{bmatrix}\sin xy&x^2+y^2\\0&\mathrm e^{\sin xy}\end{bmatrix}\\\D f:\<x,y\>&\mapsto\begin{bmatrix}2x&2y\\y\cos xy&x\cos xy\end{bmatrix}\\(\D g\circ f)\D f:\<x,y\>&\mapsto\begin{bmatrix}2x\sin xy+(x^2+y^2)y\cos xy&2y\sin xy+(x^2+y^2)x\cos xy\\y\mathrm e^{\sin xy}\cos xy&x\mathrm e^{\sin xy}\cos xy\end{bmatrix}\tag 1\end{align}$$
Now the former.
$$\begin{align}g\circ f:\<x,y\>&\mapsto((x^2+y^2)\sin xy, \mathrm e^{\sin xy}\>\\\D(g\circ f):\<x,y\>&\mapsto\begin{bmatrix}2x\sin xy+(x^2+y^2)y\cos xy&2y\sin xy+(x^2+y^2)x\cos xy\\y\mathrm e^{\sin xy}\cos xy&x\mathrm e^{\sin xy}\cos xy\end{bmatrix}\tag 2\end{align}$$