# Multidimensional chain rule, online calculator

I would like to check my solutions for the derivative with the multidimensional chain rule, and I would like to do that online with a calculator. But I can not find one and I do not know how to use wolframalpha for it, which I am sure that it is capable of doing those.

$f:\mathbb{R}^2\to\mathbb{R}$, $f(u,v)=u^2+v^2$, $g:\mathbb{R}\to\mathbb{R}^2$, $g(t)=(e^t, t^2)$

And then derive $D(f\circ g)(t)$.

Do you know an online program, which can I use to check my solution, or how I can use wolframalpha for it?

I'm not sure this is exactly what you want, but if not, it should at least give you ideas what to try:

d/dt ReplaceAll[u^2+v^2,{u->e^t,v->t^2}]

• Thank you. Could you also give the code for a more complex composition, like $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)$. Then I should be able to understand how the "coding" works. On that example alone, I did not figure out how to do that. – Cornman Aug 19 '18 at 20:07
• @Cornman: That would be ReplaceAll[uv+vw-uw,{u->x+y,v->x+y^2,w->x^2+y}]. You didn't specify a derivative; if you want e.g. $\frac\partial{\partial x}(f\circ g)$, you can put d/dx in front of it. – joriki Aug 19 '18 at 20:13
• Does the multivariable chain rule needs this specification in general? Or do you need it just for the online calculation. I hope you understand the question. Having trouble to phrase it I guess... – Cornman Aug 19 '18 at 20:20
• @Cornman: I'm afraid I don't :-) – joriki Aug 19 '18 at 20:34

You can use the free Wolfram Cloud Sandbox to test these.

D[ u^2 + v^2 /. {u -> Exp[t], v -> t^2}, t]


or

D[ Function[{u, v}, u^2 + v^2] @@
Function[t, {Exp[t], t^2}] @ t, t]


or some other possibilites that the Wolfram Language allows.

For another example, try this

Dt[u v + v w - u w /. {u -> x + y, v -> x + y^2,
w -> x^2 + y}] // Simplify


or

Dt[Function[{u, v, w}, u v + v w - u w] @@
Function[{x, y}, {x + y, x + y^2, x^2 + y}] @@
{x, y}] // Simplify


or, again, some other possibilities. If you want a matrix try

{D[#, x], D[#, y]} & @ (u v + v w - u w /.
{u -> x + y, v -> x + y^2,  w -> x^2 + y}) // Simplify

• Thanks. I tried to solve the example I gave in the comments in the other answer. I tried: D[uv+vw-uw/. {u-> x+y, v-> x+y^2, w-> x^2+y},x,y]. I want the output to be a matrix. Is that possible? – Cornman Aug 19 '18 at 22:31
• Why a matrix and what will the entries of the matrix be? Can you give a really simple example? – Somos Aug 19 '18 at 22:48
• I seem to confuse something here... When you calculate $D(f\circ g)$ isnt this a matrix in general. In the example I try to solve I expect $D(f\circ g)$ to be a $2\times 1$ matrix, since $f\circ g:\mathbb{R}^2\to\mathbb{R}$. – Cornman Aug 19 '18 at 23:06
• Wait, that does not make sense, since it maps onto $\mathbb{R}$. Therefor no matrix. But what if you end up with $f\circ g:\mathbb{R}^3\to\mathbb{R}^3$, isnt the result a matrix/vector? – Cornman Aug 19 '18 at 23:08
• No. Do not confuse a function $F: \mathbb{R}^n\to\mathbb{R}^m$ with a $n\times m$ matrix. Maybe you want the Jacobian matrix? – Somos Aug 19 '18 at 23:09