# Derivative using chain rule with multi variable function

How would I calculate the total derivative using the chain rule with a multi-variable function? I need a total derivative with respect to $(t)$

$$R(t) = \max_x f(x^*(t, p), t)$$

Is this correct? $$\frac{\partial R}{\partial t} = \frac{\partial f}{\partial x} \frac{\partial x}{\partial t} \frac{\partial x}{\partial p} + \frac{\partial f}{\partial t}$$

Or do I need to extend it out?

$$\frac{\partial R}{\partial t} = \frac{\partial f}{\partial x} \frac{\partial x}{\partial t} + \frac{\partial f}{\partial x}\frac{\partial p}{\partial t} + \frac{\partial f}{\partial t}$$

I'm not sure how you got to your first option, but your second option is almost right. The only thing missing is the partial of $x^*$ with respect to $p$ in the second term.
• Ah, ok. So you need a partial effect of $p$ wrt $t$ taken from the derivative $dx/dt$. I was think I needed to expand out the middle term to account for that, but wasn't sure if the third term was necessary. This makes sense. Thanks! – Amstell Sep 19 '17 at 5:48