We wish to optimize

Ultimately, we wish to solve

and then verify that the solution is indeed a local maximum. A first attempt might be to try integrating the above expression in order to obtain another expression for

, but note the presence of

in the integrand. The function

notoriously does not have a closed form antiderivative, so we should try to obtain

without integrating. The fundamental theorem of calculus does precisely this, but we have to apply it carefully, since the independent variable

appears in both integral bounds. A trick that can help here is to rewrite the integral as follows:

where

is an real number in the domain of

. We see then that

Since

is a periodic function with period

,

, and

We can now solve

:

Therefore

is a critical point of

. Now let us check that it is indeed a local maximum by computing

with the chain rule:

We can compute

, which verifies that

is indeed a maximum. Since the function

is differentiable and has no other critical points, it follows that

is a global maximum.
Thus the 4-month period that maximizes the average population is from
to
.