#### Answer

$$y = 2 + C{e^{ - {x^2}}}$$

#### Work Step by Step

$$\eqalign{
& \frac{{dy}}{{dx}} + 2xy = 4x \cr
& {\text{this equation is already written in the form }}\frac{{dy}}{{dx}} + P\left( x \right)y = Q\left( x \right) \cr
& {\text{comparing }}\frac{{dy}}{{dx}} + 2xy = 4x{\text{ with }}\frac{{dy}}{{dx}} + P\left( x \right)y = Q\left( x \right){\text{ we can note that }}P\left( x \right){\text{ is }}2x{\text{ }} \cr
& {\text{The integrating factor is }}I\left( x \right) = {e^{\int {P\left( x \right)} dx}} \cr
& I\left( x \right) = {e^{\int {2x} dx}} = {e^{{x^2}}} \cr
& {\text{multiplying both sides of the differential equation by }}{e^{{x^2}}} \cr
& {e^{{x^2}}}\frac{{dy}}{{dx}} + 2xy{e^{{x^2}}} = 4x{e^{{x^2}}} \cr
& {\text{Write the terms on the left in the form }}{D_x}\left[ {I\left( x \right)y} \right] \cr
& {D_x}\left[ {{e^{{x^2}}}y} \right] = 4x{e^{{x^2}}} \cr
& {\text{solve for }}y{\text{ integrating both sides}} \cr
& {e^{{x^2}}}y = \int {4x{e^{{x^2}}}} dx \cr
& {e^{{x^2}}}y = 2\int {{e^{{x^2}}}\left( {2x} \right)} dx \cr
& {e^{{x^2}}}y = 2\left( {{e^{{x^2}}}} \right) + C \cr
& {e^{{x^2}}}y = 2{e^{{x^2}}} + C \cr
& y = 2 + \frac{C}{{{e^{{x^2}}}}} \cr
& y = 2 + C{e^{ - {x^2}}} \cr} $$