# Derivative of the inverse of a certain variable

I want to take a derivative of the inverse of a certain variable, e.g., being the function:

f[x_, a_, T_] := (a x^3)/T


I want the derivative with respect to $1/T$:

$$\frac{\partial f}{\partial \left(\frac{1}{T}\right)}=ax^3$$

It doesn't work with:

D[f[x, a, T], 1/T]


$\frac{\partial f(x,a,T)}{\partial \frac{1}{T}}$

neither if I define:

b=1/T


D[f[x, a, b], b]


It always state "1/T is not a valid variable"

$\frac{\partial f(x,a,T)}{\partial \frac{1}{T}}$

• Block[{c}, D[f[x, a, 1/c], c] /. c -> 1/T]. The Block is only there in case you happen to have c defined somewhere else. Dec 8, 2016 at 21:03
– RTS
Dec 8, 2016 at 21:19
• @march Why do not you put this as an answer? That was interesting for me. I needed this information the other day and I had not found it. Dec 8, 2016 at 22:08
• @march Seems simple to you, but to other users it's cool Dec 8, 2016 at 22:10
• @LCarvalho. I mean, I would guess that this is a duplicate, but I only had time to do a little searching, so I haven't found one yet. Nonetheless, I'll quickly write something up. Dec 8, 2016 at 22:20

you can also use the chain rule:

$$\frac{\partial f}{\partial \left(\frac{1}{T}\right)}=\frac{\frac{\partial f}{\partial T}}{\frac{\partial \frac{1}{T}}{\partial T}}$$

 D[f[x, a, T], T]/D[1/T, T]


a x^3

You had the right idea, except for Setting the value of b to be 1/T. The reason that doesn't work is that D does not have the Attribute HoldAll (or variants) which means that its arguments get evaluated before D does. That is, if you do

b = 1/T;
D[f[x, a, 1/b], b]


you get the error because 1/T has been put in place of b before the derivative is taken. The fix is to wrap the entire expression in the Block scoping construct, which will delay the evaluation of b until after the derivative is taken, like so:

f[x_, a_, T_] := (a*x^3)/T
b = 1/T;
Block[{b}, D[f[x, a, 1/b], b]]
(* a x^3 *)


Alternatively, use an undefined symbol and use a replacement rule. I prefer this version because I like to avoid cluttering up the global namespace with defined symbols. So:

f[x_, a_, T_] := (a*x^3)/T
Block[{c}, D[f[x, a, 1/c], c] /. c -> 1/T]
(* a x^3 *)

• Now yes. Very good tip. Dec 8, 2016 at 22:30