Optimization: Simplifying the function from an expression in derivative and again taking derivative I am trying to maximize a function. When I took the first derivative, I found an expression very similar to one in original function. My question is that can I use the expression in the original function to simplify it and then again take derivative to find the optimum? I am not sure if it is mathematically correct. Thanks!

Following is the function and its derivative (when $Q<\frac{au}{2}$):
$$\pi_{1}=\int_{0}^{t^{*}}(\frac{a-\frac{Q}{u-vt}}{b})Qdt+\int_{t^{*}}^{T}\frac{a}{2b}(\frac{a}{2})(u-vt)dt-cQT$$
So I took derivative with respect to Q as follow ($t^{*}$ is a function of Q with $u-vt^{*}=\frac{2Q}{a}$ and $\frac{\partial t^{*}}{\partial Q}=-\frac{2}{av}$):
$$ \frac{\partial \pi_{1}}{\partial Q}=\frac{\partial t^{*}}{\partial Q}(\frac{a-\frac{Q}{u-vt^{*}}}{b})Q+\int_{0}^{t^{*}}(\frac{a-\frac{2Q}{u-vt}}{b})dt-\frac{\partial t^{*}}{\partial Q}(\frac{a^2}{4b})(u-vt^{*})-cT$$
$$ \int_{0}^{t^{*}}(\frac{a-\frac{2Q}{u-vt}}{b})dt-cT=0 $$
Then I used this expression that holds for optimal Q in the original function to simplify and got the following and again I took derivative.
$$\pi_{1}=\int_{0}^{t^{*}}\frac{Q^2}{b(u-vt)}dt+\int_{t^{*}}^{T}(\frac{a^2}{4b})(u-vt)dt$$
$$\frac{\partial \pi_{1}}{\partial Q}=\frac{\partial t^{*}}{\partial Q}\frac{Q^2}{b(u-vt^{*})}+\int_{0}^{t^{*}}\frac{2Q}{b(u-vt)}dt-\frac{\partial t^{*}}{\partial Q}(\frac{a^2}{4b})(u-vt^{*})=0$$

No, this won't work in general. Consider this example: 
$$
f(x) = x^2 + e^x
$$
At the minimum $x^* \approx -.351733$, we have:
$$
f'(x^*) = 2x^* + e^{x^*} = 0 \Rightarrow e^{x^*} = -2x^*
$$
There is no algebraic way to solve this, so one might be tempted to do what you're suggesting: plug the condition into the original function to simplify it. This gives:
$$
f(x^*) = {x^*}^2 - 2x^*
$$
This is equation is true for the specific value $x^*$, but it's not really meaningful to differentiate this expression. If we did differentiate it, we would get $f' =? \ 2x - 2$, leading to the erroneous conclusion that the minimum is at $x=1$, but clearly $f'(1) = 2 + e \ne 0$.
