# Homework Help: Ordinary Differential Equation Problem

1. Sep 1, 2015

### Mark Brewer

1. The problem statement, all variables and given/known data

dy/dx = 4e-xcosx

3. The attempt at a solution

I've divided dx to both sides, and now have dy = 4e-xcosx dx
I've then started to use intergration by parts to the right side with u = 4e-x and dv = cosx dx
Leaving y = 4e-xsinx - ∫ -4e-xsinx dx
Once again I used intergration by parts with u = -4e-x and dv = sinx dx
Leaving y = 4e-xsinx - (4e-xcosx - ∫ -4e-xcosx dx)
I know that I don't need to integrate again, so my final answer is 4e-x(sinx - cosx) + c

The correct answer is 2e-x(sinx - cosx) + c

Where am I missing division by 2?

Cheers,

Mark

2. Sep 1, 2015

### andrewkirk

Look at the equation you got: $y = 4e^{-x}\sin x - \big(4e^{-x}\cos x - \int( -4e^{-x}\cos x dx)\big)$. That looks correct to me.

That is not the same as $y = 4e^{-x}\sin x - (4e^{-x}\cos x)$, which is your final answer (ignoring the constant). You've dropped the last term without justification.

But hang on, doesn't that last term remind you of something? Can you get rid of it by replacing it by that thing and moving it somewhere else in the equation?

Last edited: Sep 1, 2015
3. Sep 1, 2015

### jimmy neutron

I think you have made a mistake in some of your +ve/-ve signs and think that your approach would eventually give y = y.

The best way to go about this is to write cosx =(exp(ix) + exp(-ix))/2 (Euler's formula) and then you have to solve a differential equation of the form

dy/dx = exp(mx) where m = (1+/- i).

This is relatively straight forward to solve.

4. Sep 1, 2015

### HallsofIvy

This not so much a "differential equations" problem (though it is disguised as one), it is just an "integration by parts exercise".

Yes, you can integrate $4\int e^{-x}cos(x)dx$ by parts. Let $u= e^{-x}$, so that $du= -e^{-x}dx$ and let $dv= cos(x)dx$ so that $v= sin(x)$. Then $4\int e^{-x}cos(x)dx= 4\left(e^{-x}sin(x)- \int e^{-x}sin(x)dx\right)$. Do that resulting integral by parts. Let $u= e^{-x}$ so that $du= -e^{-x}du$ and let $dv= sin(x)$ so that $dv= -cos(x)dx$.

Now, we have $4\int e^{-x}cos(x)dx= 4e^{-x}sin(x)- 4e^{-x}cos(x)- 4\int e^{-x}cos(x)dx$.

Now,as andrewkirk suggested (or hinted, rather), we have $4\int e^{-x}cos(x)dx$ on both sides of the equation. Solve your equation for that and you are done.

Last edited by a moderator: Sep 1, 2015
5. Sep 1, 2015

### Staff: Mentor

Summarizing a generous contribution by HallsofIvy ....

An explanation hinges on how you managed to go from this line:

to this line:

Can you explain your intermediate step here?

6. Sep 1, 2015

### Ray Vickson

In cases like this one it is almost always easier to do the problem by first eliminating the pesky multiplicative constant. So, first do the integral $\int e^{-x} \cos(x) \, dx$, then multiply by 4 at the very end. Basically, if $f(x) = 4 g(x)$, then $\int f(x) \, dx = 4 G(x)$, where $G(x) = \int g(x) \, dx$. That also helps you to keep straight where the various factors come and go, so that you know when a '2' appears in the final answer, it is '4/2' rather than $\sqrt{4}$, for example.

7. Sep 1, 2015

### Mark Brewer

I noticed the problem was going to continue as long as I would like to integrate by parts. If I recall from calc doing to steps of integration by parts was sufficient to ignore the remaining integral. I understand I'm an undergraduate so my mistakes are likely to exist. I do take criticism well, so please feel free to tell me I'm wrong, and I the practice I learned is incorrect.

8. Sep 1, 2015

### Mark Brewer

Hi Andrew, I'm some what following your explanation, but I need a little more details. I recognize that the last term 4e-xcosx reminds me of dy/dx. A little help is appreciated.

9. Sep 1, 2015

### andrewkirk

Right, in fact they are equal, and that means that $y=\int 4e^{-x}\cos x dx$. So, substituting $-y$ for that last term gives you an equation with $y$ on both sides, and no more integrals to be done. How will you turn that into an equation of the form $y=$<something not involving $y$>?

10. Sep 1, 2015

### Mark Brewer

Thank you Andrew. Substituting -y then gave me the chance to add y to both sides and then divide by 2. Thank you once again.

Mark

11. Sep 2, 2015

### Staff: Mentor

Such a "rule" doesn't ring a bell with me. But I think you now see how the problem at hand can be concluded, without reliance on anything but algebra.