I'm working at this simple linear first order ODE: $$y'+y=e^{x}$$ Rewriting as: $$y'=-y+e^{x}$$ I want to apply the formula: $$y(t)=e^{\int a(t)dt}\int e^{-\int a(t)dt}b(t)dt$$ Where, in this particular case, $a(t)=-1$ and $b(t)=e^{x}$.
So, $$A(t)=-x+c$$ $$B(t)=e^{x}+c$$ Are a primitives for $a(t)$ and $b(t)$. But, if i put these primitives int the formula I can't get the result. Where is my mistake? Have I misunderstood the formula? Thank you.
$$y'+y=e^{x}$$ Multiply both side by $e^x$ $$y'e^x+ye^x=e^{2x}$$ $$(ye^x)'=e^{2x}$$ Integrate $$(ye^x)=\int e^{2x}dx$$ therefore the solution is $$\boxed{y=e^{-x}( \frac {e^{2x}}2+K) \implies y(x)=Ke^{-x}+ \frac {e^{x}}2}$$ No the question you ask what is the exact formula ? $$y'=-y+e^{t}$$ $$y'=a(t)y+b(t)$$ $$y(t)=e^{\int a(t)dt}\int e^{-\int a(t)dt}b(t)dt$$ here $a(t)=-1$ $$y(t)=e^{-t}\int e^{t}b(t)dt$$ and $b(t)=e^t$ $$y(t)=e^{-t}\int e^{2t}dt$$ I add some lines for the integral its just integration of the exponential
$$I=\int e^{2t}dt=\frac {e^{2t}}2+K$$ $$\boxed{y(t)=Ke^{-t}+ \frac {e^{t}}2}$$