Answer
$y=\frac{5}{4}e^{2x}+\frac{1}{4}e^{2x-1}), x \lt 1$
and $y=\frac{5}{4}e^{2x},x\geq 1$
Work Step by Step
We are given:
$y'-2y=f(x)$
where
$f(x)=1-x,x \lt 1$
and $f(x)=0,x \geq 1$
Integrating factor:
$I(t)=e^{\int -2dx}=e^{-x}$
Multiply both sides by the intergrating factor:
$e^xy'+e^xy=\frac{d}{dx}(ye^x)$
Integrate both sides:
$\int If(x)dx=\int \frac{1}{4}e^{-2x}(2x-1), x \lt 1$
and $\int If(x)dx=0, x \geq 1$
The general solution is:
$y=e^{2x}(c+\frac{1}{4}e^{2x-1}), x \lt 1$
and $y=e^{2x}(c+0),x\geq 1$
Since $y(0)=1$
$1=e^0(c+\frac{1}{4}e^0(0-1)) $
Solve for $c$:
$c=\frac{5}{4}$
Hence the particular solution are
$y=\frac{5}{4}e^{2x}+\frac{1}{4}e^{2x-1}), x \lt 1$
and $y=\frac{5}{4}e^{2x},x\geq 1$