# How to take derivative of integral of function?

I'm reading a textbook where it forms a Lagrangian function

$$L = \int_0^1 f(x)^{1 - \frac{1}{\alpha}}dx - \lambda\int_0^1 g(x) f(x) dx$$ But how do you take the derivative of this thing? The variable that we want to optimize is $$f(x)$$, which is a function ($$g(x)$$ is a known function). So we need to take the derivative with respect to a function? How?

So in this case, what are the first-order conditions?

An important result of the calculus of variations is that if you have a functional $$L[f(x)]$$ such that $$L[f] =\int_a^b J(x,f,f') dx,$$ $$L$$ is minimized if $$\frac{\partial J}{\partial f} - \frac{d}{dx} \frac{\partial J}{\partial L'} = 0.$$ This is the Euler-Lagrange equation. In your case, $$L[f] = \int_0^1 \left[f(x)^{1-1/\alpha}-\lambda g(x) f(x) \right] dx,$$ therefore the Euler-Lagrange equation leads to $$\frac{\partial}{\partial f} \left[f(x)^{1-1/\alpha}-\lambda g(x) f(x) \right] - \frac{d}{dx} \frac{\partial}{\partial f'} \left[f(x)^{1-1/\alpha}-\lambda g(x) f(x) \right] =0.$$ The derivative in relation to $$f'$$ vanishes because $$L[f]$$ does not depend on $$f'$$. Evaluating the derivative in relation to $$f$$: $$\frac{\alpha-1}{\alpha}f(x) ^{-1/\alpha} - \lambda g(x) = 0$$ and now solving for $$f$$: $$f(x) = \left( \frac{\lambda \alpha}{\alpha-1} g(x)\right)^{-\alpha},$$ which is the $$f(x)$$ that minimize your $$L$$.