# Two point boundary value problem

## Homework Statement

Solve the given boundary value problem or else show that it has no solutions: y'' + 4y = cos x, y'(0) = 0, y'(pi) = 0.

N/A

## The Attempt at a Solution

So I made it all the way through the problem I think, but I am not getting the correct answer and was wondering if anyone else could spot the error in my work.

So first thing I did was find the characteristic equation: r^2 + 4 = 0.
I solved this for my eigen values and got r = + or - 2i.
That means my general solution is y = c1 cos 2x + c2 sin 2x.

So now I use variation of parimeters: $$\bar{y}$$ = v1 cos 2x + v2 sin 2x
Taking the derivative, I get that $$\bar{y}$$' = v1' cos 2x - 2v1 sin 2x + v2' sin 2x - 2v2 cos 2x.
We know that v1' cos 2x + v2' sin 2x= 0.
This simplies $$\bar{y}$$' = 2v2 cos 2x - 2v1 sin 2x
So if we take the second derivative, $$\bar{y}$$'' = 2v2' cos 2x - 4v2 sin 2x - 2v1' sin 2x- 4v1 cos 2x.

Now that we have both $$\bar{y}$$'' and $$\bar{y}$$, we can plug this into our original differential equation and get:
(2v2' cos 2x - 4v2 sin 2x - 2v1' sin 2x - 4v1 cos 2x) + 4(v1 cos 2x + v2 sin 2x) = cos x.

Now we have a system of two equations:
v1' cos 2x + v2' sin 2x = 0
-2v1' sin 2x + 2v2' cos 2x = cos x

If we multiply the first equation the by 2 sin 2x and the second equation by cos 2x and add them together, we get:
2v2' = cos x cos 2x.
Therefore, v2' = cos x cos 2x / 2

Plugging this value of v2' into the first equation, we get:
v1' cos 2x + cos x sin 2x / 2 = 0.
This gives us that v1' = -cos x sin 2x / 2 .

Now we integrate both v1' and v2' to solve for v1 and v2 and we get:
v2 = (sin x / 2) - (sin x)^3/3...I did the integral by using the trig identity cos 2x = 1 - (sin x)^2
v1 = (cos x)^3/3...I did the integral by using the trig identity sin 2x = 2 sin x cos x

Now, I plugged my v1 and v2 into $$\bar{y}$$ = v1 cos 2x + v2 sin 2x and got:
$$\bar{y}$$ = ((cos x)^3/3)(cos 2x) + ((sin x /2) - ((sin x)^3/3)))(sin 2x).

So now my general solution became y = c1 cos 2x + c2 sin 2x + ((cos x)^3/3)(cos 2x) + (sin x /2)(sin 2x) - ((sin x)^3/3))(sin 2x).

Since the two points I was given were for y', I took the derivative of the above expression and then plugged in my two points. Yet, when I put these points into the equation seperately, I should get two equations in terms of c1 and c2. However, I for both points, I got that 2c2 = 0 aka c2 = 0.

The final answer is supposed to be y = c1 cos 2x + 1/3 cos x.
I see how the y = c1 cos 2x comes into play and why there is no c2, however I don't get why I don't have the 1/3 cos x part...I don't think my ((cos x)^3/3)(cos 2x) + (sin x /2)(sin 2x) - ((sin x)^3/3))(sin 2x) simplies to that so I am guessing that I made a mistake somewhere.