Particular solution for $y'' + y' - 2y = 3xe^x$ For the equation $y'' + y' - 2y = 3xe^x.$
the auxiliary equation $\lambda^2+\lambda-2 = 0$ and $\lambda_1= 1$ and $\lambda_2 =-2$
so generic solution is $$C_1e^x+C_2e^{-2x}$$
am I right that particular solution will be:
$$x(Ax+B)e^x \rightarrow (Ax^2+Bx)e^x$$
After opening the brackets I got $Ax^2$ but my book has another answer, so I am a bit confused about how to act in this cases
 A: First your generic solution (which you should call the homogeneous solution) is correct.To find the particular solution you should use the method of undetermined coefficients next.The complete solution is $y=y_h+y_p$. Where $y_h$ is the homogeneous solution and $y_p$ is the particular solution.  
Your guess for the particular solution should be of the form $$A x e^x + Bx^2 e^x  $$ where $A$ and $B$ are constants to be determined (That is your guess is correct). You now need to find
\begin{align}
\frac{d}{d x}A x e^x + Bx^2 e^x \\
\frac{d}{d x^2}A x e^x + Bx^2 e^x \\
\end{align}
and make the appropriate substitutions. After simplifying you should get $$(3 A+2B) e^x+6Be^x x=3 e^x x. $$
From which you can determine A and B.
A: You have the correct form of your particular solution. We have
$$y_p=(Ax^2+Bx)e^x$$
$$y_p'=(Ax^2+Bx)e^x+(2Ax+B)e^x=y_p+(2Ax+B)e^x$$
$$y_p''=y_p'+(2A)e^x+(2Ax+B)e^x=y_p+(2A)e^x+2(2Ax+B)e^x$$
Substituting this into the ODE yields
$$y_p+(2A)e^x+2(2Ax+B)e^x+y_p+(2Ax+B)e^x-2y_p=3xe^x$$
$$2A+6Ax+3B=3x$$
This tells us $A=\frac{1}{2}, B=-\frac{1}{3}$, so the particular solution is
$$y_p=(\frac{1}{2}x^2-\frac{1}{3}x)e^x$$
Your guess was correct! Note that I've skipped a lot of algebra in the beginning of the problem that I trust you can do.
A: make for the particular solution the ansatz $$y_P=(Ax^2+Bx+C)\exp(x)$$
i think your idea is good
for your Control the solution is given by $$y(x) ={{\rm e}^{x}}{\it \_C2}+{{\rm e}^{-2\,x}}{\it \_C1
}+1/6\, \left( 3\,x-2 \right) x{{\rm e}^{x}}
$$
