Taking derivative of integral in application problem The question reads as follows:
A high-tech company purchases a new computing system whose initial value is
$V$. The system will depreciate at the rate $f = f(t)$ and will accumulate maintenance costs at the rate $g = g(t)$, where $t$ is the time measure in months. The company wants to determine the optimal time to replace the system.
Let
$$ C(t) = \frac{1}{t}\int_0^t[f(s) + g(s)]ds $$
Show that the critical points of $C$ occur at the numbers $t$ where $C(t) = f(t) + g(t)$.
I have tried manipulating the integral by taking its derivative and setting it equal to 0, like so:
\begin{align} C(t) &= \int_0^t\frac{[f(s) + g(s)]}{t}ds\\
\frac{d}{dt}C(t) &= \frac{d}{dt}\int_0^t\frac{[f(s) + g(s)]}{t}ds\\
\frac{d}{dt}C(t) &= \frac{[f(t) + g(t)]}{t}\\
\frac{d}{dt}C(t) &= 0 = \frac{[f(t) + g(t)]}{t} \implies f(t)+g(t) = 0 
\end{align}
As I said, this is what I have so far, but I may be going in the completely wrong direction...

By Leibniz integral rule \begin{align}\frac{d}{dt}C(t) &= \frac{d}{dt}\left(\int_0^t\frac{[f(s) + g(s)]}{t}ds \right)\\&=\int_{0}^{t}\frac{\partial}{\partial t}\frac{[f(s) + g(s)]}{t}ds+\frac{[f(t) + g(t)]}{t}\cdot(t)'-\frac{[f(0) + g(0)]}{t}\cdot(0)'\\&=-\frac{1}{t}\int_0^t\frac{[f(s) + g(s)]}{t}ds+\frac{[f(t) + g(t)]}{t}\\&=-\frac{1}{t}C(t)+\frac{[f(t) + g(t)]}{t}\end{align} So $$\frac{d}{dt}C(t) =0 \iff -\frac{1}{t}C(t)+\frac{[f(t) + g(t)]}{t}=0$$

Of course, one should check that the assumptions of Leibniz integral rule apply and that one may indeed use it.
