−y=x2 It is a linear differential equation. On comparing with
dy
dx
+Py=Q, we get P=−1,Q=x2 IF=e∫Pdx=e∫−1dx=e−x Required solution is y⋅e−x=∫x2e−xdx+c ⇒ye−x=−x2e−x+2∫xe−xdx ⇒ye−x=−x2e−x−2xe−x+2∫e−xdx ⇒ye−x=−x2e−x−2xe−x−2e−x+c ⇒y=−(x2+2x+2)+cex ⇒y+x2+2x+2=cex