Variation of parameters (issue with the constants)

I have to solve this ODE using the variation of parameters method:

$$4y''+y=\frac{2}{\cos \left( \frac{x}{2} \right)}$$

Solving the homogeneous problem yields

$$y_h(x)= c_1 \cos \left( \frac{x}{2} \right)+ c_2 \sin \left( \frac{x}{2} \right)$$

Now, to solve the variation of parameters problem, you have to solve

$$\begin{bmatrix} \cos \left( \frac{x}{2} \right) & \sin \left( \frac{x}{2} \right) \\ -\frac{1}{2} \sin \left( \frac{x}{2} \right) & \frac{1}{2} \cos \left( \frac{x}{2} \right) \end{bmatrix} \begin{bmatrix} c_1' \\ c_2' \end{bmatrix}= \begin{bmatrix} 0 \\ 2\sec \left( \frac{x}{2} \right) \end{bmatrix}$$

Solving the first equation $c_1'\cos \left( \frac{x}{2} \right)+ c_2'\sin \left( \frac{x}{2} \right)=0$. This gives $c_1'=-c_2'\tan \left( \frac{x}{2} \right)$

Solving the second equation gives $\frac{c_2'}{2} \cos \left( \frac{x}{2} \right)- \frac{c_1'}{2} \sin \left( \frac{x}{2} \right)= \frac{2}{\cos \left( \frac{x}{2} \right)}$.

Substituting gives $\frac{c_2'}{2} \cos \left( \frac{x}{2} \right)+ \frac{c_2'}{2} \frac{\sin^2 \left( \frac{x}{2} \right)} {\cos \left( \frac{x}{2} \right)}= \frac{2}{\cos \left( \frac{x}{2} \right)}$.

Solving for $c_2'$ gives $\frac{c_2'}{2}=2$.

Finally, $c_2'=4$ and $c_2=4x$. This means that $c_1'=-4\tan \left( \frac{x}{2} \right)$ and $c_1=8\ln \left( \cos \left( \frac{x}{2} \right) \right)$.

However, according to Wolfram, $c_1=2\ln \left( \cos\left( \frac{x}{2} \right)\right)$ and $c_2=x$.

Indeed, I tried solving with my values for $c_1$ and $c_2$ and it doesn't work. What did I do wrong?

1 Answer

Try with the equation writen in this form. The method needs the coefficient to be 1 for the highest derivative (standard form).

$$y''+\frac{y}{4}=\frac{1}{2\cos \left( \frac{x}{2} \right)}$$

With it, we get $c_2'/2=1/2$ and $c_1'=-\tan \left( \frac{x}{2} \right)$. With them, the expected solution follows.