I broke up the non homogeneous part $\cos^2(x)$ into $\frac12 -\frac12[\cos(2x)]$

and I set up my trial solution as $$ \begin{split} Y_p &= A +B\sin(2x)+C\cos(2x)\\ Y'_p &= 2B\cos(2x)-2C\sin(2x)\\ Y''_p &= -4B\sin(2x)-4C\cos(2x) \end{split} $$ and after substituting these values in the ODE I don't get anywhere. I compare $8B\cos(2x)-4C\cos(2x)$ with $-0.5\cos(2x)$ and I get $C=(16B+1)/8$ and I think I've made a mistake here as I don't know what to do next and the other solutions didn't have anything like this. And can the annihilator method be more suited for this type of question or is the undetermined coeffs. method fine for this?

  • 2
    $\begingroup$ Please use Latex commands. $\endgroup$
    – Chris2018
    Jun 22 '18 at 11:42
  • $\begingroup$ If you are using the method of undetermined coefficients you must know the general form of the solution. You assumed your solution is of the form $Y_p$ - based on what? I assume $A,B,C$ are some scalars and not functions? $\endgroup$
    – AlvinL
    Jun 22 '18 at 11:46
  • 3
    $\begingroup$ I think that you should have $$\cos^2(x)=\frac{1+\cos(2x)}{2},$$ instead of $$\cos^2(x)=\frac{1-\cos(2x)}{2}.$$ The latter of these is the expansion of $\sin^2(x)$. $\endgroup$
    – Crosby
    Jun 22 '18 at 11:49
  • $\begingroup$ They are most definitely constants, not functions. $\endgroup$ Jun 22 '18 at 12:04

The equation has only derivatives so your constant A will disapear. $$y"+ 4y'= cos^2( x).$$ $$r^2+4r=0 \implies r=0,-4 \implies y_h=k_1+k_2e^{-4x}$$ $$y"+ 4y'= \frac {\cos(2x)}2+\frac 12$$ For the constant $( \frac 12)$ use $y_{1p}=Ax \implies A=\frac 18 \implies y_{1p}=\frac x8$

( for the trig function you are correct $y_{2p}=c_1\cos(2x)+c_2\sin(2x)$ $$(8c_2-4c_1)\cos(2x)+(-8c_1-4c_2)\sin(2x)=\frac {\cos(2x)}2$$ $$ \begin{cases} 8c_2-4c_1=\frac 12 \\ 8c_1+4c_2=0 \\ \end{cases} \implies (c_1,c_2)=(-1/40,1/20) $$ Finally, $$\boxed {y(x)=k_1+k_2e^{-4x}+\frac x8-\frac 1 {40} \cos(2x)+\frac 1 {20}\sin(2x)}$$


Your left side is in resonance with part of your right side. As the roots of the characteristic polynomial are $0$ and $-4$, you need to increase the degree of the constant part corresponding to the root $0$. Thus your undetermined coefficient function has to be $$ Y_p=Ax+(B\cos(2x)+C \sin(2x)). $$


Your ansatz is not so bad.



$$-4B-4C=0,\\-4C+4B=-\frac12$$ can be solved but will leave you with the extra term $\dfrac12$.

Now it suffices to consider $$y'=A,$$ so that $y''=0$, or $$y=Ax.$$

  • $\begingroup$ In the question it is 4y' so umm why didn't you multiply 2Bcos2x−2Csin2x by 4? $\endgroup$ Jun 22 '18 at 12:08
  • $\begingroup$ @tNotr: typo fixed. But this was innocuous, as the OP already knew that. The key point is the missing linear term. $\endgroup$
    – user65203
    Jun 22 '18 at 12:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.