# Is solving differential equations supposed to be this hard?

• Turion

## Homework Statement

$$y''-2y'+5y={ e }^{ x }cos2x$$

## The Attempt at a Solution

I still haven't completed the question but I just want to know if I'm on the right track. It's becoming ridiculously tiring to just complete 1 question.

Is it supposed to be this long?

#### Attachments

• IMG_20130911_091524.jpg
35.9 KB · Views: 411

There are many different methods to solving differential equations, you may or may not have learned very many of them at this point.

What method are you using right now?

There are many different methods to solving differential equations, you may or may not have learned very many of them at this point.

What method are you using right now?

I am currently using the method of undetermined coefficients.

First I solve the homogeneous version of the differential equation to get the complementary solution. Then I guess the form of the particular solution and try to find the unknowns.

## Homework Statement

$$y''-2y'+5y={ e }^{ x }cos2x$$

## The Attempt at a Solution

I still haven't completed the question but I just want to know if I'm on the right track. It's becoming ridiculously tiring to just complete 1 question.

Is it supposed to be this long?

Your homogeneous solution ##y_c## looks wrong. Where did the roots of the characteristic equation go?

Also, your guess for the particular solution ##y_p## is also incorrect slightly. Why do you have an ##x## in there? I don't see any polynomial terms in ##e^{ x }cos2x##?

If this is a textbook problem, I can't imagine it being that horrible. Are you specific told to do undetermined coefficients? If not I'd try other methods and see if they work any better.

Your homogeneous solution ##y_c## looks wrong. Where did the roots of the characteristic equation go?

I used the following to get the complementary solution:
$${ m }_{ 1 }=α+iβ\quad \quad { m }_{ 2 }=α-iβ\\ y={ e }^{ αx }({ c }_{ 1 }cosβx+{ c }_{ 2 }sinβx)$$

Also, your guess for the particular solution ##y_p## is also incorrect slightly. Why do you have an ##x## in there? I don't see any polynomial terms in ##e^{ x }cos2x##?

##e^{ x }cos2x## is already in the complementary solution so I have to multiply the particular solution by x:
$${ y }_{ c }={ c }_{ 1 }{ e }^{ x }cos2x+{ c }_{ 2 }{ e }^{ x }sin2x$$

If this is a textbook problem, I can't imagine it being that horrible. Are you specific told to do undetermined coefficients? If not I'd try other methods and see if they work any better.

Yes unfortunately and it is a textbook problem.

This is torture...

I used the following to get the complementary solution:
$${ m }_{ 1 }=α+iβ\quad \quad { m }_{ 2 }=α-iβ\\ y={ e }^{ αx }({ c }_{ 1 }cosβx+{ c }_{ 2 }sinβx)$$

##e^{ x }cos2x## is already in the complementary solution so I have to multiply the particular solution by x:
$${ y }_{ c }={ c }_{ 1 }{ e }^{ x }cos2x+{ c }_{ 2 }{ e }^{ x }sin2x$$

Ah yes, I see what you did for ##y_c## now. My Euler formula is a bit rusty lol.

Your ##y_p## also looks fine now that the ##y_c## is confirmed.

You seem to be making solving the coefficients from your guess for the particular solution unnecessarily difficult. It's a bit messy, but why on Earth are you expanding all those terms instead of collecting those with the same coefficients together?

$$y(x)=(Bx\cos(2x)+Ax\sin(2x))e^x,\quad y'(x)=((B+2Ax+Bx)\cos(2x)+(A-2Bx+Ax)\sin(2x))e^x,\quad$$
$$y''(x)=((4A(x+1)+B(2-3x))\cos(2x)-(A(3x-2)+4B(x+1))\sin(2x))e^x$$

You substitute and divide by ex to get
$$(4A(x+1)+B(2-3x)-2(B+2Ax+Bx)+5Bx)\cos(2x)=\cos(2x)$$
and
$$(-A(3x-2)-4B(x+1)-2(A-2Bx+Ax)+5Ax)\sin(2x)=0$$

(sine and cosine are independent) This has to hold for any x, so the coefficients must be the same – The sine term has to vanish, and the coefficient of the cosine term has to be one, so

$$(4A(x+1)+B(2-3x)-2(B+2Ax+Bx)+5Bx)=1$$
and
$$(-A(3x-2)-4B(x+1)-2(A-2Bx+Ax)+5Ax)=0$$

You get B easily from the second one (again, it has to hold for any x, just simplify) and then A from the first one. Can you take it from here?

Hint: The equation has real coefficients. Thus you can instead look at the right-hand side in the form
$$\mathrm{Re}[\exp x \exp(2 \mathrm{i} x)]=\mathrm{Re} \exp[x(1+2 \mathrm{i})].$$
Then you can first solve for the equation without the "Re" on the righthand side and then take the real part of the solution (you should, of course think about, why that's ok here too!).

As you'll see, the task to find a particular solution for the inhomogeneous equation becomes a bit simpler in this way.

@DeIdeal: I don't understand how you went from y(x) to y'(x). Are you just omitting some steps or did you do all that in 1 step?

@DeIdeal: I don't understand how you went from y(x) to y'(x). Are you just omitting some steps or did you do all that in 1 step?

Well, yeah, obviously you could write out some more terms, but it's just straight-forward differentation:

By the product rule

$$\frac{\mathrm{d}}{\mathrm{dx}}(B\cos(2x)+A\sin(2x))xe^x=(\frac{\mathrm{d}}{\mathrm{dx}}(B\cos(2x)+A\sin(2x)))xe^x+(B\cos(2x)+A\sin(2x))\frac{ \mathrm {d}}{\mathrm{dx}}xe^x.$$

The first term is done with the derivatives of cosine and sine and the chain rule for "(2x)", product rule is again used for the second one, as well as the derivative of x and ex:

$$=(-2B\sin(2x)+2A\cos(2x))xe^x+(B\cos(2x)+A\sin(2x))(x\frac{ \mathrm {d}}{\mathrm{dx}}e^x+e^x\frac{ \mathrm {d}}{\mathrm{dx}}x)$$
$$=(-2B\sin(2x)+2A\cos(2x))xe^x+(B\cos(2x)+A\sin(2x))(x+1)e^x$$

Then it's just rearranging

$$=(-2B\sin(2x)+A(x+1)\sin(2x)+2A\cos(2x)+B(x+1)\cos(2x))e^x$$
$$=((B+2A+Bx)\cos(2x)+(A-2B+Ax))\sin(2x))e^x$$

Were you able to follow this better? I don't know, to me it just seems more confusing to write out all the terms explicitly like this, it feels like it's easier to see "what's going on" from the more concise expression.

----

And you can quite easily figure out the derivative from initial expression in your head. This is how I did it for, I don't know, a "symmetric" function like this: the ex will remain in the final expression. You have a linear combination of the "same" ("2x") sine and cosine, so the final answer will have them as well, and then there's only the x to worry about, which will differentiate to one or stay the same, so you have a 1st-order polynomial coefficient multiplying the sine and cosine, something of the form (Psin(2x)+Qcos(2x))ex. The "xex"-part differentiates to give the coefficient (x+1) times Bcos(2x) or Asin(2x), while the cosines and sines differentiate to each other, so you'll get 2Bsin(2x) and 2Bcos(2x) and you'll just have to check the signs.

It looks really complicated when I type it out like this, but it's really quite quick to do, a lot quicker than doing it step by step.

(Of course, I checked that everything was correct with Wolfram before posting :P)

Sweet. I solved it. Factoring the terms like you said reduced the 6-line juggernaut shown in the image I posted to only 2 lines.

Thanks.

Great, I'm glad I could help. :]