# Differentiate an integral with respect to a function

I want to know how I can differentiate this Integral with respect to $f(t)$. Please pay attention that the integral uppser bound is $t$ $$\frac{\partial}{\partial f(t)} \int_0^tf^3(\tau)\cdot g(\tau)d\tau$$ Thanks in advance

Set $u = f(t)$. Then we're looking at $\frac{\partial}{\partial u}\int_0^{f^{-1}(u)}f^3(\tau)\cdot g(\tau)d\tau$. By the Fundamental Theorem of Calculus and the Chain Rule, this is $f^3(f^{-1}(u))\cdot g(f^{-1}(u)) \cdot \frac{d}{du}f^{-1}(u)$. Recalling how derivatives of inverses work, $\frac{d}{du}f^{-1}(u) = \frac{1}{f'(f^{-1}(u))}$. Recalling how inverses work, $f(f^{-1}(u)) = u$, so we now have $\frac{u^3g(f^{-1}(u))}{f'(f^{-1}(u))}$. Finally, undoing the replacement $u = f(t)$, we have $\frac{f^3(t)g(t)}{f'(t)}$. Depending on any additional information you have, you may need to plug in expressions for $f$, $g$, or $f'$.

EDIT: Take the example suggested in the comments, $f(\tau) = e^{-2\tau}$ and $g(\tau) = \tau$. $\int_0^tf^3(\tau)g(\tau)d\tau = -\frac{1}{36}e^{-6t}(6t + 1) + C$ (since this is a definite integral, the $+C$ should be a particular value, but since we're taking a derivative immediately the value of $C$ is not relevant). Now, observing that $t = -\frac{1}{2}\ln{f(t)}$, we can re-write this expression as $-\frac{1}{36}u^3(-3\ln{u} + 1)$, where $u = f(t)$. Differentiating with respect to $u$, we get $\frac{1}{4}u^2\ln{u}$. Substituting $e^{-2t}$ for $u$, we have $\frac{1}{4}e^{-4t}(-2t) = -\frac{1}{2}e^{-4t}t$. Compare with the formula I gave above, which gives $\frac{e^{-6t}t}{-2e^{-2t}} = -\frac{1}{2}e^{-4t}t$.

• Thanks for your answer, but I checked your answer with an example, ($f(\tau)=e^{−2\tau}$ and $g(\tau)=\tau$) and the result is not correct. – Mostafa Jan 10 '17 at 10:15
• I think the reason is that the variable of integral is $\tau$, so you can not replace it with $u$ which is $f(t)$ not $f(\tau)$. I am a PhD student and I'm solving a problem which is strongly depending on solving this equation, please help me if you can. Thanks again. – Mostafa Jan 10 '17 at 10:41
• @Mostafa No, I'm never replacing $f(\tau)$ with $u$. I'm using the Fundamental Theorem to replace $f(\tau)$ with $f(t)$, which is a perfectly valid step, and then replacing that with $u$, which is also legal. My solution is correct in the case you suggested - I've expanded my answer with a work-through of the problem. – Reese Jan 10 '17 at 14:37
• thanks a lot, that's correct, my mistake was that I was differentiating the integral answer (here $-\frac{1}{36}e^{-6t}(6t + 1) + C$) with respect to $e^{-2t}$ and so the $t$ was ommited. Thanks again. – Mostafa Jan 10 '17 at 16:17

Let's try this with first principles. We start with defining, $$F\left( t \right) \triangleq \int {f\left( t \right)dt}.$$

As a result,

$$I\left( x \right) = \int\limits_{a\left( x \right)}^{b\left( x \right)} {f\left( t \right)dt} = \left. {F\left( t \right)} \right|_{a\left( x \right)}^{b\left( x \right)} = F\left( {b\left( x \right)} \right) - F\left( {a\left( x \right)} \right),$$

and the $N$-th derivative as,

\begin{align*} \frac{{{d^N}}}{{d{x^N}}}f\left( x \right) & = {f^{\left( N \right)}}\left( x \right). \end{align*}

On differentiating both sides of $I(x)$,

\begin{align} \frac{d}{{dx}}I\left( x \right) & = {F^{\left( 1 \right)}}\left( {b\left( x \right)} \right){b^{\left( 1 \right)}}\left( x \right) - {F^{\left( 1 \right)}}\left( {a\left( x \right)} \right){a^{\left( 1 \right)}}\left( x \right)\\ & =f\left( {b\left( x \right)} \right){b^{\left( 1 \right)}}\left( x \right) - f\left( {a\left( x \right)} \right){a^{\left( 1 \right)}}\left( x \right), \tag{1} \end{align} this is because ${F^{\left( 1 \right)}}(t) = f(t)$ (by definition).

Also, by chain-rule,

$$\frac{d}{{df\left( t \right)}}I\left( t \right) = \frac{d}{{dt}}I\left( t \right) \times \frac{{dt}}{{df\left( t \right)}} = \frac{{{I^{\left( 1 \right)}}\left( t \right)}}{{{f^{\left( 1 \right)}}\left( t \right)}}.$$

Now set $a\left( t \right) = t,b\left( t \right) = 0$ and $f\left( \tau \right) = {f^3}\left( \tau \right)g\left( \tau \right)$. Due to this, from (1), we have, ${I^{\left( 1 \right)}}\left( t \right) = {f^3}\left( t \right)g\left( t \right)$. Hence the answer simplifies to,

$$\boxed{\frac{d}{{df\left( t \right)}}I\left( t \right) = \frac{{{f^3}\left( t \right)g\left( t \right)}}{{{f^{\left( 1 \right)}}\left( t \right)}}}. \tag{2}$$

Example 1 $f\left( \tau \right) = \cos \left( \tau \right),g\left( \tau \right) = \tau$. This gives,

$$I\left( t \right) = \frac{1}{{36}}(27t\sin (t) + 3t\sin (3t) + 27\cos (t) + \cos (3t) - 28).$$

This gives, ${I^{\left( 1 \right)}}\left( t \right) = \frac{1}{{36}}(27t\cos (t) + 9t\cos (3t)).$ On the other hand, ${f^{\left( 1 \right)}}\left( t \right) = - \sin \left( t \right)$.

Applying (2) results in, $$\frac{{{f^3}\left( t \right)g\left( t \right)}}{{{f^{\left( 1 \right)}}\left( t \right)}} = \frac{{t{{\cos }^3}\left( t \right)}}{{ - \sin \left( t \right)}} = - t{\cos ^2}(t)\cot (t)$$

which is the same as applying chain rule with $I^{(1)}(t)$ and $1/f^{(1)}(t)$.

Example 2 $f\left( \tau \right) = {e^{ - 2\tau }},g\left( \tau \right) = \tau$. This gives, $$\begin{gathered} I\left( t \right) = \frac{1}{{36}}\left( {1 - {e^{ - 6t}}(6t + 1)} \right) \hfill \\ {I^{\left( 1 \right)}}\left( t \right) = \frac{1}{{36}}\left( {6{e^{ - 6t}}(6t + 1) - 6{e^{ - 6t}}} \right) = t e^{-6t} \hfill \\ \end{gathered}.$$

Also, ${f^{\left( 1 \right)}}\left( t \right) = - 2{e^{ - 2t}}$. Therefore, explicit computation gives,

$$\frac{{{I^{\left( 1 \right)}}\left( t \right)}}{{{f^{\left( 1 \right)}}\left( t \right)}} = t{e^{ - 6t}} \times \frac{1}{{ - 2{e^{ - 2t}}}} = - \frac{1}{2}{e^{ - 4t}}t.$$

While the formula (2) gives,

$$\frac{{{f^3}\left( t \right)g\left( t \right)}}{{{f^{\left( 1 \right)}}\left( t \right)}} = \frac{{t{e^{ - 6t}}}}{{ - 2{e^{ - 2t}}}} = - \frac{1}{2}t{e^{ - 4t}}.$$

• I made mistake, you are right, thanks a lot, thanks for your full answer. – Mostafa Jan 10 '17 at 17:16