# [SOLVED]2.1.4 solve de for y=

#### karush

##### Well-known member
$\textsf{Given:}$
$$\displaystyle y^\prime +y = xe^{-x}+1$$
$\textit{Solve the given differential equation}$
$\textit{From:$\displaystyle\frac{dy}{dx}+Py=Q$}$
$\textit{then:}$
$$\displaystyle e^x y=\int x+e^{-2x} \, dx + c \\ \displaystyle e^x y=\frac{1}{2}(x^2-e^{-2x})+c$$
$\textit{divide every term by$e^x$}$
$$\displaystyle y=\frac{1}{2(e^x)}(x^2) -\frac{e^{-2x}}{2(e^x)}+\frac{c}{(e^x)}$$
$\textit{simplify and reorder terms}$
$$\displaystyle y=c_1e^{-x}+\frac{1}{2}e^{-x}x^2+1$$
$\textit{Answer by W|A}$
$$y(x)=\color{red} {\displaystyle c_1e^{-x}+\frac{1}{2}e^{-x}x^2+1}$$

any bugs any suggest???

#### MarkFL

Staff member
The integrating factor is:

$$\displaystyle \mu(x)=e^x$$

And so we get:

$$\displaystyle y'e^x+ye^x=x+e^x$$

$$\displaystyle \frac{d}{dx}\left(e^xy\right)=x+e^x$$

Integrate:

$$\displaystyle e^xy=\frac{x^2}{2}+e^x+c_1$$

Hence:

$$\displaystyle y(x)=\frac{x^2}{2}e^{-x}+1+c_1e^{-x}$$

Somehow you arrived at the correct answer, but your work doesn't show how.

#### karush

##### Well-known member
Hence:

$$\displaystyle y(x)=\frac{x^2}{2}e^{-x}+1+c_1e^{-x}$$

Somehow you arrived at the correct answer, but your work doesn't show how.
ok I hit and missed with some examples
but see your steps make a lot more sense