# Am I expanding e^ix incorrectly?

1. Feb 5, 2016

### sa1988

I'm working on a pretty simple ODE but am getting really confused about one little bit.

It's of this form:

y'' + y = t

So, in solving the complementary solution I use the characteristic method to find:

λ2 + 1 = 0

Hence λ = ± i
Therefore:
yc = Aei t + Be-i t

This expands to:
yc = Acos(t) + i Asin(t) + Bcos(t) - i Bsin(t)

BUT

If I run the same thing through DSolve in Mathematica, I get:

yc = Asin(t) + Bcos(t)

There's a clear similarity between that and my own answer, but also a very clear difference!

Where have I gone wrong? Where are the imaginary terms in the Mathematica solution? Plus, even if I ignore or cancel the imaginary terms in my solution I end up with (A+B)cost(t) which is still wrong, it seems.

What's gone wrong?

Thanks!

Last edited: Feb 5, 2016
2. Feb 5, 2016

### DuckAmuck

y = Ae^(it) + Be^(-it)
is equivalent to
y = Asin(t) + Bcos(t)

It's just that the A's and B's are not the same.

3. Feb 5, 2016

### sa1988

Oh man, that's so obvious I should probably go and hide in a cave somewhere and think about my idiocy, ha.

So I'm right in assuming the imaginary term has simply been tucked away into A or B?

I'm getting it like this:

yc = (iA-iB)sin(t) + (A+B)cos(t)

= Csin(t) + Dcos(t)

I didn't know it was permissible to tuck the imaginary parts away like that though?

4. Feb 5, 2016

### DuckAmuck

You can tuck away imaginary parts. A and B are "complex numbers" now.

5. Feb 5, 2016

### sa1988

Great stuff, cheers.

I guess the thing that threw me is that the Mathematica solution didn't tell me " A, B ∈ ℂ "

I thought the imaginary parts were eliminated somehow.

6. Feb 5, 2016

### DuckAmuck

They often are elimated by initial conditions, if you're doing a physics problem. But yes, you have to explicitly eliminate them. They are still there in the general case.

7. Feb 5, 2016

### sa1988

It actually is part of a physics problem, so I figured there'd be a point where I ignore the imaginary part because it's a 'real-world' fluid dynamics problem of a particle in a flow. The main thing confusing me however was just that 'imaginary' part of the differential equation. All good now! Thanks

8. Feb 5, 2016

### DuckAmuck

Be careful though, imaginaries do exist in the real world. (Usually in electricity problems.)

9. Feb 5, 2016

### Staff: Mentor

Then you should use different pairs of letters...

10. Feb 5, 2016

### sa1988

Oh I know, heh, but it usually describes those sort of 'extra' numerical factors rather than something Real such as position, which is what I'm doing working on with this fluid dynamics stuff. My bad, I was too vague with what I said.