# Steps for solving ODE

1. May 10, 2010

### linear_shift

Hi, could someone show me the steps to solve the equation

d^2y/dx^2 = -ky

for the solution

A*exp(i*sqrt(k)*x) + B*exp(-i*sqrt(k)*x)

?

I am trying to solve the time independent Schrodinger equation for a free particle, and the above question is of the same form. Wikipedia says it is the above solution, and I can kind of see where it's going in doing some of the math for myself, but am stuck at several places. Don't ask me what I did, it will not help me for you to correct me at steps, I just need to see it done so that I can "assimilate" the knowledge for me to use in other problems (I am rather inexperienced with these types of (O)DEs, and I'm learning subjects in tandem to learn them, quantum mechanics I would like to learn, and DEs I would like to strengthen my knowledge of; it's just how I learn best, don't ask me why).

Thanks,

linear

2. May 10, 2010

### Cyosis

No offense, but that is a pretty bad attitude. You won't learn mathematics properly by just copying people.

Anyhow to get you started. These equations are usually solved by inserting a try out solution $y=e^{\lambda x}$.

3. May 10, 2010

### pbandjay

Take this with a grain of salt, as I am doing it completely from memory. If you have y'' = -ky, then y = erx is a solution since y'' = r2erx, and substituting this into the original ODE you have

r2erx = -kerx ==> r2 = -k ==> r = +/- sqrt(-k)

then r = +/- i sqrt(k) therefore let

$$y_1 = e^{i\sqrt{k}x}, y_2 = e^{-i\sqrt{k}x}$$

But we can take a linear combination of these:

$$\hat{y_1} = \frac{y_1 + y_2}{2}, \hat{y_2} = \frac{y_1 - y_2}{2i}$$

Then by superposition

$$y(x) = A\hat{y_1} + B\hat{y_2} = A\cos(\sqrt{k}x) + B\sin(\sqrt{k}x)$$

where A,B are constants.

This is assuming that k > 0 since k <= 0 has no nontrivial solutions (again, from memory).

Last edited: May 10, 2010
4. May 10, 2010

### linear_shift

Cyosis,

I never said I was going to copy anyone, I only mean that I'm going to use the ideas in the steps being taken to solve other problems. _That_ is how I learn, not by copying.

5. May 10, 2010

### Cyosis

Both k=0 and k<0 have nontrivial solutions.

6. May 10, 2010

### Meteorologist

pbandjay,

I guess there is no exponentials in your final answer becasue the solution should be in the form:

y(t)=e^(alpha*t)*(Acos(beta*t) + Bsin(beta*t))

Where i guess in this case:
alpha=0 (Therefore making e^(alpha*t) equal to 1)
beta=sqrt(k)

Just trying to understand your logic becasue this is the first time i have seen such an equation solved using that particular method. And yes, i realize your equation was in terms of x not t, but this really dosent matter...

Thanks for the post.

7. May 10, 2010

### Cyosis

Why would you put that exponential in front in this case?

8. May 10, 2010

### pbandjay

An equation of the form

$$y(x) = c_1 e^{i\sqrt{k}x} + c_2 e^{-i\sqrt{k}x}$$

would also solve the ODE, but that technique made use of the definitions

$$\cos x = \frac{e^{ix} + e^{-ix}}{2}$$

$$\sin x = \frac{e^{ix} - e^{-ix}}{2i}$$

to get rid of the imaginary units.

9. May 10, 2010

### Meteorologist

Cyosis,

i believe the reason for multiplying e^(alpha*t) by (Acos(beta*t) + Bsin(beta*t)) is becasue when solving an ODE with imaginary roots you are left dealing with an exponential of the form e^(alpha + i*beta). This can be expanded into a form involving sines and cosines. If you would like a can post a completely solved example problem using this technique.

I hope this clarifyed.

10. May 10, 2010

### Cyosis

You're only left with an exponential of that form if the differential equation also involves a first derivative, which is absent here. I see no point in adding it to the solution. The best way to deal with differential equations like this is to just use a try out function $y=e^{\lambda x}$.

11. May 10, 2010

### linear_shift

pbandjay,

Thanks, that's exactly what I needed. :) I feel dumb now, it was so simple (I'm still a bit fresh on differential equations). XP I know what to do for all the QM wave equations (as well as any other wave equation) now. \o/

linear

12. May 10, 2010

### Meteorologist

Cyosis,

Absense of a first derivative really has nothing to do with whether or not exponentials will be in the answer. as far as i know an equation such as that will always have a constant times an exponential in the solution. In this case there is no exponential because it is raised to the zero power and is therefore only 1.

13. May 10, 2010

### Cyosis

I am talking about the superfluous exponential you put in front of the general solution. The constant alpha will always be 0 and therefore the exponent will always be 1 with the type of differential equation we're discussing. If we add a first derivative term this will change, which is quite easy to see if you look at the characteristic equation.

Last edited: May 10, 2010
14. May 10, 2010

### Meteorologist

Yes, any changes to the characteristic equation could yeild large differences in the solution. The exponential term i had out in front that you are referring too was simply a factored out term. And yes again, if the coefficient of the first derivative term equals zero then alpha would then be zero bue to quadratic formula. we seem to be on the same page here... WHat exactly are we differing on?

15. May 11, 2010

### Cyosis

The issue here is that it is a useless addition. You can multiply any solution by 1 and that solution will again be a solution to the differential equation. I suggest you plug your 'general' solution into the differential equation and check if both sides are the same. I think you will see my point once you're finished.