If $L\frac{di}{dt}+Ri=E $, where $L, R$ and $E$ are constants, and it is known that $i=0$ at $t=0$, show that: $$ \int_{0}^{t} (Ei-Ri^2)dt = \frac{Li^2}{2} \tag1 $$
I'm very frustrated with this. First i noticed that there is no $t$ term appearing anywhere. Only $i$ is a function of $t$, i.e. $i(t)$. So i found that $i(t)=\frac{E}{R}-\frac{L}{R}\frac{di}{dt}$. I took the LHS of $(1)$ and tried to get to the second with no success.
Then i thought of starting from the RHS and trying to prove that $ \frac{L}{2}\frac{di^2}{dt} = Ei-Ri^2 $.
Everything i tried was to no avail. And many questions have arisen along the way. Can someone help me?
HINT:
$$f(t)\frac{df(t)}{dt}=\frac12 \frac{df^2(t)}{dt}$$