Answer
$q=q_0\cos (\frac{t}{\sqrt LC})$
Work Step by Step
Since $\frac{du}{dt}$, we obtain:
$$\frac{du}{dt}=\frac{du}{dq}\frac{dq}{dt}=u\frac{du}{dt}$$
In form of differential equation:
$$\frac{d^2q}{dt^2}+\frac{1}{LC}q=0$$
$$u\frac{du}{dq}+\frac{q}{LC}=0$$
$$udu+\frac{q}{LC}dq=0$$
Integrating both sides:
$$\frac{1}{2}u^2+\frac{1}{2}q^2.\frac{1}{LC}+c_1=0$$
Since $u(q_0)=0$, we have:
$$0+\frac{1}{2}q_0^2.\frac{1}{LC}+c_1=0$$
Solve for $c_1$:
$$ \rightarrow c_1=-\frac{1}{2LC}q_0^2$$
Hence here,
$$u=\sqrt \frac{1}{LC}(q_0^2-q^2)$$
$$\frac{dq}{dt}=\sqrt \frac{1}{LC}(q_0^2-q^2)$$
$$\int \frac{dq}{\sqrt q_0^2-q^2}=\int \frac{1}{\sqrt LC}dt$$
Integrating both sides:
$$\sin^{-1}(\frac{q}{q_0})=\frac{t}{\sqrt LC}+c_2$$
Since $q_0=q(0)$, we have:
$$c_2=\frac{\pi }{2}$$
Thus, the charge on the capacitor for $t \gt 0$ is:
$$q=q_0 \sin (\frac{\pi}{2}+\frac{t}{\sqrt LC})$$
$$q=q_0\cos (\frac{t}{\sqrt LC})$$