[Math] Solution of $y”+4y=\cos^2t$

ordinary differential equations

I'm trying to find the solution, which is supposed to be

$y(t)=c_2\sin(2t)+c_1\cos(2t)+\frac{t\sin(2t)}{8}+\frac{\cos^2(t)}{4}$,

but I'm doing something wrong along the way and I can't figure out what I did. I was hoping someone would be able to find my mistake for me. I'll show what I've gotten:

First I got the complementary solution $y_c(t)=c_1\cos(2x)+c_2\cos(2x)$

I then used the particular solution $y_p=A+B\cos(2t)+C\sin(2t)$ – I'm guessing this is where my error occurs, but I don't see what's wrong with it.

I derived it two times and got $y_p''=-4B\cos2t-4C\sin(2t)$

I plugged it into the original equation (assuming $\cos^2t$ is $\frac{1}{2}+\frac{\cos(2x)}{2}$) and then tried to solve the problem, at which point I found myself running in circles:

$\sin2t(-4C-4C)+\cos2t(-4B+4B)+4A=\frac{1}{2}+\frac{\cos(2x)}{2}$.

Can anyone help me find my mistake(s)? Thanks a lot.

Best Answer

You figured out the issue with:

$$y_c(t) = c_1 \cos 2t + c_2 \sin 2t$$

For the particular solution, some care is needed given the homogeneous (complementary) solution. We expand the $\cos^2 2t$ term as:

$$\cos^2 2t = \dfrac{1}{2}\left(1 +\cos 2t\right)$$

Now, we notice that this has a common term with the homogeneous term, so we multiply the particular solution by $t$ to account for that. Thus, we choose a particular solution as:

$$y_p(t) = a + b~ t \cos 2t + c~ t \sin 2t$$

Now, substitute and solve for $a$, $b$ and $c$.

You should get:

$$a = \dfrac{1}{8}, b = 0, c = \dfrac{1}{8}$$

Your final solution will be:

$$y(t) = y_c(t) + y_p(t)$$