# Solve differential equation using Laplace Transform

Given the following differential equation $$y''(t)+4y(t)=\frac{1}{4+\cos{2t}}$$ with $$y(0)=1$$, $$y'(0)=0$$, find $$y(t)$$.

Using the Laplace Transform, I've got that $$Y(s)=\frac{s}{s^2+4}+\frac{F(s)}{s^2+4}$$ where $$F$$ is the Laplace transform of $$\frac{1}{4+\cos{2t}}$$. One can immediately observe how the first term is the image of $$\cos{2t}$$. But what about the second one? If I use the inverse Laplace Transform of the product $$\cfrac{F(s)}{s^2+4}$$, I have to compute the convolution between $$\cos{2t}$$ and $$\cfrac{1}{4+\cos{2t}}$$, which is $$\int_0^t \frac{\sin(2t-2u)}{4+\cos(2u)}\,du$$

Now, I could use the fact that $$\sin(a-b)=\sin a\cos b-\sin b\cos a$$.

I was wondering, do I really have to compute this integral? I could also use the variation of parameters method, but I would run into the same integral.

• wolframalpha said the integral is horrifying – Saketh Malyala Mar 5 '20 at 21:26

The integral wouldn't be so bad. The identity gives

$$\sin(2t)\int_0^t \frac{\cos(2u)}{4+\cos(2u)}\:du + \cos(2t)\int_0^t \frac{-\sin(2u)}{4+\cos(2u)}\:du$$

The second integral is easy enough

$$\cos(2t)\int_0^t \frac{-\sin(2u)}{4+\cos(2u)}\:du = \frac{1}{2}\cos(2t)\log(4+\cos(2t))$$

The trick to the second integral is to split it up

$$\sin(2t)\int_0^t \frac{4+\cos(2u)-4}{4+\cos(2u)}\:du = t\sin(2t) - 4\sin(2t)\int_0^t \frac{1}{4+\cos(2u)}\:du$$

Then double angle identity on the last integral

$$\int_0^t \frac{1}{5\cos^2u + 3\sin^2u}\:du = \frac{1}{5}\int_0^t \frac{\sec^2u}{1+\frac{3}{5}\tan^2 u}\:du = \frac{1}{\sqrt{15}}\tan^{-1}\left(\sqrt{\frac{3}{5}}\tan t\right)$$

But since the antiderivative needs to be continuous, we need to add a staircase term to raise up the discontinuous points of the function to appropriately connect them. Then adding up all of the results gets us

$$y(t) = \cos(2t) + t\sin(2t) - \frac{4}{\sqrt{15}}\sin(2t)\tan^{-1}\left(\sqrt{\frac{3}{5}}\tan t\right)$$ $$-\frac{4\pi}{\sqrt{15}}\sin(2t)\left\lfloor \frac{1}{\pi}t+\frac{1}{2}\right\rfloor+\frac{1}{2}\cos(2t)\log(4+\cos(2t))$$

This behavior makes perfect sense since the driving force (inhomogeneous term) is in resonance with the homogeneous solution, leading to the growing amplitude term.

$$y''(t)+4y(t)=\frac{1}{4+\cos{2t}}$$ Multiply by $$\sin(2t)$$ $$(y' \sin(2t))'-2(y\cos(2t)'=\dfrac{\sin(2t)}{4+\cos{2t}}$$ $$y' \sin(2t)-2y\cos(2t)=-\frac 1 2\ln |{4+\cos{2t}}|+c_1$$ $$\left ( \frac y {\sin(2t)}\right)'=-\frac 1 2\dfrac {\ln |{4+\cos{2t}}|}{\sin^2(2t)}+\dfrac {c_1}{\sin^2(2t)}$$ $$\frac y {\sin(2t)}=-\frac 1 2 \int \dfrac {\ln |{4+\cos{2t}}|}{\sin^2(2t)}dt-\frac 12 {c_1}{\cot(2t)}+c_2$$ $$y(t)={c_1}{\cos(2t)}+c_2{\sin(2t)}-\frac 1 2{\sin(2t)} I$$ Where : $$I= \int \dfrac {\ln |{4+\cos{2t}}|}{\sin^2(2t)}dt$$ Integrating by part gives: $$I= -\frac 12 {\cot(2t)}{\ln |{4+\cos{2t}}|}-\int \dfrac {\cos(2t)}{{4+\cos{2t}}}dt$$ $$I= -\frac 12 {\cot(2t)}{\ln |{4+\cos{2t}}|}-t+4 \underbrace {\int \dfrac {dt}{{4+\cos{2t}}}}_{ {I_2} }$$ This last integral is not difficult to evaluate. By Weierstrass substituttion $$(u=\tan t)$$: $$I_2=\int \dfrac {du}{5+3u^2}=\frac 1 {\sqrt {15}} \arctan \left ( \frac {\sqrt 3}{\sqrt 5} \tan t \right )$$ Finally: $$\boxed {y(t)={c_1}{\cos(2t)}+c_2{\sin(2t)}+\frac 1 2{t\sin(2t)}-\frac 2 {\sqrt {15}}\sin(2t) \arctan \left ( \sqrt {\frac 3 5} \tan t \right )+\frac 14 {\cos(2t)}{\ln |{4+\cos{2t}}|}}$$

• Unfortunately that answer is not correct. Graph your answer and you will see it is not continuous. – Ninad Munshi Mar 6 '20 at 4:25
• My answer is correct, you can see the correction I added. – Ninad Munshi Mar 6 '20 at 5:48