# How to calculate the derivative

Let $$F(z)=\int_{a(z)}^{b(z)}g(x,z)dx$$

How do I calculate $$\frac{dF(z)}{dz}$$? I guess it will contain $$\frac{da(z)}{dz}$$, $$\frac{db(z)}{dz}$$ and $$\frac{\partial g(x,z)}{\partial z}$$, but I cannot come up with the correct form.

Result

$$F'(z) = b'(z) g(b(z),z)- a'(z)g(a(z),z)+\int_{a(z)}^{b(z)}\frac{\partial g(x,z)}{\partial z}\,dx$$

Derivation

Just write down the difference quotient and then take the limit.

The difference to be considered is

$$d= \left(F(z+h)-F(z)\right)=\int_{a(z+h)}^{b(z+h)}g(x,z+h)dx-\int_{a(z)}^{b(z)}g(x,z)dx$$

Now subtract and add terms which distribute the difference over the three locations of $$z$$

$$d = \left(\int_{a(z+h)}^{b(z+h)}g(x,z+h)dx-\int_{a(z)}^{b(z+h)}g(x,z+h)dx\right)\\ +\left( \int_{a(z)}^{b(z+h)}g(x,z+h)dx-\int_{a(z)}^{b(z)}g(x,z+h)dx\right)\\ +\left(\int_{a(z)}^{b(z)}g(x,z+h)dx-\int_{a(z)}^{b(z)}g(x,z)dx\right)$$

Simplify the integrals

$$d = \left(\int_{a(z+h)}^{b(z+h)}g(x,z+h)dx+\int_{b(z+h)}^{a(z)}g(x,z+h)dx\right)\\ +\left( \int_{a(z)}^{b(z+h)}g(x,z+h)dx+\int_{b(z)}^{a(z)}g(x,z+h)dx\right)\\ +\left(\int_{a(z)}^{b(z)}\left(g(x,z+h)-g(x,z)\right)dx\right)$$

and still one step further

$$d = -\int_{a(z)}^{a(z+h)}g(x,z+h)dx\\ + \int_{b(z)}^{b(z+h)}g(x,z+h)dx\\ +\int_{a(z)}^{b(z)}\left(g(x,z+h)-g(x,z)\right)dx$$

Now make the natural assumption that the functions $$a(z)$$ and $$b(z)$$ posess a derivative at $$z$$. Then we can write

$$a(z+h) = a(z) + a'(z) h + O(h^2)$$ $$b(z+h) = b(z) + b'(z) h + O(h^2)$$

and to first order in $$h$$ we get

$$d = -\int_{a(z)}^{a(z)+a'(z) h}g(x,z+h)dx\\ + \int_{b(z)}^{b(z)+b'(z) h}g(x,z+h)dx\\ +\int_{a(z)}^{b(z)}\left(g(x,z+h)-g(x,z)\right)dx$$

The difference quotient becomes

$$\left(d/h\right) = -\frac{1}{h}\int_{a(z)}^{a(z)+a'(z) h}g(x,z+h)dx\\ + \frac{1}{h}\int_{b(z)}^{b(z)+b'(z) h}g(x,z+h)dx\\ +\frac{1}{h}\int_{a(z)}^{b(z)}\left(g(x,z+h)-g(x,z)\right)dx$$

and in the limit $$h\to0$$ we get the result announced in the beginning.

We can write $$F(z) = G(a(z), b(z), z),$$ where $$G(a, b, z) = \int_a^b g(x, z) \, dx.$$ Naively (i.e., without checking any of the assumptions of the relevant theorems) we have $$\frac{\partial}{\partial a} G(a, b, z) = \frac{\partial}{\partial a} \int_a^b g(x, z) \, dx = -g(a, z),$$ and $$\frac{\partial}{\partial b} G(a, b, z) = \frac{\partial}{\partial b} \int_a^b g(x, z) \, dx = g(b, z),$$ and also $$\frac{\partial}{\partial z} G(a, b, z) = \frac{\partial}{\partial z} \int_a^b g(x, z) \, dx = \int_a^b \frac{\partial}{\partial z} g(x, z) \, dx.$$ Again, I want to emphasize that this is done without checking the necessary assumptions for all the manipulations just done (e.g., whether the fundamental theorem of calculus applies or whether we are justified in passing the derivative through the integral).

Next, continuing our blind assumption-free manipulations, we can use the chain rule to get \begin{aligned} \frac{d}{dz} F(z) &= \frac{d}{dz} G(a(z), b(z), z) \\ &= \frac{d}{dz} a(z) \frac{\partial}{\partial a} G(a, b(z), z) \big|_{a=a(z)} + \frac{d}{dz} b(z) \frac{\partial}{\partial b} G(a(z), b, z) \big|_{b=b(z)} + \frac{\partial}{\partial z} G(a(z), b(z), z) \\ &= -g(a(z), z) \frac{d}{d z} a(z) + g(b(z), z) \frac{d}{d z} b(z) + \int_{a(z)}^{b(z)} \frac{\partial}{\partial z} g(x, z) \, dx. \end{aligned}