This entire site has been solving differential equations almost from its first page, without stopping to name the general subject. Newton's laws gave us , which becomes a differential equation whenever the force depends on position, velocity, or time. The equation of simple harmonic motion,
is a differential equation. The pendulum equation is one too. So is the Schrödinger equation.
Yet in each first encounter, we took a suspiciously fortunate route: guess a function, often a cosine, differentiate it, substitute it into the equation, and discover that it works. That proves the guessed function is a solution, but it leaves an uncomfortable question. Where did the guess come from? If the answer were not a cosine, how would we know what to try?
That is the problem ordinary differential equations are meant to organize. An ordinary differential equation, or ODE, relates an unknown function of one independent variable to one or more of its derivatives. The aim is not to eliminate insight or cleverness. It is to replace a collection of lucky guesses with methods that tell us what forms the solutions must take.
Classifying an ODE
Before solving a differential equation, it helps to know what kind of object is in front of us. Three distinctions determine which methods are available.
Order
The order of a differential equation is the order of the highest derivative appearing in it. For example,
is first-order, while
is second-order because is the highest derivative present.
The order also tells us how much initial information is generally needed to select one solution from the family of possible solutions. A first-order equation usually requires one initial condition, such as . A second-order equation usually requires two, such as the initial position and initial velocity .
Linear and nonlinear
An ODE is linear if the unknown function and its derivatives appear only to the first power, are not multiplied by one another, and have coefficients that depend at most on the independent variable. A general second-order linear ODE has the form
The equation
is linear. By contrast,
for an exact pendulum is nonlinear because is not a linear function of the unknown angle . The small-angle approximation turns it into a linear equation, which is precisely why the approximated pendulum becomes so much easier to solve.
Homogeneous and inhomogeneous
A linear ODE is homogeneous if every term contains the unknown function or one of its derivatives. Thus the simple-harmonic-motion equation
is second-order, linear, and homogeneous.
A linear ODE is inhomogeneous if a leftover term does not contain the unknown function. A driven oscillator obeys
where the prescribed external force makes the equation inhomogeneous. Physically, this distinction separates the system's free motion from its response to an external drive.
First-order linear equations
Consider the general first-order linear ODE
The difficulty is that the left side is almost, but not quite, the derivative of a product. We would like to multiply the equation by some function so that
becomes one exact derivative. The product rule says
The two expressions agree if
Dividing by and integrating,
An overall nonzero constant multiplying makes no difference, so we choose the integrating factor
Multiplying the original ODE by this factor gives
Because , the left side is exactly
Now integrate both sides:
and therefore
The integrating factor was engineered to make the product rule do the work for us.
Example: solving
Start with
Here
The integrating factor is
Multiply every term in the equation by :
The right side simplifies to , while the left side is an exact derivative:
Integrating,
Finally, divide by :
We can verify the result directly. Differentiating gives
Then
as required. The term is a particular response to the inhomogeneous term, while is the general solution of the corresponding homogeneous equation .
Second-order equations with constant coefficients
Now consider a second-order linear homogeneous ODE with constant coefficients:
where , , and are constants and .
Here the exponential function has a remarkable property: differentiating it does not produce a new kind of function. If
then
and
Substitute these into the differential equation:
Factor out :
Since is never zero, the remaining factor must vanish:
This is the characteristic equation. A problem involving derivatives has become an algebraic problem involving a quadratic polynomial.
Its roots are
The discriminant
separates the solutions into three qualitatively different cases.
Two distinct real roots
If , the characteristic equation has two distinct real roots and . The corresponding exponentials are linearly independent, so the general solution is
Positive roots produce exponential growth; negative roots produce exponential decay. When both roots are negative, a displaced system can return to equilibrium without crossing it repeatedly.
One repeated real root
If , both roots merge into
The function is one solution, but simply writing it twice does not produce two independent solutions. A second-order equation needs two independent solutions, and the second one is
Thus the general solution is
One way to understand the factor of is to imagine two distinct exponential solutions as their roots approach one another. Their difference, divided by the shrinking separation of the roots, approaches a derivative with respect to :
When the two roots merge, this limiting procedure supplies the missing independent solution.
Complex conjugate roots
If , the roots come as a complex conjugate pair
The exponential solutions are
Euler's formula,
lets us combine these into two real solutions:
Therefore the general real solution is
The imaginary part of the root produces oscillation. The real part controls the envelope: gives a decaying oscillation, gives an undamped oscillation, and gives a growing oscillation.
Why the cosine appears in simple harmonic motion
For simple harmonic motion, the equation is
Comparing it with
we identify
The characteristic equation is
Therefore
and the roots are
Defining
we have
These purely imaginary roots produce the real general solution
Equivalently, the constants can be repackaged as an amplitude and phase:
This is the rigorous reason the cosine guess used on the simple-harmonic-motion page worked. It was not luck. For this particular differential equation, the characteristic roots are necessarily imaginary, and Euler's formula necessarily turns their exponentials into sines and cosines.
Worked example
A damped harmonic oscillator obeys . Solve the equation for , , and , then interpret the resulting motion. (click to reveal the solution)
Substituting the parameters: begin with
Using , , and gives
Setting up the characteristic equation: try
Then
and
Substitution gives
Factor out the nonzero exponential:
Therefore the characteristic equation is
Finding the roots: factor the quadratic:
Thus
so the two distinct roots are
The same result follows from the quadratic formula:
which gives and .
Writing the general solution: because the roots are distinct and real,
The constants and would be fixed by two initial conditions, such as and .
Physical interpretation: both exponential terms decay as time increases. Neither term contains a sine or cosine, so no oscillation occurs. The damping is strong enough to prevent the mass from swinging repeatedly through equilibrium; instead, the displacement relaxes back toward
This is an overdamped oscillator. Its two decay rates describe a rapidly disappearing transient and a more slowly decaying tail . After enough time, the slower term dominates unless its coefficient happens to be zero.
Where this leads
The move that solved the constant-coefficient equation was to choose functions that reproduce themselves under differentiation. The guess turned a differential equation into an algebraic equation because derivatives act on exponentials only by multiplying them by powers of .
That idea extends far beyond the equations on this page. Fourier analysis, the next topic in this track, decomposes complicated functions into sums of the same exponential and oscillatory building blocks found here. Later, partial differential equations such as the wave equation and the Schrödinger equation in three dimensions can be attacked by separation of variables, which breaks one equation involving several variables into ordinary differential equations of exactly this kind.