derivative with respect to a function under integral I want to take derivative with respect to $p(t)$, but I am not sure if I can just assume $p(t)$ is another variable since it depends on $t$.
$$
  \pi = \int_a^b p(t)\cdot \bigl(a-b\cdot p(t)\bigr)\cdot(u-  v \cdot t)\, dt
$$
Thanks
 A: Okay, I'll expand my answer. For any fixed functions $p$ and $\phi$ the expression $\int_a^b (p(t)+h\phi(t))(a−bp(t)-bh\phi(t))(u−vt)dt$ is a function of the real variable $h$. So we can take derivative with respect to $h$ and equate that to $0$. If you are unsure about legitimacy of taking $\frac{d}{dh}$ under the integral sign, just expand the product and move the powers of $h$ out of the integrals. Like this: 
$$\int_a^b p(t)(a−bp(t))(u−vt)dt + h\left(\int_a^b \phi(t)(a−bp(t))(u−vt)dt + \int_a^b p(t)(-b\phi(t))(u−vt)dt\right) + h^2 \int_a^b \phi(t)(-b\phi(t))(u−vt)dt $$
If $p$ is an extremal function for this functional, the derivative $\frac{d}{dh}$ will be zero when $h=0$. So, 
$$\int_a^b \phi(t)(a−bp(t))(u−vt)dt + \int_a^b p(t)(-b\phi(t))(u−vt)dt = 0$$ 
(You notice that the effort put into extracting $h^2$ was wasted.) Combine the integrals and factor out $\phi$:
$$\int_a^b \phi(t)\left[(a−bp(t))(u−vt)-bp(t)(u-vt)\right]\,dt  = 0$$ 
Since $\phi$ could be any integrable function, the expression in square brackets must be $0$ identically. This gives you an equation for $p$.
