Second order ODE - undetermined coefficients for $f(x) = xe^x\cos{x}$ $$y'' + y = xe^x\cos{x}$$
So, the solution of the homogenous equation is $$y_h = C_1\cos{x} + C_2\sin{x}$$
Now, when I try to do the particular solution:
$$y_p = e^x(Ax+B)(C\cos{x}+D\sin{x})$$
Is this correct? We don't have to multiply by $x$, and because there's an $x$ in $f(x)$ we put a general polynomial of the first order, $Ax+B$. Because there's a trigonometric function, we put $C\cos{x} + D\sin{x}$, and $e^x$ is self explanatory.
However, when I find the second derivative and plug in everything into the equation to find the coefficients, I end up with a system of four equations which doesn't have a solution.
The second derivative is:
$$e^x(\sin{x} (-2acx - 2ac + 2ad - 2bc) + \cos{x} (2ac + 2adx + 2ad + 2bd))$$
I checked this on wolframalpha.
If add the $y_p$ to it and group the terms, I get
$$e^x(\sin{x} (-2acx - 2ac + 2ad - 2bc+axd+bd) + \cos{x} (2ac + 2adx + 2ad + 2bd+axc+bc))$$
Now, on the right side we have $e^xx\cos{x}$.
Let's compare the coefficients that multiply all functions containing $x\cos{x}$ with $1$ on the right side
$$2ad+ac=1$$
Now, compare all the coefficients of $\cos{x}$, $x\sin{x}$, $\sin{x}$ with 0
$$2ac+2ad+2bd+bc=0$$
$$-2ac+ad=0$$
$$-2ac+2ad-2bc+bd=0$$
This system does not have a solution, which leads me to think my $y_p$ is incorrect. However, I can't see my mistake.

The particular integral is of the type:
$y_p=e^{x}\Big((A x+B) cos(x)+(C x+D)sin(x)\Big)$.
The system instead is:
$A+2C-1=0$
$2A+B+2C+2D=0$
$C-2A=0$
$2A+2B-2C-D=0$.
The solution is:
$A=\frac{1}{5}$,
$B=\frac{-2}{25}$,
$C=\frac{2}{5}$,
$D=\frac{-14}{25}$.
The particular integral is:
$y_p=e^{x}\Big(\frac{5x-2}{25}cos(x)+\frac{10x-14}{25}sin(x)\Big)$,
