Chapter 8
Ordinary Differential Equations
8.1Introduction and General Form
Video Lecture 22, Part 1: Why the Middle Buildings Fell (0:00)
Video Lecture 22, Part 2: What a Differential Equation Is (3:32)
An ordinary differential equation (ODE) is an equation that relates a function to its derivatives with respect to a single independent variable :
Order of an ODE: The order of a differential equation is the highest derivative that appears in the equation.
(8.3)Degree of an ODE: The degree of a differential equation is the exponent of the highest-order derivative, provided the equation is polynomial in derivatives.
(8.4)Solution of an ODE: A function that satisfies the differential equation for all in a given interval.
(8.5)
The equation
has order 2, because its highest derivative is , and degree 3, because appears cubed. The degree is not always defined: has order 2 but no degree, because it is not a polynomial in .
The solution of is found by undoing the derivative: , so . The constant is not a detail. The equation fixes only the slope of the curve at every point, and every curve has that slope everywhere (Figure 8.1): one equation has a whole family of solutions. A first-order equation leaves one free constant, and one more fact, such as the value of at one point, picks one curve of the family.

8.2Classification of ODEs
Video Lecture 22, Part 3: Linear or Nonlinear (7:17)
Ordinary differential equations (ODEs) can be classified according to several characteristics. The most fundamental distinction is between linear and nonlinear equations.
Linear vs. Nonlinear ODEs
An ODE is called linear if the dependent variable and all its derivatives appear only to the first power and are not multiplied or composed with each other. The general -order linear ODE can be written as
where and are known functions of the independent variable .
Collect the left side into one operator, which takes in a function and gives out a new function,
so that the equation reads . The equation is linear when is a linear operator in the sense of Chapter 3,
for all constants and functions . This is linear: each derivative is a linear operator (Chapter 3), and multiplying by a fixed function keeps the property. The rule “first power only, no products, no nonlinear functions of ” below is the quick test for it.
If any term involves products or nonlinear functions of or its derivatives (such as , , or ), the equation is said to be nonlinear.
For the second, , the product term of a combination gives , not : is not a linear operator. Concretely, and both solve , but their sum leaves . For the first, and solve , and so does their sum.
Only and its derivatives decide whether an equation is linear. Functions of may multiply them freely: is linear, while is not.
Linear ODEs are generally easier to solve because they obey the principle of superposition, if and are solutions of a homogeneous linear equation , then any linear combination is also a solution, since . (For the sum of two solutions gives ; there the rule is below.) Nonlinear ODEs, on the other hand, can exhibit far richer behavior, such as limited analytic solvability, sensitivity to initial conditions, or even chaotic motion. However, certain first-order nonlinear equations, such as separable or Bernoulli equations, can still be solved analytically.
Classification of Linear ODEs
Once an equation is identified as linear, we can further classify it based on its right-hand side and coefficients.
Homogeneous Linear ODE: The right-hand side equals zero,
(8.10)In this case, every term involves or its derivatives, and the trivial solution always satisfies the equation. The general solution typically involves arbitrary constants determined by initial or boundary conditions.
Nonhomogeneous Linear ODE: The right-hand side is a nonzero function ,
(8.11)The general solution is the sum of two parts:
(8.12)where is the general solution of the corresponding homogeneous equation and is a particular solution to the full nonhomogeneous equation. The reason is linearity: write the left side of the equation as ; then . Conversely, any two solutions of the full equation differ by a solution of the homogeneous one, so , with all its free constants, catches every solution.
Linear ODEs with Constant Coefficients: When the coefficients are constants rather than functions of ,
(8.13)the equation becomes especially important in physics and engineering. Such forms describe systems like simple harmonic oscillators, RC and RL circuits, and exponential decay processes.
8.3First-Order ODEs
A first-order ODE involves only the first derivative of the unknown function:
This general form can represent both linear and nonlinear cases, depending on how depends on . Such equations appear widely in physics—for example, in modeling exponential decay, population growth, or motion with velocity-dependent forces.
8.3.1Separable Equations
Video Lecture 22, Part 4: Separable Equations (13:27)
A first-order ODE is called separable if it can be expressed as
where the function on the right-hand side is the product of a function of and a function of . Although separable equations are often nonlinear, they are still analytically solvable because the variables can be separated.
Rearranging terms gives
and integrating both sides yields
Solution.
Step 1. Recognize the type of equation. This is a first-order separable (and also linear) differential equation.
Step 2. Separate the variables.
Step 3. Integrate both sides.
Step 4. Simplify the result. Exponentiate both sides:
Let (a new arbitrary constant). Then
Step 5. Verification. Differentiate :
confirming that the solution satisfies the ODE.
Solution.
Step 1. Separate the variables. Divide both sides by :
Step 2. Integrate both sides.
Step 3. Simplify the constant. Let (for ) to combine logarithms conveniently:
Step 4. Remove the logarithms.
Because can absorb the sign, we write simply
Step 5. Interpretation. The general solution
represents a family of straight lines in the -plane, one line for each value of the constant . Selecting a particular value of determines a single specific curve from this family. Every line of the family passes through the point , because whatever is. They may all cross there because at the equation reads : it allows only that point and sets no slope. Everywhere else exactly one line passes through each point.
A solution lost in Step 1. Dividing by assumed , and is never zero. The flat line () also solves the equation, since both sides are zero: . So may be any constant, zero included. Whenever we divide by to separate, the constant solutions with must be checked separately.
Step 6. A condition picks one line. Suppose, in addition, that at . Then
the unique solution through . Check: and .

