1. Dec 30, 2012

### DunWorry

1. The problem statement, all variables and given/known data
basically solve $\frac{d^{2}y}{dx^{2}}$ + 4$\frac{dy}{dx}$ + 4y = cos2x

Boundary conditions are y=0, dy/dx =1 at x=0

2. Relevant equations

3. The attempt at a solution
I am having trouble getting the coefficients to the solution. I got the complementary function as y$_{cf}$ = (A$_{1}$x+A$_{2}$)e$^{-2x}$

and the paticular integral is y$_{PI}$ = Bcos2x
So first I find coefficient B I $\frac{dy}{dx}$ = -2Bsin2x
and $\frac{d^{2}y}{dx^{2}}$ = -4Bcos2x

Now I sub back into equation and compare coefficients I get -4Bcos2x -8Bsin2x + 4Bcos2x = cos2x
This simplifies to -8Bsin2x = cos2x. I am not sure how I am supposed to compare coefficients here, in the answers it looks like the particular integral is $\frac{1}{8}$ sin2x. If I rearrange -8Bsin2x = cos2x I get B = - $\frac{1}{8}$cotx

So not only have I got the trig function wrong but I got the sign wrong too, have I done something wrong elsewhere?

Thanks

2. Dec 30, 2012

### lurflurf

You need
yp=Bsin(2x)
in general you would need
yp=Acos(2x)+Bsin(2x)
but in this problem A=0

3. Dec 30, 2012

### HallsofIvy

No, it isn't. In general, for a sine or cosine you will need both sine and cosine. As lurflurf says, for this particular problem it turns out you only need sin(2x) but it is difficult to see that before actually doing the calculations. Instead try both.

The fact that you wound up with both sine and cosine should have made you go back and try "Acos(2x)+ Bsin(2x)" even if you hadn't seen it before.

The "sign" is not the problem. The real problem is that cot(x) is not a constant! Didn't you notice that?

4. Dec 30, 2012

### DunWorry

Right yes thanks I have solved it now and got the right answer, can I just confirm a few things?

So say I got the paticular integral to be $\frac{1}{8}$Sin 2x.

So my general solution to this is y = (A$_{1}$x + A$_{2}$)e$^{-2x}$ + $\frac{1}{8}$Sin 2x

I apply the boundary conditions to be general solution right? and not to the original equation?

Boundary conditions are y=0, dy/dx =1 at x=0

So I get A$_{2}$ = 0

Then I differentiate my general solution to apply the second boundary condition, that dy/dx =1

and I got the required coefficients, is this the best/correct method?

Thanks

5. Dec 30, 2012

### HallsofIvy

Yes, that is correct. The boundary conditions are to be satisfied by the solution to the entire equation, not just the solution to the associated homogeneous equatioin (which is, I think, what you meant by "the original equation").

Yes, $y(0)= (A_1(0)+ A_2)e^0+ sin(0)= A_2= 0$

Yes. With $A_2= 0$, your general solution is $y(x)= A_1xe^{-2x}+ (1/8)sin(2x)$ and its derivative is $y'(x)= A_1e^{-2x}- 2A_1xe^{-2x}+ (1/4)cos(2x)$. Evaluate that at x= 0, set it equal to 1 and solve for $A_1$.