## Calculus (3rd Edition)

$$y= \frac{1}{2}\left(\sin x-\cos x\right)+ \frac{3}{2}e^{-x}$$
Given$$y^{\prime}+y=\sin x, \quad y(0)=1$$ This is a linear equation with $p(x) = 1,\ \ q(x) =\sin x$, so \begin{align*} \mu(x)&=e^{\int p(x)dx}\\ &=e^{\int dx}\\ &=e^x \end{align*} Then \begin{align*} y\mu(x) &=\int \mu(x)q(x)dx\\ e^{x}y &=\int e^x\sin xdx \end{align*} Use $$\int e^{a u} \sin b u d u=\frac{e^{a u}}{a^{2}+b^{2}}(a \sin b u-b \cos b u)+C$$ Then $$y= \frac{1}{2}\left(\sin x-\cos x\right)+ Ce^{-x}$$ Since $y(0)=1$, then $C= \frac{3}{2}$, and hence $$y= \frac{1}{2}\left(\sin x-\cos x\right)+ \frac{3}{2}e^{-x}$$