# Solving a 2nd order differential equation

1. Oct 10, 2011

### Sparky_

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

This is a portion of a slightly larger problem involving:
$$K*\frac{d^2x}{dt^2} = -K2*\frac{dz}{dt}$$

$$K*\frac{dz^2}{dt^2} = K2*\frac{dx}{dt}$$

I would like to check my work and I don't believe I am moving toward the solution, knowing it has sin and cos in the final solution:

2. Relevant equations

3. The attempt at a solution

I'm just wanting some help on the math portion of the following -

Picking up midstream in a problem - I have started with a substitution
$$u= \frac {dx}{dt}$$

$$K1 \frac {du^{2}}{dt^2} + {-K2}u = 0$$

$$u = e^{mt} u’ = me^{mt} u’’ = m^2e^{mt}$$

$$K2*m^{2}e^{mt} + -K1* e^{mt} = 0$$

Factor out $$e^{mt}$$

$$m^2 = \frac {K1}{K2}$$

$$m =sqrt{ \frac {K1}{K2}}$$

I am 1 integration away from getting X.

I know the solution is of the form X = Acos(at) + Bsin(at) - I was expecting complex roots.

If the above is correct then my problem is further upstream
1. The problem statement, all variables and given/known data

2. Relevant equations

3. The attempt at a solution

2. Oct 10, 2011

### Sparky_

HOLD UP -

found a sign error - don't see how to delete this thread

3. Oct 10, 2011

### Hootenanny

Staff Emeritus
I'm afraid that isn't correct. Notice that the two ODEs form a couple system (i.e. both equations involve derivatives of both x and z).

However, you have the right idea with regards to substitution. You could try substituting one of the equations into the other.

4. Oct 10, 2011

### Sparky_

Thanks!!

I'm going in that direction now. - it's looking better.

5. Oct 10, 2011

### Sparky_

ok - I have been playing with the equation:
$$K1 \frac {du^{2}}{dt^2} + {K2}u = 0$$

Starting here -

$$u = e^{mt} u’ = me^{mt} u’’ = m^2e^{mt}$$
$$K1*u’’+ K2*u = 0$$

$$K2*m^{2}e^{mt} + K1* e^{mt} = 0$$

Factor out $$e^{mt}$$

$$m^2 = -\frac {K1}{K2}$$

$$m =\sqrt{ -\frac {K1}{K2}}$$

$$m1 = +i \sqrt{ \frac {K1}{K2}} m2 = -i \sqrt{ \frac {K1}{K2}}$$

$$u = e^{{i}{const}}+ e^{-{i}{const}}$$
$$u = cos(const* t) + isin(const* t) + cos(const* t) – isin(const* t)$$

The sin terms cancel and I have 2 cos terms.

I know the solution is of the form X = Acos(const* t) + Bsin(const* t) .

Can I get some guidance?

Thanks
Sparky_

6. Oct 11, 2011

### Hootenanny

Staff Emeritus
How have you got from here:
to here:
The two are not consistent.

7. Oct 11, 2011

### Sparky_

Hey Hootenanny,

Thanks for the help and advice,

In the top equation - I took the derivative of both sides.

I then had a second order derivative of z with respect to t.

(again in the 2nd equation) I then solved for the same derivative d^2z / dt^2 and substituted into the top equation.

I'm not playing careful with the constants - just grouping them as K's - ignore the mistakes with the constants.

Then I said u = dx/dt, du/dt = d^2x / dt^2 and so on - that gets me a 2nd order.

I am thinking once I have x, I can then get z.

(sorry for no TeX - in this post.)

Am I off somewhere?

Then next question - even if my setup is wrong - I think my solution to (k1)d^2u/dt^2 + K2u = 0 has a mistake somewhere.

Thanks
Sparky_

8. Oct 11, 2011

### Hootenanny

Staff Emeritus
That is a very bad idea. Even if you collect constants together, you should define them and rename them as something other than your original constants. If you don't, then you end up thinking that things cancel when they don't really because they are multiplied by different constants.

