Consider the following infinite-horizon optimal control problem for a firm in continuous time. At any moment $t \geq 0$, let $s(t) \in [0, 1]$ be the relative size of the market for the firm’s product. The evolution of $s(t)$ is governed by the following law of motion
$$s'(t) = \beta a(t) s(t)(1 − s(t))$$
where $a(t) \geq 0$ is the firm’s advertising effort, and $\beta > 0$ is a parameter for the effectiveness of advertising.
Note that s'(t) = 0 for any s(t) if a(t) = 0, and s'(t) = 0 at s(t) = 0 and $s(t) = 1$ for any a(t); if a(t) is a positive constant, say α, then the law of motion can be solved explicitly as s = s(0)/(s(0) + (1 − s(0))e −αβt), so that s(t) grows from any positive initial value s(0) to the eventual full size of 1.
Given some s(0) > 0, the firm’s objective is to maximize the present value of its profit
$\int_{0}^{\inf}$$e^{-pt}$($s(t)-0.5ka(t)^{2}$)
where ρ > 0 is the discount rate, k > 0 is a cost parameter, and $0.5ka(t)$ is the total cost of running the advertisement campaign at the level of a(t).
a) Write down the Hamiltonian of this dynamic optimization problem
b) Use the first-order condition to find a(t) that maximizes the Hamiltonian. Is the first order condition necessary and sufficient for the solution a(t) to maximize the Hamiltonian? Explain
c) ) Use the Maximum Principle to show that the optimal a(t) satisfies the differential equation : $a'(t) = a(t)p-s(t)(1-s(t))B/k$
For a) I got the H(a,s,$\pi$ ) = $e^{-pt}$($s(t)-0.5ka(t)^{2}$) + $\pi a(t)s(t)(1 − s(t))$
And I know the first order conditions are taking the the derivative of the Hamiltonian w.r.s to a(t) equating to 0 and the other being the derivative w.r.s to s(t) and equating to $-\pi$. However, here I get stuck when trying to solve for $a(t)$