# Second order ODE with RHS = product of two functions

1. Nov 24, 2012

### CAF123

1. The problem statement, all variables and given/known data
Find the general solution of the ODE $$y'' + 16y = 64x \cos x.$$ If $y(0)=1, y'(0) = 0$, what is the particular solution?

3. The attempt at a solution

I am confident I can tackle this question, I really just want to check that my particular integral form is correct. I originally said $y_p(x) = x(C_1 \cos 4x + C_2 \sin 4x)(ax + b)$, where $C_1, C_2, a,b$ are constants. However, when I do the first derivative and then the second derivative and then sub this into the ODE, I get two eqns with 4 unknowns. (The 4 unknowns being the constants). So then I tried combining the form so that there was only two constants. So I have either $x[(C_1 \cos 4x + C_2 \sin 4x)(C_1 x + C_2)]$ or $x[(C_1 x +C_2)\cos 4x + (C_1x +C_2)\sin 4x]$ Should I go with the second option?
Thanks

2. Nov 24, 2012

### haruspex

Surely for the PI you will need functions like x cos(x), x sin(x).

3. Nov 24, 2012

### CAF123

Sorry, I mistyped the problem. It should be RHS = $64x \cos 4x$

4. Nov 24, 2012

### Zondrina

Remember the general solution is made up of your homogeneous solution plus a particular solution, $y= y_c(x) + y_p(x)$.

So start by solving $L[y] = 0$ for your homogeneous solution $y_c(x)$. I believe your roots will be ±4i.

Now you want to solve the non-homogeneous equation $L[y] = 64xcosx$ for the particular solution $y_p(x)$. You have two ways to go about this, the method or undetermined coefficients or the method of variation of parameters.

In this case since your polynomial is of relatively low degree, I would choose undetermined coefficients. So your guess at a particular solution should have the form :

$y_p(x) = (Ax+b)(Csin4x + Dcos4x)$

I leave the rest to you now.

Last edited: Nov 24, 2012
5. Nov 24, 2012

### CAF123

I corrected my initial post. The RHS should read 64x cos4x. I took the particular integral to be x(a cos4x + bsin4x)(cx +d). In the end, I get two eqns , with the 4 unknowns. So what I then tried to do was to give a form incorporating only two constants,(see my first post), but when I tried that I got my apparant constants being functions of x.

I think the way with 4 constants is correct, but I don't see how you can get solutions for the constants. Many thanks.

6. Nov 24, 2012

### Zondrina

I edited my last post to reflect your changes.

Now, what is yp' and yp''? After you find these, plug them back into L[y] = 64xcos4x and solve for your coefficients. What do you get?

7. Nov 24, 2012

### CAF123

I think the particular integral you wrote should be multiplied by x since ±4i are roots of the auxiliary eqn. When I sub in for yp' and yp'' into the ODE, I keep getting each constant as a function of something else. I am going to try it again now. Thanks

EDIT:The eqns I get in the end are $$-8A(2Cx+D) + 2CB = 0,\,\,\,2CA + 8B(2Cx +D) = 64x,$$ which is 4 unknowns in 2 eqns, so I can't get a solution for each of the constants.

Last edited: Nov 24, 2012
8. Nov 24, 2012

### haruspex

No, there are four equations there. In order to be true for all x, the different powers of x must vanish independently. Trouble is, you then find there are no solutions.

9. Nov 24, 2012

### haruspex

I think the combinations tried have been too restrictive.

10. Nov 25, 2012

### CAF123

Ok, so what I have tried is the following:
1)$y_p = (Cx^2 +Dx)\cos4x + (Cx^2+Dx)\sin4x$. When I differentiate twice, sub it in to ODE, I get my (apparant) constants being functions of x.
2) $y_p = (Cx^2 +Dx)A\cos4x + (Cx^2+Dx)B\sin4x$. This, to me, seems the most plausible form of solution, and after differentiating twice and subbing in, I tried both of the following, still yielding things that I could not solve
i)collected terms in cos4x and sin4x, The two eqns I got from that I showed in my last post(@haruspex: How is that 4 eqns?)
ii) Alternatively, I collected terms in xcos4x, cos4x, x2cos4x, sin4x, xsin4x and x2sin4x. I now get 6 eqns and only 4 unknowns, yet I can't solve the following set of non-linear eqns: (In fact, after some manipulation I feel they look inconsistent)
$-16AC = 0$.
$-16AD + 16CB = 64$,
$-16BC=0$,
$2CA+8BD=64x$,
$-8DA+2CB=0$,
$-16CA-16DB=0$.
I don't know what to try next. Everything I have tried seems reasonable - I just get to a stage where I can go no further. Any advice?

11. Nov 25, 2012

### HallsofIvy

Staff Emeritus
No, you cannot assume cos 4x and sin 4x have the same coefficients. Use $(Cx^2+ Dx)cos(4x)+ (Ex^2+ Fx) sin(4x)$ and solve for all four of C, D, E, and F.

12. Nov 25, 2012

### CAF123

Yes, as I said the other method seemed more plausible. I eventually get to the eqns $DA=1, BD=8x, CB=4, CA=0$. I think these are inconsistent?
EDIT: Is $y_p = (Cx^2 + Dx)A\cos4x + (Cx^2+Dx)B\sin4x$ ok?

13. Nov 25, 2012

### haruspex

Still too restrictive. You are assuming the x2 and x coefficients are in the same ratio for the cos and the sin. Try the C, D, E, F form Halls suggested.

14. Nov 25, 2012

### CAF123

Thanks a lot. I now get solutions and eqns that were a lot easier to solve. Was the reason I couldn't solve my previous set of eqns due to the fact I had too much restriction on the particular integral?
EDIT: Wait.. Isn't mine and Halls proposed integral effectively the same? If you let, in my form, CA = E, DA = F, CB = G and DB = H, then this is essentially what Halls proposed?

Last edited: Nov 25, 2012
15. Nov 25, 2012

### haruspex

No. With those relationships, E/F = C/D = G/H. In general, there's no reason why E/F = G/H.
Because you had four unknowns you assumed you had four degrees of freedom, but that is not necessarily the case. E.g. in your version A=B=2, C=D=1 is the same solution as A=B=1, C=D=2.