Step 1: Identify the given general solution.
The given function is
\[
y=Ae^x+Be^{-2x}
\]
This is the general solution of a second-order linear homogeneous differential equation with constant coefficients.
The terms \(e^x\) and \(e^{-2x}\) show that the roots of the auxiliary equation are
\[
m=1
\]
and
\[
m=-2
\]
Step 2: Form the auxiliary equation.
If the roots are \(1\) and \(-2\), then the auxiliary equation is
\[
(m-1)(m+2)=0
\]
Expanding,
\[
m^2+m-2=0
\]
Step 3: Convert auxiliary equation into differential equation.
For a linear differential equation with constant coefficients, replace \(m^2\) by
\[
\frac{d^2y}{dx^2}
\]
replace \(m\) by
\[
\frac{dy}{dx}
\]
and the constant term multiplies \(y\).
Thus, from
\[
m^2+m-2=0
\]
we get
\[
\frac{d^2y}{dx^2}+\frac{dy}{dx}-2y=0
\]
Step 4: Verify by direct differentiation.
Given,
\[
y=Ae^x+Be^{-2x}
\]
Differentiate once:
\[
\frac{dy}{dx}=Ae^x-2Be^{-2x}
\]
Differentiate again:
\[
\frac{d^2y}{dx^2}=Ae^x+4Be^{-2x}
\]
Now substitute in
\[
\frac{d^2y}{dx^2}+\frac{dy}{dx}-2y
\]
\[
=
(Ae^x+4Be^{-2x})+(Ae^x-2Be^{-2x})-2(Ae^x+Be^{-2x})
\]
\[
=
Ae^x+4Be^{-2x}+Ae^x-2Be^{-2x}-2Ae^x-2Be^{-2x}
\]
\[
=
0
\]
Hence, the given function satisfies the differential equation.
Step 5: Final Answer.
Therefore, the required differential equation is
\[
\boxed{\frac{d^2y}{dx^2}+\frac{dy}{dx}-2y=0}
\]