A common mistake. From it does not follow that . Exponentiating both whole sides gives : the constant multiplies .
Find the particular solutions satisfying (a) and (b) , and discuss any solutions not obtained by separation.
Solution.
Step 1. Separation of variables and integration. For , the equation can be written in separable form:
Integrating both sides gives
so the general solution (valid where ) is
Step 2. Monotonicity and physical interpretation. Since , the slope of the curve is always nonnegative. Hence, only the increasing portions of the sine curve correspond to valid solution segments. That is, we must restrict to intervals where
The figure below shows the slope field and the increasing sine segments that satisfy this condition.

Step 3. Singular (boundary) solutions. In separating variables, we divided by , which is not defined when . However, substituting directly into the differential equation shows that
are valid constant solutions since . These are singular solutions that cannot be obtained from the separated form.
Step 4. Particular solutions.
(a) : From , substituting gives or . Because , we take the increasing branch:
To extend this continuously for all , attach the constant segments :
This gives a single continuous nondecreasing solution over the entire real line.
(b) : The constant function is an obvious solution. Alternatively, using at gives . Choosing the increasing branch near ,
To extend for all :
There exist infinitely many such piecewise continuous solutions, obtained by shifting these arcs horizontally.
Step 5. Interpretation and summary.
The general solution applies where and .
The singular solutions correspond to the flat portions of the slope field where .
The complete solution set consists of rising sine arcs smoothly connected to horizontal segments at .
All solutions.
y(x) = (x+) on intervals where (x+)0, together with y1.
8.3.2Linear First-Order Equations
A linear first-order equation has the form
Integrating Factor Method:
Compute the integrating factor:
(8.43)Multiply through by :
(8.44)Integrate:
(8.45)Solve for :
(8.46)
Solution.
Step 1. Identify and . The equation is in the standard linear form
where
Step 2. Compute the integrating factor. The integrating factor is
Step 3. Apply the general solution formula.
Substitute and :
Step 4. Evaluate the integral.
Final Answer:
Verification. Substitute into the original equation:
which satisfies the ODE.
Separable equations and linear equations are the two types of first-order equations most commonly encountered in basic applications. However, there exist several other important forms of first-order equations that can be transformed into solvable types. In this section, we briefly introduce two such forms: the Bernoulli equation and exact equations. More details and applications are found in advanced differential equations texts.
8.3.4The Bernoulli Equation
The differential equation
where and are known functions of , is called the Bernoulli equation. It is nonlinear for , but it can be transformed into a linear equation through an appropriate substitution.
Step 1. Multiply by .
Step 2. Simplify using the substitution .
Hence, . Substitute this into the previous equation:
Step 3. Multiply through by to simplify.
This is now a first-order linear ODE in , which can be solved using the integrating factor method.
Reduced linear form: z' + (1-n)P(x)z = (1-n)Q(x).
After solving for , the original dependent variable is recovered via
The Bernoulli equation provides an important link between nonlinear and linear first-order ODEs. By multiplying through by and substituting , we convert a nonlinear equation into a solvable linear form. This transformation frequently appears in problems involving population dynamics, exponential growth and decay, and fluid motion.
Solution.
Step 1. Multiply by with .
Step 2. Let . Then , so . Substitute:
Step 3. Solve the linear equation using the integrating-factor formula. For
the integrating factor is . Apply
Step 4. Back–substitute to . Since ,
Step 5. Singular solution. Because for all real , the constant function
also satisfies the original ODE. Thus the complete set consists of the one-parameter family above together with .
8.3.5Exact Differential Equations
A general first-order differential equation can often be written in the form
where and are functions of two variables and .
The first–order differential equation
is called exact if there exists a scalar function (called a potential function) such that
In this case, the general solution can be written implicitly as
A necessary and sufficient condition for exactness (assuming continuous partial derivatives) is
The condition above ensures that the mixed second derivatives of are equal:
This is guaranteed by Clairaut’s theorem when and have continuous partial derivatives.
Solution Procedure:
Check whether . If true, the equation is exact.
Integrate with respect to , treating as constant:
(8.76)where is an arbitrary function of .
Since must satisfy
(8.77)we differentiate the above expression for with respect to :
(8.78)Now substitute the known expression for from the original equation and equate:
(8.79)From this, we can solve for :
(8.80)Integrate with respect to to find , and then write the final expression for . The general solution is obtained from
(8.81)Integrate to find , substitute back, and write the final solution .
Solve
Solution.
Step 1. Identify
Step 2. Check the exactness condition:
They are equal, so the equation is exact.
Step 3. Integrate with respect to :
Step 4. Differentiate with respect to :
Compare with , which implies .
Step 5. Hence . The potential function is
Step 6. The general solution is
8.3.6Integrating Factors
If the equation is not exact, it may sometimes be made exact by multiplying by a function called an integrating factor:
The new equation is exact if
Unfortunately, there is no universal method for finding . However, there are two common and important special cases.
Case 1: Integrating factor depends on only.
If , then the equation becomes exact provided that
Hence,
Case 2: Integrating factor depends on only.
If , then the equation becomes exact provided that
Hence,
Solve
Solution.
Step 1. Identify and test exactness.
Compute
Since , the equation is not exact.
Step 2. Seek an integrating factor . Use
Hence
Step 3. Multiply the equation by .
Define
Step 4. Check exactness & find a potential .
Integrate w.r.t. (treating constant):
Using and ,
Now
Step 5. Implicit solution.
Solve
Solution.
Step 1. Identify and test exactness.
Compute
Since , the equation is not exact.
Step 2. Seek an integrating factor . Use
Hence
Step 3. Multiply the equation by .
Define
Step 4. Check exactness & find a potential .
Integrate w.r.t. (treating constant):
Now
Step 5. Implicit solution.
Many physical systems—such as thermodynamics, potential flow, and electrostatics—lead to exact differential equations, where represents a potential energy, enthalpy, or potential function. When the equation is not exact, an integrating factor often restores this structure.
8.4Second-Order Ordinary Differential Equations
A second-order linear ordinary differential equation (ODE) has the general form
where , and are known functions of , and is the unknown function to be determined.
When are constants, the equation simplifies to
We will first study the homogeneous case () and then the nonhomogeneous case ().
8.4.1Homogeneous Equations with Constant Coefficients
Video Lecture 22, Part 5: The Exponential Guess (18:16)
A second–order homogeneous linear differential equation with constant coefficients has the form
Consider the homogeneous linear differential equation
Its solutions are determined by the characteristic (auxiliary) equation
If and are the roots of this quadratic, then the general solution is:
where are arbitrary constants. The sign of the discriminant decides the case: gives (i), gives (ii) with , and gives (iii) with
A second-order law, such as Newton's, needs two starting facts: the starting position and the starting velocity. The general solution must therefore carry two free constants, , with and linearly independent; if were a multiple of , the two constants would merge into one. The Wronskians in the proof below check the independence in each case.
Video Lecture 22, Part 6: Three Kinds of Roots (24:33)
Consider the homogeneous constant–coefficient ODE
Step 1: Exponential trial and substitution. Assume a trial solution with constant . Then
Substituting into the ODE gives
Since for all , we must have the characteristic equation
Step 2: Distinct real roots . If the characteristic polynomial has two distinct real roots and , then
are both solutions. Their Wronskian is
so are linearly independent. Hence the general solution is
Step 3: Repeated real root . (Construction of the term.) If the characteristic polynomial has a double root , then we already have one solution . To find a second, linearly independent solution, set
where is to be determined. Compute derivatives:
Substitute into the ODE:
Divide by and group terms by :
Because is a root of the characteristic polynomial, we have
Moreover, because the root is repeated, the derivative of the characteristic polynomial also vanishes at :
Hence the equation for reduces to
Discarding the multiple of the first solution (the part), we take and obtain
Therefore, the general solution in the repeated-root case is
Step 4: Complex conjugate roots with . If , then are solutions. Taking real and imaginary parts,
are real solutions. Their Wronskian is
so they are linearly independent. Thus the general real solution is
The same result comes from the two complex solutions directly: by Euler's formula, , and the choice , gives and , real.
Combining the three cases completes the proof.
The step in the repeated-root case is precisely the condition where . This is why the reduction–of–order equation collapses to , giving and hence .
The Wronskians shown above explicitly verify linear independence in the distinct-root and complex-root cases.
The exponential ansatz works here because constant coefficients make the ODE invariant under differentiation of : derivatives only pull down factors of , converting the differential equation to an algebraic one.
A common mistake is in case (iii). That is the square root of a negative number; the has already been taken out into , so . For example, has , , , and .
For a block on a spring with a damper, is , and the three cases are three motions after the block is let go (Figure 8.4): with heavy damping () both roots are negative (their product is positive and their sum negative, since , and are positive) and the block creeps back without crossing equilibrium; at (critical damping) it returns as fast as it can without crossing; with light damping () it bounces, its swings shrinking inside the envelope . A car's shock absorbers are tuned close to critical damping.
Solve with and .
Solution.
The characteristic equation has the roots and , so . At both exponentials equal one:
Check: and .

