# Differentiating through this integral in banking loans?

Working through the math which gives the following profit function for a bank but I can't seem to solve this first order condition. The profit function is defined as follows,

$$\begin{equation} \pi_t = p_{k,t-1} R^L_{k,t-1} L_{k,t-1} + (1-p_{k,t-1}) \frac{L_{k,t-1}}{\int_0^1 L_{k,t-1}dk} \tau \theta_{t-1} a_{t-1} - R^D_{t-1} L_{k,t-1} + \mu_t^B \bigg( \int_0^1 \bigg[\bigg(\frac{R_t^L + \eta \frac{1}{\theta_t}}{R^L_{k,t}+ \eta \frac{1}{\theta_{k,t}}} \bigg)^{\epsilon} x_t + \gamma^L s_{k,t-1} \bigg] dj - L_{k,t} \bigg) \end{equation}$$

and the FOC they get for $$L_{k,t}$$,

$$\begin{equation} \partial L_{k,t}: p_{k,t} R^L_{k,t} + (1-p_{k,t}) \frac{\tau \theta_t a_t}{\int_0^1 L_{k,t} dk} - R^D_t - \mu_B =0 \end{equation}$$

I can't seem to make sense of this differentiation of the integral. I have been looking at Leibniz integral rule all day. My understanding was that the following holds when the bounds of the integral are constants,

$$\begin{equation} \frac{\partial}{\partial x} \bigg( \int_0^1 f(x) dx \bigg) = \frac{\partial}{\partial x} f(x) dx \Big|_0^1 \end{equation}$$

Using this rule I can't get what the result showen is. Am I incorrect or is this example incorrect?

Much appreciated.

In generic notation, we examine

$$\frac {d}{df} \left(\frac {f(x)}{\int_0^1 f(x) dx}\right)$$

Note that we take the derivative with respect to $$f$$ not with respect to $$x$$. Applying the standard rules we have

$$\frac {d}{df} \left(\frac {f(x)}{\int_0^1 f(x) dx}\right) = \frac{\int_0^1 f(x) dx-f\cdot \left[\frac{d}{df}\int_0^1 f(x) dx\right]}{\left(\int_0^1 f(x) dx\right)^2}$$

But

$$\frac{d}{df}\int_0^1 f(x) dx = 0$$

because this definite integral, having specific values as integration limits, is a number, a constant, not a function. So we end up with

$$\frac {d}{df} \left(\frac {f(x)}{\int_0^1 f(x) dx}\right) = \frac {1}{\int_0^1 f(x) dx}$$

that validates the obtained f.o.c.

Leibniz rule for differentiating under the integral sign does not enter the picture here.

• Thanks for the reply. I understand that since the integrand ends at dj I am not differentiating through that integral. I should have been more specific. It is the $\frac{L_{k,t}}{\int^1_0 L_{k,t}}$ that seems to be giving me issues. To me, differentiating this w.r.t. $L_{k,t}$ should yield $\frac{\int^1_0 L_{k,t} - L_{k,t}}{(\int^1_0 L_{k,t})^2}$. Is this incorrect? – justmacro1 Jan 21 '19 at 21:48
• Much appreciated. I see my error now. Thanks! – justmacro1 Jan 22 '19 at 21:22