# Differential Equation : method of Constant variation

I have to solve $y'' + 4y = 5\cos(2x)$. I solved first the homogenous equation and I find $y_H=C_1\cos(2x)+C_2\sin(2x)$. Then i can do two methods :

1) The undetermined coefficients: I find my particular solution $y_p =\frac{5}{4}x\sin(2x)$, which is the correct solution.

2) The constant variation: I suppose $y_p=C_1(x)\cos(2x) + C_2(x)\sin(2x)$, I compute $y_p'$ and $y_p''$ then I apply the method and now I find that $C_1(x)=-\frac{5}{16}\cos(4x)$ and $C_2(x)=\frac{1}{2}x + \frac{1}{8}\sin(4x)$. Then my $y_p$ is different.

Can someone show me how to apply the constant variation step by step to this differential, because I really tried to see why I get a wrong result and I don't get it.

EDIT : My work for method 2 : $y_p = C_1(x)cos(2x) + C_2(x)sin(2x)$

$y_p'=C_1'cos(2x)+C_2'sin(2x)-2C_1sin(2x)+2C_2cos(2x)$

I deliberately choose that $C_1'\cos(2x)+C_2'sin(2x)=0$

$y_p''=-2C_1'sin(2x)+2C_2'cos(2x)-4C_1cos(2x)-4C_2sin(2x)$

Then i get $C_1'\cos(2x)+C_2'sin(2x)=0$ and $-2C_1'sin(2x)+2C_2'cos(2x)=5cos(2x)$ which is a simple system.

$C_1'=-5/2sin(2x)cos(2x)$

$C_2'=5/2cos(2x)^2$

I integrate and find $C_1=5/16cos(4x)$ and $C_2=5/4x + 5/16 sin(4x)$. Then i replace it in my particular solution which gives me $y_p=5/16cos(4x)cos(2x)+(5/4x + 5/16 sin(4x))sin(2x)$.

Hope it's more clear.

Thank you.

• $y=\frac54\cos(2x)$ is NOT a solution of the full equation. – Did Jun 9 '13 at 14:59
• @Did Yes it's the particular solution i have to add it to yh to have the complete solution but in the second case yp is false – The Answer Jun 9 '13 at 15:00
• It is not a particular solution. – Did Jun 9 '13 at 15:01
• Please include your working in reaching that solution. As an aside though, I wouldn't recommend using method 2 for this problem, method 1 is much nicer. – john Jun 9 '13 at 15:02
• Again, it relies on the compound angle formula, in this case, $\cos(A-B)=\cos(A)\cos(B)+\sin(A)\sin(B)$ – john Jun 9 '13 at 16:18

The problem was explained in the comments, but I'll post an answer for the sake of having one. The quickest solution would be by Method 1, undetermined coefficients. Since we have resonance (source term is also a solution of homogeneous equation), our particular solution will be of the form $y=x(A\cos 2x+B\sin 2x)$. In order to write less, it helps to realize that when we plug this $y$ into equation, the terms where $x$ does not get differentiated will go away. With that thought, and the formula $(uv)''=u''v+2u'v'+uv''$ in mind, $$y''+4y = 2(A\cos 2x+B\sin 2x)' = -4A\sin 2x+4B\cos 2x$$ hence $A=0$ and $B=5/4$. Answer: $y=\frac54 x\sin 2x$.
As for variation of parameters, it's best to not think of it as a way to get a particular solution. The result of computations with this method (with $c_1$ and $c_2$ included in appropriate places after integration) will be the general solution.