dydx=y+2x⇒dydx−y=2x
This is of the form dydx+py=Q
Where p=−1,Q=2x
∫pdx=∫−1dx=−x
IF=e∫pdx=e−x
Solution is y(IF)=∫Q(IF)dx+c
(i.e.,) ye−x=∫2xe−xdx+c
i.e.,)ye−x=2∫xd(e−x)+c
ye−x=−2xe−x+2e−x−1+c
(i.e.,) ye−x=−2xe−x−2e−x+c
Given, y=0 when x=0
⇒ 0=0−2+c⇒c=2
∴ equation of the curve is
ye−x=−2xe−x−2e−x+2
(i.e.,)ye−x=2(1−e−x−xe−x)
⇒y=2ex(1−e−x−xe−x)
⇒y=2(ex−1−x)
⇒y=2(ex−x−1)