# How to make Mathematica use the chain rule?

Lets say I have the following PDE:

$$x^2 u_{xx} - u_{yy} + u_y = 0$$

And I have the following change of variables:

$$s(x,y) = x e^y \, \, \, , \, \, t(x,y) = x e^{-y}$$

How can I use Mathematica to compute $u_{xx}, u_{yy},u_y$ on terms of $u_{ss},u_{tt}, u_{ts},u_t,u_s$ using the definitions and the chain rule?

• If I understand well, closely related: 44904, possible duplicate: 9351 – Kuba Jun 15 '14 at 16:43

## 2 Answers

expr = x^2 D[u[x, y], {x, 2}] - D[u[x, y], {y, 2}] + D[u[x, y], y] $Assumptions = {s > 0, t > 0} expr /. u -> (u[# Exp[#2], # Exp[-#2]] &) /. {x -> Sqrt[s t], y -> Log[Sqrt[s/t]]} // Simplify Second set of replacement rules is from: Eliminate[s == x Exp[y] && t == x Exp[-y], x] Eliminate[s == x Exp[y] && t == x Exp[-y], y]  E^(2 y) t == s s t == x^2 && (s t)/x == x  I've forced $Assumptions so things like Sqrt[s^2] are reduced to s but keep them in mind. Sometimes it may be important.

Just in case someone else need it (for example, quite possibly myself in the future), this is how I've done it

(Note: In the answer a different change of variables has been used)

s[x_, y_] := Log[x] + y
t[x_, y_] := Log[x] - y
Factor@D[u[s[x, y], t[x, y]], {x, 2}]
FullSimplify@D[u[s[x, y], t[x, y]], y]
Factor@D[u[s[x, y], t[x, y]], {y, 2}]
x^2 D[u[s[x, y], t[x, y]], {x, 2}] -
Factor@D[u[s[x, y], t[x, y]], {y, 2}] +
FullSimplify@D[u[s[x, y], t[x, y]], y] // FullSimplify


Which outputs the following: Reading the output is quite anoying, but it was good enough for what I needed. (I'm sure it can be improved easily)