# Solving two second order ordinary differential equations

**URL:** <https://community.wolfram.com/t/solving-two-second-order-ordinary-differential-equations/3960>\
**Category:** Questions\
**Tags:** physics\
**Created:** [November 12, 2014, 1:19am UTC](https://community.wolfram.com/t/solving-two-second-order-ordinary-differential-equations/3960 "2014-11-12T01:19:16Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![justinmyles](https://avatars.discourse-cdn.com/v4/letter/j/a88e57/32.png) [@justinmyles](https://community.wolfram.com/u/justinmyles)\
**Post date:** [November 12, 2014, 1:19am UTC](https://community.wolfram.com/t/solving-two-second-order-ordinary-differential-equations/3960/1 "2014-11-12T01:19:16Z")

</div>

I have two differential equations I’d like to solve and plot. Following documentation, I tried to implement DSolve like this:

```
 DSolve[y''[t]==w^2*y[t]-2w*x'[t],y[t],t] 

```

and am not getting a useful result. My question is if DSolve is the correct function to use. Should I use DSolve, or, perhaps, NDSeries?’

P.S. the other equation is

```
DSolve[x''[t]==w^2*x[t]+2w*y'[t],x[t],t]

```

---

<div class="post-metadata">

**Author:** ![dreiss](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/dreiss/32/29094_2.png) [@dreiss](https://community.wolfram.com/u/dreiss)\
**Post date:** [November 12, 2014, 1:41am UTC](https://community.wolfram.com/t/solving-two-second-order-ordinary-differential-equations/3960/2 "2014-11-12T01:41:30Z")

</div>

You need to have both equations in a single **DSolve** function–otherwise there is no way for **DSolve** to know that there are two simultaneous equations. Also note that your `wx'[t]` should be `w x'[t]`: i.e., a space between the `w` and the `x`. Similarly for the `wy'[t]`.

With that said, here is the form for **DSolve** that you want to use for these two simultaneous differential equations in `x[t]` and `y[t]`:

```
DSolve[
{y''[t] == w^2 y[t] - 2 w x'[t], 
  x''[t] == w^2 x[t] + 2 w y'[t]}, 
{y[t], x[t]}, t]

```

This gives a result in terms of unknown integration constants `C[1], C[2], C[3],` and `C[4]`. If you have initial conditions you can include them in the first argument list of the **DSolve** and the integration constants will be determined in the soluttion.

---

<div class="post-metadata">

**Author:** ![justinmyles](https://avatars.discourse-cdn.com/v4/letter/j/a88e57/32.png) [@justinmyles](https://community.wolfram.com/u/justinmyles)\
**Post date:** [November 12, 2014, 1:58am UTC](https://community.wolfram.com/t/solving-two-second-order-ordinary-differential-equations/3960/3 "2014-11-12T01:58:23Z")

</div>

Thank you, this is very helpful. I do have initial conditions, so I have switched to NDSolve. My code is in the screenshot. What is the problem with the way I have input the initial conditions?

 ![screenshot.png](https://global.discourse-cdn.com/wolfram/original/3X/4/3/43b40a7caefe40f4e1ad633194887c06cb0ed6a6.png)

---

<div class="post-metadata">

**Author:** ![justinmyles](https://avatars.discourse-cdn.com/v4/letter/j/a88e57/32.png) [@justinmyles](https://community.wolfram.com/u/justinmyles)\
**Post date:** [November 12, 2014, 2:12am UTC](https://community.wolfram.com/t/solving-two-second-order-ordinary-differential-equations/3960/4 "2014-11-12T02:12:30Z")

</div>

As an update, when I input the initial conditions like ‘x[0] == x0’ I get ‘True’, even having cleared x.

---

<div class="post-metadata">

**Author:** ![kayh](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/kayh/32/31501_2.png) [@kayh](https://community.wolfram.com/u/kayh)\
**Post date:** [November 12, 2014, 2:43am UTC](https://community.wolfram.com/t/solving-two-second-order-ordinary-differential-equations/3960/5 "2014-11-12T02:43:26Z")

</div>

1. yes, you need to use the == (double equal sign) instead of assignment
2. make sure you use the Clear at the beginning of your program so you don’t “memorize” your mistakes
3. you call NDSolve twice but you should ca;ll it only once and solve for x and y simultaneously

 ![Capture.JPG](https://global.discourse-cdn.com/wolfram/original/2X/3/3f9a5ba6cdf5d724f51160d2399f44150aa35ce3.jpeg)
