Question (from my sample exercises in calculus): Find constants $A, B$ and $C$ such that the function $$ y=A\sin x+B\cos x $$
satisfies the differential equation
$$ y''+y'-2y=\sin x. $$
I am currently stuck to the part where I already had the first and second degree derivative where
$$ \begin{align} (1) y''+y'-2y = (-A\sin x-B\cos x)+(A\cos x-B\sin x)-2(A\sin x+B\cos x)\\ = -A\sin x-B\cos x+A\cos x-B\sin x-2(A\sin x)-2(B\cos x) \end{align} $$
$$ (2)y''+y'-2y=\sin x <=> -A\sin x-B\cos x+A\cos x-B\sin x-2A\sin x-2B\cos x=\sin x $$
I forgot what to do next but I know it a few days ago =( I feel it's that part where you find two equations, I think, that would find the equation for finding A first and then B. I feel that my answer is already on my solution but I don't know where.
Starting from $$-A\sin x-B\cos x-A\cos x+B\sin x-2A\sin x-2B\cos x=\sin x,$$ you get $$(1+3A-B)\sin x +(3B+A)\cos x =0.$$ This equality must hold for all $x$. Taking $x=0$ and then $x=\frac{\pi}{2}$ you find $1+3A-B =0$ and $3B+A =0$. I guess you can finish now.