Let the original population by $P$. Let the population at the end of $t$ years by $x$.
Then, $\large\frac{dx}{dt} $$\propto x = kx$, where $k$ is a constant
Integrating, we get, $\log x = kt + C$
Initially, at $t = 0$, $x = P \rightarrow \log P = C \rightarrow \log x = kt + \log P$ .. (1)
At $t = 40$, $x = 2P$, $\log 2P = 40k + \log P \rightarrow 40k = \log 2 \rightarrow k = \large\frac{\log 2}{40}$
From (1), we get, $\log x= \large \frac{1}{40} $$\log 2\times t + \log P$
If $x = 3P \rightarrow \log 3P = \large\frac{1}{40}$$ \log 2 \times t + \log P$
$\Rightarrow \large\frac{1}{40}$$ \log 2 \times t = \log 3P - \log P = \log 3$
$\Rightarrow t = 40 \large\frac{\log 3}{\log 2}$ years to treble the population.