8.4.2Nonhomogeneous Equations
Video Lecture 22, Part 7: The Push and the Oscillator (30:25)
A nonhomogeneous second-order linear ODE is
where is a known forcing (nonzero) function.
The general solution of a nonhomogeneous linear ODE is
where
is the homogeneous (complementary) solution satisfying ,
is a particular solution satisfying the full equation for the given .
If is composed of elementary functions such as exponentials, polynomials, or sines and cosines, we assume a trial form for resembling , substitute into the ODE, and solve for the unknown coefficients.
If any term of the assumed duplicates a part of , multiply by the smallest power of necessary to ensure linear independence.
The particular solution has the same form as the forcing, because the derivatives of these functions keep their form:
Here is the rate in the forcing (not the of the roots), and substituting gives equations for the constants and .
Take , whose homogeneous solution is .
: try . Each derivative brings down a : , so and .
: the trial gives , because already solves the homogeneous equation. Multiply by : with , and , so , and .
8.4.3Example: Forced and Damped Harmonic Oscillator
Consider the driven, damped oscillator
where is the mass, the damping coefficient, the spring constant, and the external driving force.
Solution.
Step 1. Newton's second law. The block moves along , measured from equilibrium (Figure 8.5). Along three forces act: the spring pulls back toward equilibrium with , the drag points against the velocity, and the push comes from outside; along , the weight and the normal force balance, since the block does not move up or down:
Moving the drag and the spring to the left gives the equation above. (With the drag's sign wrong, the motion would grow by itself.)

Divide through by :
where
Video Lecture 22, Part 8: The Oscillator Left Alone (36:48)
Step 2. Homogeneous solution.
For the unforced system,
the characteristic equation is
where
is the damped natural frequency. Hence,
(With the roots are real instead: the creeping and critical motions, which never swing.) The two constants come from the start. For a block pulled to and let go at rest, and , so and
nearly a cosine starting at its peak when the damping is weak.
Video Lecture 22, Part 9: The Driven Response (41:29)
Step 3. Particular (steady–state) solution using complex amplitude.
We look for a steady–state oscillation at the same frequency as the driving force. To simplify the algebra, we use a complex trial solution.
Step 3(a). Choose a complex trial solution.
Assume
where is a complex constant. We may write
so that
Step 3(b). Substitute into the differential equation.
The driven damped oscillator equation (after dividing by ) is
We substitute the full complex function :
Substituting into the ODE gives
Step 3(c). Cancel .
Step 3(d). Solve for the complex amplitude .
Write the denominator in polar form:
where
The imaginary part is positive, so the point lies above the real axis and : exactly at , and when the real part is negative and lies between and (a calculator's must be moved into that quadrant).
Thus,
Step 3(e). Take the imaginary part.
Its velocity, which the example also asks for, is
Since , the block reaches each peak after the push does: the response lags the force. (Writing , as in the lecture video, ; taking would make the block move before it is pushed, and it does not solve the equation.)
Final steady–state response:
with
Step 4. Complete solution.
Video Lecture 22, Part 10: Resonance, and the Answer (47:22)
Step 5. Physical interpretation.
: Transient response, which decays exponentially as and oscillates with the damped frequency .
: Steady–state response, which oscillates at the driving frequency .
The steady–state amplitude, for any damping, is
(8.173)A check: for a very slow push, , and : the spring stretches as under a steady force (Hooke's law), in step with the push.
The amplitude reaches a maximum (resonance) when the driving frequency is close to the natural frequency of oscillation,
(8.174)More precisely, minimising the denominator gives the peak at , which reduces to in the weak-damping limit . Evaluating the amplitude at ,
(8.175)which is large when is small — the amplitude at resonance is limited only by the damping, and would diverge if .
As , the transient term vanishes and only the steady oscillation remains.

8.5Where Differential Equations Are Used
A differential equation is a statement about how a quantity changes, and change is what physics is about. The forced damped oscillator worked at the end of this chapter is not one example among many — it is the template. The same equation , with the symbols reinterpreted, governs a startling range of systems.
Mechanical vibration. Mass on a spring, a pendulum, a building swaying in wind: all are , and the resonance condition is why soldiers break step on bridges.
Electrical circuits. The series RLC circuit obeys , identical in form to the oscillator with , , . Resonance here is how a radio selects a station.
Growth and decay. The first-order equation describes radioactive decay, population growth, cooling, and the charging of a capacitor — the separable equations of this chapter.
Chemical kinetics and mixing. Reaction rates and concentration in a stirred tank are first-order linear ODEs solved by the integrating factor.
The starting point for everything later. Series solutions (Chapter 9) handle ODEs with variable coefficients that these elementary methods cannot; partial differential equations (Chapter 10) are solved by separating them into ordinary ones.
In the earthquake of 19 September 1985, the buildings of Mexico City that collapsed were mostly between six and fifteen floors, while many lower and taller buildings beside them stood. The soft clay of the old lake bed under the city shook back and forth with a period of about .
Model a building by its simplest way of swaying, one block on a spring: the floors are the mass, the bending columns the spring, the internal friction the damping. When the ground moves as , the sway of the floors relative to the ground obeys
the forced oscillator with (seen from the moving ground, the floors feel the force that keeps them up with its acceleration). The derivation: with the ground at , the floors' own acceleration is , while the columns and the friction act only on the bending , so Newton's law reads ; with the ground's term moves to the right side as the push. Write the damping as ; buildings have . At the steady amplitude is
a building whose natural period matches the ground's sways ten times as far as the ground moves. A low, stiff building (natural period , say) moves with the ground, ; a much taller one () cannot follow the fast ground and bends little, spread over many floors (Figure 8.7). Many buildings of the middle height had natural periods near : they were driven at resonance.

Two ideas from this chapter carry the most weight later. First, for a linear equation the general solution is : the full space of solutions is a particular solution plus the entire solution set of the homogeneous equation. Second, the exponential ansatz turns a constant-coefficient linear ODE into an algebraic equation, because differentiating only multiplies it by . Almost every linear system in physics is attacked by some version of these two moves.
Summary Table
| Type | Form | Method |
| Separable | Separate and integrate: . | |
| Linear (1st order) | Integrating factor . | |
| Bernoulli | Substitute to linearise. | |
| Exact | , | Find with , ; solution . |
| Non-exact | , | Integrating factor or . |
| Homogeneous (2nd, const.) | Roots of ; three cases. | |
| distinct real | . | |
| repeated root | . | |
| complex | . | |
| Nonhomogeneous (2nd) | ; undetermined coefficients for . |
For the Interested Reader
Differential equations is a subject where the mechanics of solving can hide the point, which is that an equation relating a quantity to its rate of change already contains the system's whole future. The first item below is the best short antidote to losing sight of that. Everything listed is free.
The idea, seen
3Blue1Brown's opening film treats differential equations as a way of thinking about change, using the pendulum and the very oscillator of this chapter. It is worth watching before the techniques start to feel mechanical:
Differential equations, a tourist's guide — 3Blue1Brown
Watch on YouTube
Worked technique and practice
Paul's Online Math Notes — Differential Equations. The closest match to this chapter and the best source of extra practice: the full set, with Linear Equations and Second Order Equations covering our first- and second-order material in more detail, including variation of parameters, which we did not treat.
OpenStax, Calculus Volume 2, Chapter 4. 4.3 Separable Equations and 4.5 First-Order Linear Equations — a slower first pass with many worked examples and applications to growth, decay and mixing.
One method this chapter did not cover is worth knowing exists: the Laplace transform, which turns a linear constant-coefficient ODE with given initial conditions into an algebraic equation, handles discontinuous and impulsive forcing cleanly, and is the standard tool in engineering. Paul's notes above develop it in full. It is, in spirit, the same trade we made with and with the complex amplitude in the oscillator example — replace calculus by algebra by moving to a transform.
Video lectures
Each section of this chapter links to the part of a lecture that teaches it. The full lectures are below, and all of them are in the course playlist.
Video Lecture 22: Why Mexico City's Buildings Fell - Ordinary Differential Equations (full lecture)