# Solving Second Order Linear Non-homogeneous Differential Equation

I am trying to solve the following: $$y''+4y=\tan(t).$$

I have used the method of variation of parameters. Currently I am at a point in the equation where I have this: $$u_1= \int \frac{\tan t \cos2t}{2}$$

I am stuck here

• I would edit, but I can't. Please use $\tan{t}$ instead of $tan t$, to make it render as text.
– user215048
Jul 15, 2015 at 20:58

$\cos 2t = 2\cos^2 t - 1$ hence

$$\int \frac{\tan t \cos2t}{2} dt = \int \sin t \cos t \ dt - \frac 12 \int \tan t \ dt \\ = \frac 12 \sin^2 t - \frac 12 \ln(\sec t) + C$$ $$= \frac 12 \left( \sin^2 t + \ln(\cos t) \right) + C$$

$$y''+4y=\tan t$$

The homogeneous solutions are $y_1(t)=\sin 2t$ and $\cos 2t$. In the method of variations, we form the particular solution $y_p(t)$ as

$$y_p(t)=C_1(t)y_1(t)+C_2(t)y_2(t)$$

where the functions $C_1$ and $C_2$ are given by

$$C_1=-\int \frac{1}{W(t)}y_2(t)\tan t\,dt$$

$$C_2=+\int \frac{1}{W(t)}y_1(t)\tan t\,dt$$

where $W(t)$ is the Wronskian for $y_1$ and $y_2$.

First, the Wronskian is trivially evaluated to be $W=-2$.

Second, we evaluate $C_1$ and $C_2$.

\begin{align} C_1&=\frac12 \int \cos 2t\,\tan t\,dt\\\\ &=\frac12 \int (\sin 2t-\tan t)\,dt\\\\ &=-\frac14 \cos 2t+\frac12 \log (\cos t) \end{align}

\begin{align} C_2&=-\frac12 \int \sin 2t\,\tan t\,dt\\\\ &=- \int \sin^2 t\,dt\\\\ &=-\frac12 t+\frac14 \sin 2t \end{align}

Third, we determine $y_p$ as

\begin{align} y_p(t)&=\left(-\frac14 \cos 2t+\frac12 \log (\cos t)\right)\sin t+\left(-\frac12 t+\frac14 \sin 2t\right)\cos t\\\\ &=-\frac 12 t\cos 2t+\frac12 \sin 2t \log (\cos t) \end{align}

Finally, the total solution to the ODE is

$$\bbox[5px,border:2px solid #C0A000]{y(t)=A\sin 2t+B\cos 2t-\frac 12 t\cos 2t+\frac12 \sin 2t \log (\cos t)}$$

$$\int \frac{1}{2}\cos(2t)\tan(t)dt=\frac{1}{2}\bigg(-\frac{1}{2}\cos(2t)+\ln(\cos(t))\bigg)$$

• The OP has already found the solutions to the homogeneous solutions, hence the $\cos 2t$. Jul 15, 2015 at 21:27
• Yes, I made an edit
– 3SAT
Jul 15, 2015 at 21:40