3.1 Introduction
3.1.1 What is an ordinary differential equation?
An equation relating a dependent variable (usually ), one independent variable (usually or ), and derivatives of the dependent variable:
The order is that of the highest derivative present.
- 1st order: involves , and , with no higher derivatives.
- 2nd order: involves , , and , with no higher derivatives.
3.1.2 What is a linear ordinary differential equation?
Linear ODEs are the key class for engineers. They contain no terms such as , or .
An ODE that can be written in the form:
- 1st order:
- 2nd order:
A linear ODE is homogeneous if no function of the independent variable appears on its own, i.e. .
Let solve the homogeneous case, . Let be a particular solution for , so . Then for any constant the overall solution is
Show derivation
Substitute into the left-hand side and collect terms, using the linearity of differentiation:
- Order = highest derivative. Ordinary = one independent variable.
- Linear: and its derivatives appear only to the first power and are never multiplied together.
- Homogeneous: .
- General solution of a linear ODE = (constant) × homogeneous solution + one particular solution.
Explanation Does linear mean the coefficients must be linear in x?
No. Linearity is about only. is linear even though it contains , and is also linear. But is not, even though it looks simpler.
Superposition depends on this. A term like breaks it, because .
Explanation Why is the CF scaled by α but the PI is not?
The homogeneous equation has on the right, so any multiple of a solution still gives . Scaling by would give on the right, which is the wrong forcing.
The PI is also not unique: plus any multiple of is another valid PI. This does not matter, because absorbs the difference.
3.2 First order linear ordinary differential equations
3.2.1 Solution of the homogeneous linear 1st order ordinary differential equation
The 1st order linear ODE is , with and functions of . First take the homogeneous case .
is an arbitrary constant, found from a boundary condition.
Show derivation
Separate the variables, so terms are on one side and terms on the other:
- always separates: .
- There is one arbitrary constant, so one boundary condition is needed.
Explanation A = e^c is always positive, so can y be negative?
Strictly, , so and . The solution also works. Together these allow to be any real number, so in practice just treat as an arbitrary constant.
3.2.2 Example
Example y’ + 3x²y = 0 with y = 1 when x = 0
Separate and integrate:
3.2.3 Solution of the non-homogeneous 1st order linear ordinary differential equation
Now take . The solution has two named parts.
The solution of the homogeneous ODE, i.e. with set to zero.
A particular solution of the ODE with the actual . It can often be found by an educated guess.
The sum of the two parts, by Principle of superposition (1st order):
Example y’ + 3x²y = x² with y(0) = 1: CF + PI
CF. From the previous example (3.2.2) the homogeneous solution is .
PI. With , guess , a constant. Then , so the ODE becomes , which gives
General solution.
Boundary condition. gives , so :
The grey dashes show the slope at each point. Move : the boundary condition picks one curve from the family, and the green curve follows the slopes everywhere. The CF (blue) dies away for , leaving the PI (red dashed).
- CF: solve with . PI: find any one solution with the actual .
- General solution = .
- Apply the boundary condition last, to the whole general solution.
3.2.4 Separation of variables to solve the non-homogeneous linear 1st order ODE
Some 1st order ODEs can be solved directly by separation of variables.
If the ODE can be written with the right-hand side as a product,
Show derivation
Example y’ + 3x²y = x² with y(0) = 1: separation of variables
Re-write the ODE and separate:
Keep the modulus in . Here makes , which is negative, so would not even be real at the boundary point.
- Use when the right-hand side factorises as .
- : remember the factor and the modulus.
Explanation When does separation fail but the ODE is still linear?
Separation needs a product . The example only separates because the coefficient of and the right-hand side share the factor . Change the right-hand side to : does not separate. The integrating factor method below still applies, though the resulting integral need not be elementary.
3.2.5 The integrating factor method to solve the non-homogeneous linear 1st order ODE
The integrating factor method is more general than separating variables or finding the CF and PI separately. It combines into the derivative of a product.
For , the integrating factor is , and
Show derivation
If were zero, Homogeneous 1st order solution gives . Rearranging, .
This suggests differentiating that product. By the product rule, the Chain rule and the Fundamental theorem of calculus:
- The ODE must first be in standard form, with coefficient of equal to 1.
- Integrating factor , while the CF has .
- Add the constant when integrating the right-hand side, then divide everything by the integrating factor, including the constant.
Explanation Why is there no constant in the integrating factor?
Any integrating factor will do, so take the simplest. Including a constant in multiplies both sides of the equation by , which cancels. The one constant that matters appears when you integrate the right-hand side.
If the ODE is , divide by first. Then and .
3.2.6 Example revisited
Example y’ + 3x²y = x² with y(0) = 1: integrating factor
Here , so the integrating factor is . Multiplying through:
Explanation Where did the CF and PI go?
They are still there. Dividing by the integrating factor gives . The constant of integration carries the CF, and the integral of the right-hand side gives the PI. The method finds both at once.
3.2.7 Engineering example: time and frequency domain response of a low pass filter
A resistor and capacitor form, in essence, a potential divider. We want for a given input .
The ideal voltmeter across draws no current, so the same current flows through and . This is the circuit of The RC circuit (resistor in series, output across the capacitor).
A non-homogeneous 1st order linear ODE, with .
Show derivation
The current through the resistor is its voltage drop divided by its resistance (Ohm's law):
is the constant of integration.
Show derivation
Apply the Integrating factor method method with , so the integrating factor is :
The solution has two parts:
- Complementary function: solves the homogeneous equation ().
- Particular integral: the second term is a solution for the specified right-hand side.
The general solution is the linear combination of the two. This form gives the output for any input (it is a convolution).
1st case: time domain response to a voltage step
Show derivation
Change . The output (purple) is the sum of the decaying CF (blue, ) and the constant PI (red). The grey tangent at reaches at exactly , the time constant.

A F capacitor charged through a k resistor with a 5 V step, with the theoretical curve for s. The slight offset arises because was defined by the voltage exceeding a 1 V threshold.
2nd case: frequency response to a sinusoid
Take for . Requiring for all forces .
The amplitude falls as rises, and the output lags the input by .
Show derivation
In General solution for any input the CF term grows without limit as , so :
The gain is expressed in decibels, which is a ratio of voltages squared since (Power dissipated in a resistor (DC)).
denotes the time average.
Show derivation
The average value of is (from , databook maths p4). For the input:
For :
Show derivation
Sweep the slider. At low frequency the output follows the input; at high frequency it is small and lags by nearly . This is why the circuit is a low pass filter. The dashed line is the dB per decade asymptote.

Measured gain and phase of a low pass filter built from a F capacitor and a k resistor, with the theory for s. The frequency axis is in Hz, where . The dB per decade slope is visible in the data.
- Ideal voltmeter: , with . Then use the integrating factor .
- Step: final value , time constant ; is fixed by .
- Sinusoid on : , since the CF would blow up as .
- Use to do the integral.
- For , gain falls 20 dB per decade.
Explanation Why is c non-zero for the step but zero for the sine?
It depends on when the input starts. The step starts at with a known state, so the CF is needed to match . It is the transient, and it dies away after a few .
The sine has been running forever, so any transient has long since decayed. Mathematically, the CF would be infinite at , so . Only the steady-state PI remains.
Explanation Is this the same answer as the impedance method?
Yes. Treat the circuit as a potential divider with :
Explanation What happens at ωRC = 1?
Gain dB and phase . This is the corner of the Bode plot, where the two straight-line asymptotes (0 dB, and dB per decade) meet. For s it is at Hz, which you can check against the measured plot.
3.3 Second order linear ordinary differential equations:
3.3.1 The operator
This section covers homogeneous 2nd order ODEs only.
As is an operator, powers mean repeated application:
The homogeneous 2nd order ODE becomes .
If and both solve , then so does
Show derivation
We are given and . Substituting and using the linearity of :
For constant , this gives the case used repeatedly below:
Show derivation
The first line is Integrating factor method written with . For the second, put , so .
3.3.2 A useful property of the operator
can be treated like an algebraic term. If is a quadratic, then . (Here denotes a polynomial, not the coefficient function in the ODE.)
Show derivation
and . So
changes only by a scale factor. So is an eigenfunction of , satisfying , with eigenvalue . This matches matrices, where an eigenvector satisfies .
- ; polynomials in behave like ordinary polynomials.
- is an eigenfunction of : replace by when acting on it.
3.3.3 Homogeneous second-order ODEs with constant coefficients
can be written as , where are the roots of the auxiliary equation ( replaced by ):
Show derivation
Expand the factors. The middle coefficient is :
To solve formally, use the method of reduction of order: split the 2nd order ODE into two 1st order ODEs.
Defining turns the ODE into , and leads to
Show derivation
With the ODE is . By Integrating factor in D notation:
There are three cases, set by the sign of .
The last term is .
Show derivation
:
Show derivation
Take and , so . Then Reduction of order: common first step becomes
- Replace by to get the auxiliary equation; its roots decide the case.
- Reduction of order: gives two 1st order ODEs in turn.
- A 2nd order ODE has two arbitrary constants, so it needs two conditions.
Explanation Why can the D polynomial be factorised like a normal quadratic?
Because and are constants, , so and commute and the brackets multiply out as usual. This fails for variable coefficients: . That is why this section is restricted to constant coefficients.
Explanation Is there a quicker way to see the auxiliary equation?
Try . By D acting on an exponential, . Since , this vanishes exactly when is a root.
This finds both solutions in the distinct-root case. For a repeated root it finds only one, and the reduction of order shows that the missing one is .
Explanation A and B contain j in the derivation. Isn’t y meant to be real?
and are just arbitrary constants. If is real for all , then and turn out real, which requires and to be complex conjugates. You then fix real and directly from two real conditions, and never need to look at and .
For real , complex roots always come in a conjugate pair (Real polynomials: roots are real or come in conjugate pairs), so is the only complex case.
3.3.4 Simple example problem – repeated roots
Example (D² + 2D + 1)y = 0
The auxiliary equation is , a repeated root . The general solution is
3.3.5 Simple example problem – distinct real roots
Example (D² + 3D + 2)y = 0
The auxiliary equation is , with roots and . The general solution is
3.3.6 Simple example problem – distinct complex roots
Example (D² + 2D + 2)y = 0
The auxiliary equation has roots
3.3.7 Summary of solutions to ODE of the form
are the roots of the auxiliary equation . Here label the roots (in case 3, their real and imaginary parts), not constants of integration.
| Case | Condition | Roots | General solution |
|---|---|---|---|
| 1. Repeated | |||
| 2. Distinct real | |||
| 3. Complex conjugate |
Show derivation
These are Case 1: repeated root, b² = 4ac, Case 2: distinct real roots, b² > 4ac and Case 3: complex roots, b² < 4ac, with the constants and roots relabelled.
Solutions of with , (). Start with , and raise : the complex pair slides left and meets on the real axis at (try , ), then splits along it. The real part of the root sets the decay and the imaginary part sets the oscillation frequency. Set for pure oscillation.
- real: exponentials. complex: decaying or growing oscillation, times a sinusoid at .
- Repeated root: remember the extra factor .
3.4 Second order linear ordinary differential equations:
3.4.1 Introduction
The discussion is restricted to constant coefficient ODEs, .
For , there are two homogeneous solutions and , and
Show derivation
Write , which is linear. By Superposition (2nd order homogeneous), . Since :
3.4.2 Method of reduction of order (integral based - general but time consuming)
The integrals are indefinite. and are found from the boundary conditions.
Show derivation
Re-write the ODE using the roots of (Auxiliary equation):
The factor inside the integral is throughout.
- Reduction of order: always works, but needs two nested integrals. Use the trial method in an exam unless told otherwise.
- Steps: factorise, set , solve for , then solve for .
3.4.3 Example problem: find the general solution of
Example (D² − 5D + 4)y = e⁶ˣ by reduction of order
The auxiliary equation is .
Define , which satisfies . The integrating factor method gives
3.4.4 Example problem: find the general solution of
Example (D² − 4D + 4)x = t² by reduction of order
Factorise: . Define , which satisfies .
The integrating factor method gives , and so
Both the PI and are quadratic. Exploiting this similarity avoids doing all these integrals, and leads to the method to use in timed exams.
3.4.5 Undetermined coefficients with trial solution method (much better for Tripos!)
The PI has a similar form to . So try a function similar to , known as a trial PI. The table is in the maths databook.
| Right-hand side | Trial PI |
|---|---|
| constant | |
| ( integer) | |
The constants (and possibly etc.) are to be determined.
Show derivation
Each trial is a family of functions closed under : differentiating a member gives another member. For example, turns into a combination of the same two functions.
So applied to a trial stays in the family. Matching coefficients with then gives linear equations for the constants, which have a solution unless part of the family is annihilated by . That exception is the case in Trial PI when q(x) is similar to the CF.
Method:
- Solve the auxiliary equation to get the CF.
- Choose the trial PI from the table, checking it against the CF.
- Substitute into the ODE and compare coefficients.
- Write , then apply any boundary conditions.
- Find the CF first: you need it to check the trial.
- or on the right always needs both and in the trial.
- A polynomial trial needs all the lower powers, down to the constant.
- Table on databook maths p8.
3.4.6 Example problem: find the general solution of
Example (D² − 4D + 4)x = t² by undetermined coefficients
Factorise: .
The root is repeated, so the complementary function is .
Trial PI:
- : , so
- : , so
- : , so
So , and
3.4.7 Undetermined coefficients method when is similar to the CF
The method needs care when the driving term is similar to either part of the complementary function. A slightly different trial PI is then needed.
| Complementary function | Right-hand side | Trial PI |
|---|---|---|
| , | or | |
| , | or |
The constants (and possibly etc.) are to be determined.
Show derivation
Let and suppose is in the CF, so . By D acting on an exponential, the ordinary trial gives , which can never equal .
Instead, using and :
A physically significant example is resonance: a system excited at its natural frequency. For driven at :
Show derivation
Divide by . With :
Since , we get . So
Pendulum starting from rest, with and . Away from the response is a bounded beat. Move towards 1: the beats stretch out, and at exactly 1 the envelope becomes the straight dashed lines, the term.
- Compare with the CF before choosing a trial. If similar, multiply the trial by .
- Symptom of a missed clash: the trial substitutes to give on the left.
- Resonance: forcing at the natural frequency gives a term.
Explanation What if the CF has a repeated root, so both e^{kx} and xe^{kx} are in it?
Then fails too. In the derivation above, for a repeated root. Multiply by again and try .
With : and , so and for . The rule is: keep multiplying by until no term of the trial is in the CF.
Explanation What if q(x) has several terms?
The ODE is linear, so treat each term separately. If and , then . Find a PI for each term, checking each one against the CF, and add them.
Explanation In the x^n row, why is there a redundant constant?
The trial ends in a constant multiple of , which is already in the CF. That term gives zero on substitution, so you can drop it or leave its coefficient arbitrary. It would simply merge with the CF constant.