Answer
The proof is below.
Work Step by Step
We know that the force on the pencil is:
$F= -\rho_{water}gax$
We apply Newton's second law to find:
$ m\frac{dx^2}{dt^2}=-\rho_{water}gax$
(Recall, $\frac{dx^2}{dt^2}$ equals acceleration.)
We also know the following equations:
$\omega = \sqrt{\frac{g}{L}}$
$T=\frac{2\pi}{\omega}$
Combining these three equations, we find:
$T = 2\pi\sqrt{\frac{L}{g}}$