How to design a differential equation to match a given general solution? I am in a first year differential equations course, and in class on Friday, the teacher did a problem from the book that I wasn't quite sure how to solve (yet I'm sure has a possibility of showing up on a test!). 
The question I have written in my notes is: "create a differential equation that has $ y = C_1e^{-2x} + C_2e^{3x} + C_3xe^{3x} + e^x + x^2 + x $ as its general solution".
How would I go about doing this?
I see that the general solution has $ C_1e^{-2x} + C_2e^{3x} + C_3xe^{3x} $, meaning the characteristic equation for the homogeneous equation ($Y_h$) should have roots $-2, 3, 3$. I guess for that I should make a polynomial which yields these roots?
I also notice that the particular solution ($Y_p$) should be in the form $Ae^x + Bx^2 + Cx$. If we assume the DE I make is in the form $y'' + p(x)y' + q(x)y = f(x)$ - sorry if this isn't standard convention!), then $f(x)$ should contain something like $e^x + x^2 + x$ ? 
Perhaps I'm way off.
 A: Yes, you're on the right track.
Presuming you're looking for a linear d.e. with that general solution, note that since the solution space has three parameters, the d.e. must be third order (also, since $0$ is evidently not a solution, we know immediately that the d.e. cannot be homogeneous).
First, we find the (homogeneous) linear, constant-coefficient d.e. whose general solution is
$$C_1 e^{-2x} + C_2 e^{3x} + C_3 x e^{3x}.$$
Like you say, this form tells us that the characteristic polynomial of the d.e. has roots $-2, 3, 3$ and so it is
$$(r + 2) (r - 3)^2 = r^3 - 4 r^2 - 3 r + 18,$$
and the corresponding homogeneous d.e. is
$$y''' - 4 y'' - 3 y' + 18 y = 0.$$
Now, to account for the inhomogeneous part $e^x + x^2 + x$, we can simply substitute this expression in the l.h.s: We get
$$(e^x) - 4(e^x + 2) - 3(e^x + 2x + 1) + 18(e^x + x^2 + x) = 12 e^x + 18 x^2 + 12 x - 11.$$
In particular $e^x + x^2 + x$ is a solution of the inhomogeneous d.e.
$$\phantom{(\ast)} \qquad y''' - 4 y'' - 3 y' + 18 y = 12 e^x + 18 x^2 + 12 x - 11, \qquad (\ast)$$
and the difference of any two solutions of this equation is a solution $C_1 e^{-2x} + C_2 e^{3x} + C_3 x e^{3x}$ to the corresponding homogeneous equation; thus the general solution to $(\ast)$ is $$C_1 e^{-2x} + C_2 e^{3x} + C_3 x e^{3x} + e^x + x^2 + x$$ as desired.
A: Travis answer is nice, but, if you invest some time learning operators it may be easier to understand. Let $D=d/dx$. The operator $(D+2)$ gives $e^{-2x}$ in its kernel; $(D-2)[e^{-2x}] = -2e^{-2x}+2e^{-2x}=0$. Then $(D-3)$ for the $e^{3x}$, but, you have $x$ so repeat. Hence $L = (D+2)(D+3)^2$ gives you the operator which defines your differential equation so far as the homogeneous part is concerned. To pick up the non-homog. terms just feed them to $L$ and set $L(y) = L(e^x+x^2+x)$ to obtain the differential equation which you seek.
The square of an operator is composition. So,
$$ (D-3)^2[xe^{3x}] =(D-3)[e^{3x}+3xe^{3x}-3xe^{3x}] = (D-3)[e^{3x}]=0.$$
Notice, you can easily use induction to find the kernel of $(D-3)^n$ if you want. Try it out, see if you can reproduce the answer you get from undetermined coefficients with this operator method. The operator method is actually how we justify much of what you are doing. Unfortunately, some texts have little emphasis of the efficiency and clarity which comes at the price of just a little abstraction.
Added 4-6-2015: I thought it might be fun to flesh out what I sketched above. So, we have come to understand $L = (D-3)^2(D+2)$ gives us a differential equation $L[y]=0$ with solution $y_h =c_1e^{3x}+c_2xe^{3x}+c_3e^{-2x}$. We desire $y=x+x^2+e^x+y_h$ to be the solution of a differential equation (yet unknown) so calculate, use $L[y_h]=0$ and linearity to see:
\begin{align} L[x+x^2+e^x+y_h] &= 
(D-3)^2(D+2)[x+x^2+e^x] \\ 
&= (D-3)^2[1+2x+e^x+2(x+x^2+e^x)] \\
&= (D^2-6D+9)[1+4x+2x^2+3e^x] \\
&= 4+3e^x-6(4+4x+3e^x)+9(1+4x+2x^2+3e^x) \\
&= -11+12e^x+12x+18x^2. 
\end{align}
Thus,
$$ (D-3)^2(D+2)[y] = -11+12e^x+12x+18x^2 $$
is the differential equation you sought. Notice the advantage of my view point over the other answers. I did not have to do algebra to find coefficients to determine the forcing term $-11+12e^x+12x+18x^2 $; I merely had to differentiate. I offer to you, this is easier.
A: In general you would see that there are 3 (integration-)constants so that the (minimal) order of the ODE is $3$. Now compute from $y=f(x,C)$ the derivatives $y'=f_x(x,C)$ and $y''=f_{xx}(x,C)$ and solve this system of $3$ equations for the $3$ variables $C=(C_1,C_2,C_3)$. Then insert into $y'''=f_{xxx}(x,C)$. Or eliminate the constants from all 4 equations, i.e., solve for $(y''', C_1,C_2,C_3)$ and do not care about the final expressions for $C$.
In this case one might notice that the constants are always accompanied by the same exponentials, thus the linear system gets easier if this block is assembled into one auxillary variable.
\begin{smallmatrix}
y &=& C_1e^{-2x} &+ C_2e^{3x} &+ C_3xe^{3x} &+ e^x + x^2 + x&=&D_1&+D_2&+D_3x&+e^x + x^2 + x
\\
y' &=& -2C_1e^{-2x} &+ 3C_2e^{3x} &+ C_3(1+3x)e^{3x} &+ e^x + 2x + 1&=&-2D_1&+3D_2&+(1+3x)D_3&+e^x + 2x + 1
\\
y'' &=& 4C_1e^{-2x} &+ 9C_2e^{3x} &+ C_3(6+9x)e^{3x} &+ e^x + 2 &=&4D_1&+9D_2&+(6+9x)D_3&+e^x + 2
\\
y''' &=& -8C_1e^{-2x} &+ 27C_2e^{3x} &+ C_3(27+27x)e^{3x} &+ e^x  &=&-8D_1&+27D_2&+27(1+x)D_3&+e^x
\end{smallmatrix}
Eliminate $D_1$ from one equation to the next:
\begin{smallmatrix}
y'+2y     &=&  5D_2&+( 1+ 5x)D_3& +3e^x + 2x^2 + 4x + 1
\\
y''+2y'   &=& 15D_2&+( 8+15x)D_3& +3e^x + 4x+4
\\
y'''+2y'' &=& 45D_2&+(39+45x)D_3& +3e^x + 4
\end{smallmatrix}
Eliminate $D_2$ from one equation to the next
\begin{smallmatrix}
y''-y'-6y    &=&  5D_3& -6e^x -6x^2 -8x +1
\\
y'''-y''-6y' &=& 15D_3& -6e^x -12x-8
\end{smallmatrix}
And finally eliminating $D_3$
\begin{smallmatrix}
y'''-4y''-3y'+18y &=& 12e^x+18x^2 +12x-11
\end{smallmatrix}
gives the integration-constant-free differential equation.
