[Math] solve the differential equation $ y’ +xy=c$

ordinary differential equations

I know how to solve differential equations but I think I am getting confused because there is a constant. I began by using integrating factors but when then end up with a very complicated integral which doesn't seem right because the original equation seems pretty straight forward. Please help!

I used the integrating factor $\mu=e^{x^2/2}.$ After multiplying the entire equation by $\mu$ and integrating I end up with $e^{x^2/2}y= \int Ce^{x^2/2}\,dx.$

I apologize if the formatting is off. I haven't quite gotten the hang of this syntax.

Best Answer

Here are the steps $$ \frac{d}{dx}[y]+xy=c $$ Let $\mu=\exp\left(\int x\ dx\right)= \exp\left(\frac{x^2}{2}\right)$. So now $$ \mu\frac{d}{dx}[y]+\mu xy=c\mu $$ $$ \exp\left(\frac{x^2}{2}\right)\frac{d}{dx}[y]+ \exp\left(\frac{x^2}{2}\right)xy=c\exp\left(\frac{x^2}{2}\right) $$ $$ \exp\left(\frac{x^2}{2}\right)\frac{d}{dx}[y]+ \frac{d}{dx}\left[\exp\left(\frac{x^2}{2}\right)\right]y=c\exp\left(\frac{x^2}{2}\right) $$ $$ \frac{d}{dx}\left[\exp\left(\frac{x^2}{2}\right)y\right]=c\exp\left(\frac{x^2}{2}\right) $$ $$ d\left[\exp\left(\frac{x^2}{2}\right)y\right]=c\exp\left(\frac{x^2}{2}\right)\ dx $$ $$ \int d\left[\exp\left(\frac{x^2}{2}\right)y\right]=c\int \exp\left(\frac{x^2}{2}\right)\ dx $$ $$ \exp\left(\frac{x^2}{2}\right)y+C=c\int \exp\left(\frac{x^2}{2}\right)\ dx $$ $$ \exp\left(\frac{x^2}{2}\right)y=c\int \exp\left(\frac{x^2}{2}\right)\ dx+C $$ $$ y=\frac{c\int \exp\left(\frac{x^2}{2}\right)\ dx+C}{\exp\left(\frac{x^2}{2}\right)} $$ Note that the above integral cannot be expressed in terms of elementary functions.

Related Question