Since this, while a first order differential equation, is also linear we can also separate it. The "associated homogeneous equation" is y'= -y which we can write as \(\frac{dy}{dx}= -y\) and separate as \(\frac{dy}{y}= -dt\). Integrating, \(ln{y}= -t+ C\). Taking the exponential of both sides, \(y=C'e^{-t}\) where \(C'= e^C\).
Since the "non-homogeneous part", \(e^{-2t}\), is of the type of function we expect as a solution to a "linear differential equation with constant coeffcients" we try a solution of the form \(y= Ae^{-2t}\) (this is the "method of undetrmined coefficients". A is the coefficient to be determined.
If \(y= Ae^{-2t}\) then \(y'= -2Ae^{-2t}\) and putting those into the differential equation, \(-2Ae^{-2t}= -Ae^{-2t}+ e^{-2t}\). \(-Ae^{-2t}= e^{-2t}\). Dividing by \(e^{-2t}\) we have -A= 1 so A= -1/2.
The general solution to this differential equation is \(y(t)= Ce^{-t}- \frac{1}{2}e^{-2t}\).