Obtaining Differential Equations from Functions I can now recognise the order and the type of differential equations.Let's say
 $$\frac{dy}{dx} = x^2 - 1$$ 
is a first order ODE, 
 $$\frac{d^2y}{dx^2} + 2\left(\frac{dy}{dx}\right)^2 + y = 0$$ 
is a second order ODE and so on. I am having trouble to obtain a differential equation from a given function. I could find the differential equation for $y = e^x(A \cos x + B \sin x)$ and the steps that I followed are as follows.
$$ 
\begin{align*}
\frac{dy}{dx} &= e^x(A \cos x + B \sin x) + e^x(-A \sin x + B \cos x) 

\\ &= y +e^x(-A \sin x + B \cos x) \tag{1}
\\
\frac{d^2 y}{dx^2} &= \frac{dy}{dx} + e^x(-A \sin x + B \cos x) + e^x(-A \cos x - B \sin x)
\\ &=
\frac{dy}{dx}+\left(\frac{dy}{dx} - y\right) - y 
\end{align*}
$$
using the orginal function and $(1)$. Finally,
$$ 
\frac{d^2y}{dx^2} - 2 \frac{dy}{dx} + 2y = 0 ,$$ 
which is the required differential equation.
Similarly, if the function is $y=(A\cos2t + B\sin2t)$, the differential equation that I get is 
$$
\frac{d^2y}{dx^2} + 4y = 0
$$ 
following similar steps as above.

My question is how do I obtain the differential equations for the following functions using similer procedures
$$y = Ae^{3x} + Be^{2x}$$
$$xy = Ae^{x} + Be^{-x} + x^{2}$$
I am not looking for a solution in determinant form using vector spaces or any other linear algebra/matrices.Please provide step by step solution for the function in order to obtain a particular differential equation.

Thank you in advance.
 A: An answer has already been given for $y=Ae^{3x}+Be^{2x}$, so we deal with 
$$xy=Ae^x+Be^{-x}+x^2 \qquad\text{(Equation $1$)}$$
Differentiate both sides of the given equation twice with respect to $x$. We first get
$$x\frac{dy}{dx}+y=Ae^x-Be^{-x}+2x,\qquad\text{(Equation $2$)}$$
and then, differentiating again,
$$x\frac{d^2y}{dx^2}+2\frac{dy}{dx}=Ae^x+Be^{-x}+2 \qquad\text{(Equation $3$)}$$
Now look at Equation $1$ and Equation $3$. The term $Ae^x+Be^{-x}$ occurs in each.  Subtract, and it disappears. We obtain
$$x\frac{d^2y}{dx^2}+2\frac{dy}{dx}-xy=2-x^2.$$
A: Generally, in such problems, if the function involves $k$ arbitrary constants, we expect to differentiate $k$ times. Then, we should eliminate the arbitrary constants and obtain a differential equation in terms of 
$$
y, \frac{dy}{dx}, \frac{d^2y}{dx^2}, \ldots, \frac{d^ky}{dx^k}.
$$
We will see how this works out in the case of $$ y = Ae^{3x} + Be^{2x} . \tag{1}$$ Since there are two arbitrary constants $A$ and $B$, we expect to involve $y$ and its first two derivatives. Differentiating twice, we get
$$
\frac{dy}{dx} = 3A e^{3x} + 2B e^{2x}, \tag{2}
$$
and
$$
\frac{d^2 y}{dx^2} = 9 A e^{3x} + 4B e^{2x}. \tag{3}
$$
Now, how do we eliminate $A$ and $B$ from these equations? We can eliminate $B$ from $(2)$ and $(3)$ by subtracting a suitable multiple of $(1)$. That is, $(2) - 2 \times (1)$ 
gives:
$$
\frac{dy}{dx} - 2y = A e^{3x}. \tag{4}
$$
Similarly, $(3) - 4 \times (1)$ gives:
$$
\frac{d^2y}{dx^2} - 4y = 5 A e^{3x}. \tag{5}
$$
To get the differential equation, we now need to similarly eliminate $A$ from these equations $(4)$ and $(5)$. Do you see how? 
A: Eliminate $a$ and $b$ from $$y = ae^{2x} +be^{3x}\tag{1}$$
$$\frac{dy}{dx} = 2ae^{2x} + 3be^{3x}\tag{2}$$
$$d^2y/dx^2 = 4ae^{2x} + 9be^{3x}\tag{3}$$
$(1)\cdot 2 -(2)$ we get
$$2y - \frac{dy}{dx} = -be^3x$$ 
$$b = e^{-3x} \left(\frac{dy}{dx} - 2y\right)\tag{4}$$
$(2)*2 - (3)$
$$2 \frac{dy}{dx} - \frac{d^2y}{dx^2} = - 3 b e^{3x}$$
$$b = 1/ 3e ^{3x} \left(\frac{d^2y}{dx^2} - 2 \frac{dy}{dx}\right)\tag{5}$$
compare $(4)$ and $(5)$
$$(dy/dx - 2y) = 1/3 \left(\frac{d^2y}{dx^2} - 2 \frac{dy}{dx}\right)$$
$$3\frac{dy}{dx} - 6y = \frac{d^2y}{dx^2} -2 \frac{dy}{dx}$$
$$\frac{d^2y}{dx^2} -5 \frac{dy}{dx} + 6y = 0$$
