The differential equation is
#L(di)/(dt)+Ri=Esin(omegat)#
The general solution to the ODE is
#i(t)=i_h+i_p#
The first is the solution to the homogeneous equation
#L(di)/(dt)+Ri=0#
#=>#, #L(di)/(dt)=-Ri#
#=>#, #(di)/i=-R/Ldt#
Integrating both sides
#=>#, #int(di)/i=int-R/Ldt#
#lni=-R/L*t+C_1#
#i=Ce^(-R/L*t)#
Let the particular solution be of the form
#i_p=Acos(omegat)+Bsin(omegat)#
#(di)/(dt)=-omegaAsin(omegat)+Bomegacos(omegat)#
Substituting this in the ODE, we get
#L(-omegaAsin(omegat)+Bomegacos(omegat))+R(Acos(omegat)+Bsin(omegat))=Esin(omegat)#
Grouping the coefficients of the sines and the cosines, we get
#-LAomega+RB=E#....................#(1)#
And
#LBomega+RA=0#....................#(2)#
Solving for #A# and #B#
#A=-(Lomega)/(R)B#
#Lomega((Lomega)/(R)B)+RB=E#
#B(L^2omega^2/R+R)=E#
#B=(ER)/(L^2omega^2+R^2)#
And
#A=-(Lomega)/(R)*(ER)/(L^2omega^2+R^2)#
#=-(LEomega)/(L^2omega^2+R^2)#
The particular solution is
#i_p=-(LEomega)/(L^2omega^2+R^2)cos(omegat)+(ER)/(L^2omega^2+R^2)sin(omegat)#
And the general solution is
#i(t)=-(LEomega)/(L^2omega^2+R^2)cos(omegat)+(ER)/(L^2omega^2+R^2)sin(omegat)+Ce^(-R/L*t)#
Plugging in the initial conditions #i=0# when #t=0#
#C=(LEomega)/(L^2omega^2+R^2)#
And finally,
#i(t)=-(LEomega)/(L^2omega^2+R^2)cos(omegat)+(ER)/(L^2omega^2+R^2)sin(omegat)+(LEomega)/(L^2omega^2+R^2)e^(-R/L*t)#