multidimensional chain rule, example Given $f:\mathbb{R}^3\to\mathbb{R}$, $f(u,v,w)=uv+vw-uw$ and
$g:\mathbb{R}^2\to\mathbb{R}^3$, $g(x,y)=(x+y, x+y^2, x^2+y)$, I have to give $D(f\circ g)(x,y)$
I calculated like this:
$Df(u,v,w)=(v-w, u+w, v-u)$ and
$Dg(x,y)=\begin{pmatrix} 1&1&2x\\ 1&2y& 1\\ 0&0&0\end{pmatrix}$
Furthermore it is $Df(g(x,y))=(x+y^2-x^2-y, x+y+x+y^2, x+y^2-x-y)$
Now with the multidimensional chain rule, we have:
$D(f\circ g)(x,y)=Df(g(x,y))\cdot Dg(x,y)$
$(y^2-x^2+x+y, y^2+y+2x, y^2-y)\cdot\begin{pmatrix} 1&1&2x\\ 1&2y& 1\\ 0&0&0\end{pmatrix}$
$$=(\color{red}{y^2-x^2+x-y+y^2+y+2x}, \color{blue}{y^2-x^2+x-y+2y^3+2y^2+2xy}, \color{orange}{2xy^2-2x^3+2x^2-2xy+y^2+y+2x})$$
$$=(\color{red}{2y^2+3x-x^2}, \color{blue}{2y^3+3y^2-y-x^2+x+4xy}, \color{orange}{y^2+y-2x^3+2x^2+2x+2xy^2-2xy})$$
Which is wrong accoring to:
http://www.wolframalpha.com/input/?dataset=&i=d%2Fdx+ReplaceAll%5Buv%2Bvw-uw,%7Bu-%3Ex%2By,v-%3Ex%2By%5E2,w-%3Ex%5E2%2By%7D%5D
[You might check Multidimensional chain rule, online calculator for further reference.]
But I do not see my mistake myself, unfortunatly.
Also I have a question, because I got a little bit confused by the notation.
If you write $g:\mathbb{R}^2\to\mathbb{R}^3$, $g(x,y)=(x+y, x+y^2, x^2+y)$, dont you have to be more clear and note $(x+y, x+y^2, x^2+y)^t$, since a vector in $\mathbb{R}^3$ should be normally noted like $\begin{pmatrix}x\\y\\z\end{pmatrix}$ this [where I just use $x,y,z$ because of simplicity], or do I mess something up here?
Thanks in advance.

$Dg(x,y)$ should be a matrix of $3\times 2$.
