Electromagnetic Induction - Magnetic Potential Energy of Inductor

As the current is increasing in our circuit so there will be a induced emf and induced current in the coil which will oppose this increasing current. So work should be done against this induced (emf and current) to maintain current i from battery source.
divide by dt both sides
remove dt from both sides
integrating both sides (work done increases from 0 to w and current increases from 0 to i)
so total energy supplied when current increases from zero to final value.