# How to solve the differential equation $\cos^2(x) \frac{d^2 y}{d x^2} -2 y = -\cos(x)$.

Solve the following differential equation: $$\cos^2(x) \frac{d^2 y}{d x^2} -2 y = -\cos(x).$$

We were asked not to solve this by the method of variation of parameters, so except that method we have tried to reduce the equation as

But after this point, since the RHS of the equation is too complex to do anything, we could not proceed.

Addition to that, we have used the method of differential operator method, but it led to a complex integral which we or any online applet couldn't take the integral, so we are basically stuck.

So, how can we solve this differential equation ?

Note: Any hind also is appreciated.

Edit:

We would like to solve this ODE by using some methods, and not just guessing the particular solution and moving to the corresponding homogeneous equation, since the very purpose of this question is to learn how to solve such a ODE.

Hint. One particular solution of this second order, linear differential equation $$\frac{d^2 y}{d x^2} -\frac{2 y}{\cos^2(x)} = -\frac{1}{\cos(x)}$$ is $y(x)=1/\cos(x)$. Now it remains to solve the homogeneous problem $$\frac{d^2 y}{d x^2} -\frac{2 y}{\cos^2(x)} =0.$$

• Do you have any method for find that particular solution ? I mean, after all, the very reason why I have asked this question is not to find its answer, but to learn it. – onurcanbektas Nov 14 '17 at 10:41
• In this case I made a guess. Otherwise you need the method of variation of parameters. For a general procedure see here mathworld.wolfram.com/… – Robert Z Nov 14 '17 at 10:56
• Since the instructor is specifically restricted us not to use the method of variation of parameters, I'm assuming that there are other method to solve this diff. equation, so do you have any other suggestion than that method ? – onurcanbektas Nov 14 '17 at 10:59
• I think that the restriction should be interpreted as follows: sometimes it is better to make a guess than using a long general method. I have no further method to suggest. – Robert Z Nov 14 '17 at 11:19
• Ok, thanks anyway. – onurcanbektas Nov 14 '17 at 11:29

Continuing from Robert Z's answer, every homongeneous solution takes the form $$y_\text{hom}(x)=a\,\tan(x)+b\,\Big(1+x\,\tan(x)\Big)\,$$ where $a$ and $b$ are constants. This can be done by observing that $y=\tan(x)$ is a homogenous solution. With the assumption that the general homogenous solution takes the form $y=z\,\tan(x)$ for some function $z=z(x)$, we obtain $$\frac{\text{d}^2z}{\text{d}x^2}+\frac{2}{\sin(x)\,\cos(x)}\,\frac{\text{d}z}{\text{d}x}=0\,,$$ which is easy to solve.

Knowing two linearly independent homogeneous solutions $y_1(x):=\tan(x)$ and $y_2(x):=1+x\,\tan(x)$, we find that the Wronskian is $$W(x)=y_1(x)\,y'_2(x)-y_2(x)\,y_1'(x)=-1\,.$$ A particular solution $y=y_p$ to the nonhomogeneous differential equation $$y''(x)-2\,\text{sec}^2(x)\,y(x)=-\sec(x)=:s(x)$$ is then \begin{align} y_p(x)&=-y_1(x)\,\int\,\frac{y_2(x)\,s(x)}{W(x)}\,\text{d}x+y_2(x)\,\int\,\frac{y_1(x)\,s(x)}{W(x)}\,\text{d}x \\&=-\tan(x)\,\int\,\big(1+x\,\tan(x)\big)\,\sec(x)\,\text{d}x+\big(1+x\,\tan(x)\big)\,\int\,\tan(x)\,\sec(x)\,\text{d}x \\ &=-\tan(x)\,\big(x\,\sec(x)\big)+\big(1+x\,\tan(x)\big)\,\sec(x)=\sec(x)\,. \end{align} This provides a non-guessing method.

This provides yet another method to solve the differential equation $y''(x)-2\,\text{sec}^2(x)\,y(x)=s(x)$, where $s(x)=-\text{sec}(x)$. Define the operators $D$ and $X$ by $(D\,h)(x):=h'(x)$ and $(X\,h)(x):=x\,h(x)$. For any function $\phi$, we also define the operator $\phi(X)$ to be $\big(\phi(X)\,h\big)(x):=\phi(x)\,h(x)$. I also discovered that $$\big(D+\text{sec}(X)\,\text{csc}(X)\big)\,\big(D-\text{sec}(X)\,\text{csc}(X)\big)=D^2-2\,\sec^2(X)\,.$$ Therefore, you can obtain all solutions $y$ in the following manner.

Let $z:=\big(D-\text{sec}(X)\,\text{csc}(X)\big)\,y$. Then, $\big(D+\text{sec}(X)\,\text{csc}(X)\big)\,z=s(x)$ implies that $$z(x)=\frac{1}{\mu(x)}\,\int\,\mu(x)\,s(x)\,\text{d}x\,,\text{ where }\mu(x):=\exp\left(\int\,\text{sec}(x)\,\text{csc}(x)\,\text{d}x\right)=\tan(x)\,.$$ Thus, with an integral constant $A$, we have $$z(x)=-\cot(x)\,\int\,\text{sec}(x)\,\tan(x)\,\text{d}x=-A\,\cot(x)-\text{csc}(x)\,.$$ Finally, from $\big(D-\text{sec}(X)\,\text{csc}(X)\big)\,y=z$, we get $$y(x)=\mu(x)\,\int\,\frac{z(x)}{\mu(x)}\,\text{d}x\,,$$ as the integrating factor is now $\dfrac{1}{\mu}$. Ergo, choosing $B$ as the integral constant yields $$y(x)=-\tan(x)\,\int\,\big(A\,\cot(x)+\text{csc}(x)\big)\,\cot(x)\,\text{d}x=A\big(1+x\,\tan(x)\big)+B\,\tan(x)+\sec(x)\,.$$