# Why is the particular solution for $x''+9x=80\cos(5t)$ equal to $x_p = A\cos(5t)$ and not $x_p = A\cos(5t) + B\sin(5t)$?

I thought that you had to replace a sin or cosine with the second guess, but why does the first one work?

-

Note that $x_p''=25A\cos(5t)+25B\sin(5t)$, so that $$x_p''+9x=34A\cos(5t)+34B\sin(5t).$$ This is the LHS of the ODE and the RHS has no $\sin(5t)$ term, thus $B=0$.
This is because there is no first derivative term in the ODE. Any $\sin(\cdot)$ terms in $x_p$ will not differentiate to give a $\cos(\cdot)$ term on the LHS of the ODE.
Another way of saying it: the differential equation is invariant under the symmetry $t \to -t$. Thus if $y(t)$ is a solution, so is $y(-t)$, and so (by linearity) is $y_e(t) = (y(t) + y(-t))/2$, which is an even function. In particular, if $y(t) = A \cos(5 t) + B \sin(5 t)$, then $y_e(t) = A \cos(5 t)$. –  Robert Israel Nov 5 '12 at 8:02
So you have: $$u'_1=\int\frac{-80}{3}\sin(3t)\cos(5t)dt\to u_1=\frac{5}{3}\cos(8t)-\frac{20}{3}\cos(2t)\\u'_2=\int\frac{80}{3}\cos(3t)\cos(5t)dt\to u_2=\frac{20}{3}\sin(8t)-\frac{5}{3}\sin(8t)$$ and so $$x_p=u_1x_1+u_2x_2=-5\cos(5t)$$