Given : xdydx+2y=x2
⇒dydx+2xy=x
Comparing it with linear differential equaiton of form:
dydx+Py=Q
P=2x,Q=x
So, the integrating factor is
I.F.=e∫2xdx (∵I.F.=e∫ pdx)
⇒I.F.=e2 In|x|
=eIn|x|2
=|x|2=x2
Therefore, the solution is
y.x2=∫x.x2dx+c
(∵y(I.F.)=∫Q(I.F)dx+c)
⇒y.x2=∫x3dx+c
⇒y.x2=x44+c
⇒y=x24+cx−2
Hence, the required solution is y=x24+cx−2