# Derivative w.r.t. limits of integration of double definite integral (Leibniz' rule)

How does Leibniz' rule work with a double definite integral, when the limits of integration of the inside integral depend on the variable in the outside integral?

For example, how do we calculate the below?

$$\frac{\mathrm{d}}{\mathrm{d}s} \left[ \int_0^s \int_0^{s-x} f(x,y) \,\mathrm{d}y \,\mathrm{d}x \right]$$

It seems that applying Leibniz' rule gives:

$$\int_0^{s-s} f(s,y) \,\mathrm{d}y + \int_0^s \frac{\mathrm{d}}{\mathrm{d}s} \int_0^{s-x} f(x,y) \,\mathrm{d}y \,\mathrm{d}x$$

$$= \int_0^{s-s} f(s,y) \,\mathrm{d}y + \int_0^s \int_0^{s-s} f(s,y) \,\mathrm{d}y \,\mathrm{d}x = 0 \,$$

which seems to be wrong (see below). Alternately, if we don't substitute $s$ for $x$ in the limit of integration, then what do we do with the left over $x$?

Obviously, if we could manually integrate the inside integral this problem goes away, so assume that there is no closed form for $\int f(x,y)\,\mathrm{d}y$.

Note: for the specific limits of integration I chose, this is a simplex with side length, $s$, so I would assume the answer is:

$$\int_0^s f(x, s-x) \,\mathrm{d}x$$

...but I can't figure out how to derive this result, or why/how to apply Leibniz' rule.

It seems that applying Leibniz' rule gives:

$$\int_0^{s-s} f(s,y) \,\mathrm{d}y + \int_0^s \frac{\mathrm{d}}{\mathrm{d}s} \int_0^{s-x} f(x,y) \,\mathrm{d}y \,\mathrm{d}x$$

$$= \int_0^{s-s} f(s,y) \,\mathrm{d}y + \int_0^s f(x,s-x) \,\mathrm{d}x = \int_0^s f(x,s-x) \,\mathrm{d}x \,$$

-
My bad. Thanks for clarifying. It seems everything was due to a simple error in substitution! Marked @Daniel's answer correct as it was first. –  user1166202 Feb 16 at 2:20

$$\frac{d}{ds}\int_0^{s-x} f(x,y)\,dy = f(x,s-x),$$
I think, $\frac{d}{{ds}}\int_0^{s - x} {f\left( {x,y} \right)dy} = f\left( {x,s - x} \right)$, is it?