# Constants in a differential equation.

Apologies if this is a rather simple question. I am starting out teaching myself differential equations and have some confusion. I believe my question applies for any order of differential equation and either homogeneous or inhomogeneous, but please let me know if I am mistaken and the answer is actually different depending on what differential equation I look at.

So my question is, when we solve a differential equation and we put in the general constants, are these constants meant to be real or generally complex? Are there different cases? Is this fixed entirely by the boundary conditions?

Thank you!

EDIT: TO clarify, my question stemmed from looking at the equation foor simple harmonic motion, which is $\ddot x +\omega ^2x=0$ To solve this, I have seen three approaches:

1. Assume the sin and cosine results

Cosine and Sin are both solutions of the above equation, so the full solution is a linear combination of the two $x=Acos(\omega t)+Bsin(\omega t)$ which is equaivalent to $x=Acost(\omega t +\phi)$, giving the common form.

2. Solve more generally for a complex x.

I have seen the equation also be solved by solving the homogeneous differential equation for $x=Ae^{i\omega t}+Be^{-i\omega t}$. Then the constants are used to give the real solution, so the boundary condition (that x is real) yields that $A=B*$. So here we have complex constants, and we get the result $x=(A+B)cos(\omega t)+i(A-B)sin(\omega t)=2Re(A)cos(\omega t) -2Im(A)sin(\omega t)$ which, as before with constants multiplying sin and cos terms, reduces to $x=Dcos(\omega t +\phi)$

3. The final approach I have seen is by solving the differential equation for $z$ and just setting $x=Re(z)$.

Solving the equation for z gives $x=Ae^{i\omega t}+Be^{-i\omega t}$ where I believe (if I got the method correctly), the constants are here REAL. As this still reduces to $z=(A+B)cos(\omega t)+i(A-B)sin(\omega t)$, but this time for real A and B and therefore $z$ is a complex number, you can see that this is equivalent to $z=De^{i\phi}e^{i\omega t}$ where the complex amplitude component $e^{i\phi}$ rotates the complex number $e^{i\omega t}$ in the complex plane such that the ratio of the constants of the cosine and sin terms of $z$ is correct and as given in the $z=(A+B)cos(\omega t)+i(A-B)sin(\omega t)$ form of $z$. This reduces to $z=e^{i(\omega t+\phi)}$ yielding $x=Re(z)=Dcos(\omega t+\phi)$ as before.

I am unsure as to which is the 'correct' way to apporach this (I am sure I will get the response that there is no 'correct way!). But what is the physical significance of each of these approaches?

Aplogies- this edit turned out much longer and more detailed than expected so I will formulate it as another question instead.

• Your initial conditions should uniquely define your constants. You need n conditions for an nth order equation. Those constants can be complex, and in many cases complex constants can be useful. However, if you are working with real numbers, you won't want a complex solution. – Kaynex Jan 15 '17 at 1:16
• Complex cases reduce to real solutions by Euler's formula. – Simply Beautiful Art Jan 15 '17 at 1:36

## 1 Answer

Generally speaking, the constants are real. We are typically looking for real solutions. This is true regardless of whether or not you are dealing with ODE's (Ordinary Differential Equations) or with PDE's (Partial Differential Equations).

In addition, regardless of the order of the differential equation, or whether it's homogeneous or inhomogeneous, we are looking for real solutions! There are some cases where you study complex solutions, but this is not usually material that should be studied when you are first learning differential equations, work with real numbers only!

• Thank you for your reply! I am still slightly confused as your answer seems to be in discrepancy with the comments to my post? I will add an edit to my question which will perhaps clarify the level I am looking at. – 21joanna12 Jan 15 '17 at 11:27