Optimization inside integral I want maximize the integral
$$\int_a^b \left( 2 cx y(x) - e y(x)^2 \right) \, \mathrm{d}x$$
with respect to to $y(x)$.
If I discretize the problem, I get
$$ \frac{b-a}{n}\sum_{i=1}^n 2c(i/n(b-a)+a)y_i-eyi^2$$
If I take the derivative with respect to each $y_i$, I find in undiscretized version $y(x)$ as $\frac{cx}{e}$
If i plugin the values i get my optimization result.
I can understand the dynamics of the problem, but my calculus is a bit rusty, Is there anyone who can pinpoint which chapter of the calculus book should i skim in order to get more formal explanation. Thanks in advance

No fancy calculus is required. Since there are no constraints and no derivatives of $y$ occur in the integral, only $y$ itself, the integral is directly maximised by maximising the integrand at each point separately. Setting the derivative of $2cxy-ey^2$ with respect to $y$ to $0$ yields $2cx-2ey=0$ and thus $y=\frac{cx}e$.
