# Simplify Derivative with Substitution

I try to evaluate:

$$\frac{\partial}{\partial x} \log{u(x, y, z)}$$

Mathematica gives:

$$\frac{1}{x+y+z}$$

I want to simplify the expression with my function:

$$\frac{1}{u(x, y, z)}$$

How to do that?

Thanks.

u[x_, y_, z_] = x + y + z
Simplify[D[Log[u[x, y, z]], x]]


D[Log[u[x, y, z]], x] /. u[x_, y_, z_] :> Defer[u[x, y, z]]


1/u[x, y, z]

• A more general substitution: /. u[x_,y_,z_] -> Defer[u[x,y,z]]
– R zu
Nov 22, 2018 at 18:04
• @Rzu, good point.
– kglr
Nov 22, 2018 at 18:05

An alternative is to define UpValues instead of DownValues of u:

Derivative[1, 0, 0][u] ^:= 1&
Derivative[0, 1, 0][u] ^:= 1&
Derivative[0, 0, 1][u] ^:= 1&

D[Log[u[x, y, z]], x]


1/u[x, y, z]

• What are UpValues and DownValues? The definition in the doc seems recursive: UpValue "gives a list of transformation rules corresponding to all upvalues defined for the symbol f. "
– R zu
Nov 22, 2018 at 19:29
• @Rzu Maybe you can check out the documentation for UpSetDelayed and TagSetDelayed. Nov 22, 2018 at 19:39