Nonhomogeneous ODEs and Applications
Nonhomogeneous linear ODEs describe systems driven by an outside input. The homogeneous part gives the natural response, while the forcing term creates a particular response. In engineering language, the solution is usually separated into transient behavior, which depends on initial conditions and often decays, and steady or forced behavior, which follows the input.
This topic extends the constant-coefficient second-order equations by adding terms such as loads, voltages, periodic forcing, impulses, and prescribed environmental changes. The central task is to find one particular solution without losing the homogeneous family. Once that is done, initial or boundary conditions determine the constants.
Definitions
A second-order nonhomogeneous linear ODE is
The associated homogeneous equation is
If is any particular solution of the nonhomogeneous equation and is the general solution of the associated homogeneous equation, then
is the general nonhomogeneous solution.
For constant coefficients,
two common methods are undetermined coefficients and variation of parameters. Undetermined coefficients works when is built from polynomials, exponentials, sines, cosines, and finite products of these. Variation of parameters is more general and uses a fundamental set of homogeneous solutions.
For a fundamental set , variation of parameters looks for
with
when the equation is normalized as .
Key results
The superposition principle is the organizing result. If is a linear differential operator, then
Thus every solution differs from a chosen particular solution by a homogeneous solution. This is why we never replace with ; both parts are needed.
For undetermined coefficients, the trial form should match the forcing and be linearly independent from the homogeneous solution. If the forcing is times a polynomial of degree , try times a general polynomial of degree . If the forcing is or , try both sine and cosine terms because differentiation mixes them. If the trial overlaps with , multiply by enough times to remove the overlap.
This overlap rule is the resonance rule in algebraic form. If the input has the same shape as a homogeneous mode, the system cannot respond with a simple copy of that mode, so an extra factor of appears. In mechanical systems, resonance means that a forcing frequency is close to a natural frequency; damping limits the growth, but the response amplitude can still be large.
Variation of parameters is more flexible because it does not require guessing a special forcing form. Its cost is integration. The method is especially useful when is a function such as , , or a quotient that does not fit the undetermined-coefficients table. The formulas assume the equation has leading coefficient ; if the original equation is , first divide by on an interval where .
Applications typically interpret as transient and as forced. This interpretation is clearest when the homogeneous modes decay. If a homogeneous root has positive real part, the transient does not disappear, and the model predicts instability. A steady-state calculation is meaningful only after stability has been considered.
The method of undetermined coefficients is best understood as a closure property. Polynomials, exponentials, and sines or cosines form finite-dimensional spaces that remain finite-dimensional after differentiation. For example, differentiating only changes the coefficients. That is why a finite trial with unknown constants can succeed. A forcing such as does not have this property under repeated differentiation in a small finite span, so variation of parameters is the safer tool.
The annihilator viewpoint gives the same rule in another language. If a differential operator kills the forcing, then applying to both sides creates a higher-order homogeneous equation. Solving that equation identifies the possible forms of , while overlap with the original homogeneous solution explains the extra powers of . This viewpoint is useful in control and signal processing because it connects forced ODEs with poles, zeros, and input classes.
In applications, forcing terms are often idealizations. A constant force may represent gravity near Earth's surface. A sinusoidal force may represent a rotating imbalance, an alternating voltage, or a periodic tide. A step input models a switch being closed. The mathematical method should be matched to the input: undetermined coefficients handles smooth elementary inputs, Fourier series handles periodic inputs by harmonic decomposition, and Laplace transforms handle steps and impulses cleanly.
Initial conditions interact with the forcing but do not change the forcing itself. The same system under the same input has one particular forced response, while different starting conditions add different homogeneous transients. This separation is a powerful diagnostic. If two solutions have the same forcing and different initial conditions, their difference must satisfy the homogeneous equation. If it does not, at least one solution is wrong.
Boundary-value problems require more care than initial-value problems. Applying two conditions at different points can produce a unique solution, no solution, or infinitely many solutions depending on whether the boundary conditions conflict with the homogeneous modes. Resonance in a boundary-value problem appears as a forcing that is orthogonal or not orthogonal to certain modes, a theme that returns in Sturm-Liouville theory and PDE separation of variables.
The particular solution is not unique. If is one particular solution and is any homogeneous solution, then is another particular solution. This is why methods may produce different-looking particular solutions while the final general solution is equivalent. To compare answers, subtract them. If the difference solves the homogeneous equation, the answers represent the same family.
Visual
| Forcing | First trial for | If trial overlaps |
|---|---|---|
| Constant | Constant | Try or higher |
| Polynomial degree | Polynomial degree | Multiply whole polynomial by |
| Multiply by | ||
| Multiply by | ||
| Product of above | Product-shaped trial | Multiply by |
Worked example 1: Undetermined coefficients with resonance
Problem. Solve
Method.
- Solve the homogeneous equation:
So
-
The forcing is , but is already a homogeneous solution. The first trial overlaps.
-
Multiply by and try
- Differentiate:
and
- Substitute:
- Match :
Answer.
Check. The particular term is not a homogeneous term because of the factor , and direct substitution gives the forcing .
Worked example 2: Variation of parameters
Problem. Solve
Method.
- The homogeneous equation has basis
- Compute the Wronskian:
- Use variation of parameters for the normalized equation:
and
- Simplify :
- Integrate:
and
- Build :
Answer.
Check. The interval avoids the singularities of and .
Code
import sympy as sp
x = sp.symbols("x")
y = sp.Function("y")
ode = sp.Eq(sp.diff(y(x), x, 2) - 3 * sp.diff(y(x), x) + 2 * y(x), sp.exp(x))
print(sp.dsolve(ode))
The symbolic result should be read structurally, not just copied. Check that the answer contains two arbitrary constants, that the nonhomogeneous term includes the resonance factor , and that substituting only the particular term gives . For numerical work, the same equation can be rewritten as a first-order system and integrated with solve_ivp, but the analytic solution gives a useful benchmark.
Common pitfalls
- Forgetting to add the homogeneous solution after finding a particular solution.
- Trying undetermined coefficients on a forcing term that does not fit the method's allowed forms.
- Missing resonance overlap and using a trial term already contained in .
- Applying variation of parameters before normalizing the coefficient of to .
- Dropping absolute values in logarithms when integration produces terms such as .
- Calling the particular solution the steady state when the homogeneous part does not decay.
- Applying initial conditions to alone instead of to the complete solution .
- Treating different particular solutions as contradictory. They may differ by a homogeneous term and still generate the same complete family.
- Forgetting to state the interval when the forcing or the variation-of-parameters integrals have singularities.