Assuming you can keep track of your constants, you mistake is on the penultimate line. Your solution is missing two multiplicative constants:

$$u(t) = c_1 \exp(i\lambda t) + c_2\exp(-i\lambda t)$$

Last edited: Oct 11, 2011
9. Oct 11, 2011

### Sparky_

Thanks!!

Well - I have learned a lesson.

As you can tell I was more worried about the steps and the involved math steps.

I assmumed I could just sprinkle the constants back in at the end - I would say it's a rookie mistake - but I am many years past a rookie - more a coming out of retirement mistake.

(this is related to something I'm just playing with - just started doodling and wondering if I still could ... and now I wnat to complete it.)

Thanks again
-Sparky_

10. Oct 16, 2011

### Sparky_

Ok – playing with this problem a little more

Backing up – here is the “real problem” – it’s a physics problem I know the solution and the solution is shown in about one line – I’m for fun wanting to work it out

I’m uncertain on how to resolve the constants – I do have the liberty to set the initial conditions

The problem:
$$m\frac {d^2x}{dt^2} = -qB \frac{dz}{dt}$$
$$m\frac {d^2z}{dt^2} = qB \frac{dx}{dt}$$

Take time derivative of both sides (of eq. 1):
$$\frac {d}{dt} m\frac {d^2x}{dt^2} =\frac {d}{dt} -qB \frac{dz}{dt}$$

$$m\frac {d^3x}{dt^3} = -qB \frac{d^2z}{dt^2}$$

From equation 2:
$$\frac {d^2z}{dt^2} = \frac {qB}{m} \frac{dx}{dt}$$

Some algebra and apply Euler’s equation:
$$m\frac {d^3x}{dt^3} = \frac {(-qB)(qB)}{m} \frac{dx}{dt}$$
$$\frac {d^3x}{dt^3} = (\frac {(qB)}{m})^2 \frac{dx}{dt}$$
$$u= \frac {dx}{dt}$$
$$pick: u = e^{at}$$
$$u’ = ae^{at}$$
$$u’’ = a^2e^{at}$$
$$a^2e^{at} + (\frac {(qB)}{m})^2 e^{at} = 0$$
$$a^2 + (\frac {(qB)}{m})^2 = 0$$
$$a = + - (\frac {(qB)}{m})$$
$$u = e^{i\frac{qB}{m}t} + e^{-i\frac{qB}{m}t}$$
$$u = C1cos(\frac{qB}{m}) + iC2sin(\frac{qB}{m}) + C3cos(\frac{qB}{m}) – iC4sin(\frac{qB}{m})$$
Use a substitution to reduce the order of the equation:
$$u= \frac {dx}{dt}$$
$$dx = u dt$$
$$x = \frac{mC1}{qB}sin(\frac{qBt}{m}) - \frac{imC2}{qB}cos(\frac{qBt}{m}) + \frac{mC3}{qB}sin(\frac{qBt}{m}) + \frac{imC4}{qB}cos(\frac{qBt}{m})$$
$$x = (\frac{mC1}{qB} + \frac{mC3}{qB}))sin(\frac{qB}{m}t) – (\frac{imC2}{qB} + \frac{imC4}{qB})cos(\frac{qB}{m}t)$$

Now – I’m not sure on the steps below:
Is it correct to do the following:

$$\int{ \frac{d^2x}{dt^2}} = \int{ \frac{-qB}{m}\frac{dz}{dt}}$$
$$\frac{dx}{dt} = \frac{-qBz}{m}$$

$$z = -\frac{m}{qB}\frac{dx}{dt}$$

$$z = K1 \frac{qB}{m}cos() + K2\frac{qB}{m}sin()$$

I have the freedom (I think to say x = z = 0 at t=0.

There is some complication with the cos term at t=0 and gave x=z=0 – correct?

Am I on the right path?

Thanks
-Sparky_

Last edited: Oct 16, 2011