# How to move differentation before the integral?

I have quite a lot expressions that need to be integrated after switching the integral sign with differentiation operator. The additional problem is that the bounds are dependent to one of the variables. So I need to use:

$\int_{a(y)} ^{b(y)} {\frac{\partial f(x,y)}{\partial y}}=\frac{\partial}{\partial y} \int_{a(y)} ^{b(y)} f(x,y) dx- \frac{db}{dy}f(x=b,y)+\frac{da}{dy}f(x=a,y)$

How do I achieve this in Mathematica? For now Mathematica just writes the output

Integrate[D[f[x, y], y], {x, a[y], b[y]}]


in the symbolic form. How do I workaround this? Of course I can write my own function, but I wonder if Mathematica has some built in functionality I require.

• Does a replacement rule work? (your expression) /. HoldPattern[Integrate[D[e_, y_], {x_,a_,b_}]]:>D[Integrate[e,{x,a,b}],y]-D[b,y](e/.x->b)+D[a,y](e/.x->a) – celtschk Sep 14 '12 at 9:26
• Probably it does. I just wondered if there is some kind of function implementing this theorem. – Misery Sep 14 '12 at 10:01
• I am not sure if this is relevant to your question,but Mma does use the Leibniz rule: when you evaluate D[Integrate[f[x, y], {x, a[y], b[y]}], y] you get Integrate[Derivative[0, 1][f][x, y], {x, a[y], b[y]}] - f[a[y], y]*Derivative[a][y] + f[b[y], y]*Derivative[b][y]. – kglr Sep 14 '12 at 10:41
• Well, it looks like my doesn't :] Or better... sometimes it does tometimes it doesn't <?> Ok, now I get it, it does so only in one direction. – Misery Sep 14 '12 at 10:49

Try this:

g[y_] := Inactivate[Integrate][f[x, y], {x, a[y], b[y]}];


Then its derivative:

D[g[y], y]


yields Let us now make an equation:

    eq = Inactivate[D[Integrate[f[x, y], {x, a[y], b[y]}], y],
D | Integrate] == D[g[y], y] and solve it with respect to the integral in question: Done. Have fun!