First-Order ODEs
A first-order ordinary differential equation relates an unknown function to its first derivative. In engineering models the derivative is usually a rate: current changing in a circuit, temperature relaxing toward the surroundings, concentration changing in a mixing tank, or velocity responding to drag. The mathematical work is only one part of the task. A useful solution also records the modeling assumptions, the interval where the solution is valid, the initial condition, and the physical meaning of constants.
This page sits between qualitative ideas such as slope fields and later linear-system methods. The main theme is recognition: identify whether the equation is separable, linear, exact, Bernoulli, homogeneous in , or best handled numerically. Many errors in first-order ODEs come from forcing an equation into a favorite method instead of checking its actual structure.
Definitions
A first-order ODE can be written implicitly as
or explicitly as
An initial value problem adds one condition,
which selects one curve from a family of solution curves. A solution on an interval is a differentiable function such that for all .
A separable equation has the form
Where , separate and integrate:
A linear first-order equation has standard form
The integrating factor
makes the left side a product derivative:
An exact equation has differential form
and is exact on a simply connected region when . Then there is a potential function with and , and the implicit solution is .
A Bernoulli equation is
The substitution converts it into a linear equation for .
Key results
The existence and uniqueness theorem gives the basic local guarantee. If and are continuous in a rectangle around , then the initial value problem , , has exactly one solution near . The theorem is local: it does not promise that the solution exists forever, and it does not say that the formula will be elementary.
For separable equations, constant solutions can be lost by division. If , separating by dividing through by assumes and , so the equilibrium solutions and must be added separately. These equilibria often control the long-term behavior.
For linear equations, the integrating factor formula is
For exact equations, a reliable construction is
The second line determines . If the leftover expression still contains , the equation was not exact or a computation error occurred.
For autonomous equations , the phase line gives stability without solving. An equilibrium satisfies . If below and above it, nearby solutions move toward and the equilibrium is stable. If arrows point away, it is unstable.
Most engineering uses of first-order equations start from a balance law rather than from a ready-made formula. In a mixing problem, the dependent variable is usually amount, not concentration, because the balance is most naturally written as amount per time. In a cooling problem, the dependent variable is temperature, and the proportional term must use the difference from ambient temperature, not the absolute temperature. In a circuit model, Kirchhoff's law determines whether the state variable should be charge, current, or capacitor voltage. Choosing the state variable well often makes the equation linear.
The interval of validity is part of the answer. A formula may contain a logarithm, a denominator, or a square root that restricts , and the initial point must lie in the chosen interval. For example, the solution of , , is , which blows up at . The existence theorem gives local existence near , but it does not contradict finite-time blow-up.
Some equations become linear only after a change of variables. Bernoulli equations are the standard example, but homogeneous equations of the form use , so and . Equations with a shifted center, such as , may require translating coordinates before applying that idea. The point is not to memorize many named types; it is to look for algebraic structure that lowers the equation to one of the dependable forms.
Exact equations require a region condition as well as the derivative test. The equality is normally used on a simply connected region where the partial derivatives are continuous. Holes in the region can produce path-dependent behavior, which is why the assumptions matter. In elementary engineering ODE problems the region is usually a rectangle or half-plane, but checking the domain prevents subtle mistakes when denominators vanish.
Integrating factors beyond the linear case exist but are not automatic. For a nonexact equation , a factor depending only on may be found if
is a function of alone. A factor depending only on may be found if
is a function of alone. These tests are useful, but they should be applied after the simpler classifications have been checked.
Visual
| Form | Recognition cue | Main move | Frequent check |
|---|---|---|---|
| Separable | Put terms with and terms with | Add lost equilibrium solutions | |
| Linear | Multiply by | Left side becomes | |
| Exact | , | Find , | Final answer is implicit |
| Bernoulli | Use | Exclude cases | |
| Autonomous | Phase line and equilibria | Arrows match sign of |
Worked example 1: Mixing tank with a linear equation
Problem. A tank initially contains L of water with g of salt. Brine containing g/L enters at L/min, and the well-mixed solution leaves at L/min. Find the salt amount .
Method.
- The volume stays L because inflow equals outflow.
- Rate in is
- Rate out uses tank concentration :
- The balance law gives
- Put it in linear standard form:
- The integrating factor is
- Multiply and integrate:
- Hence
- Use :
Answer.
Check. The steady amount is g because the incoming concentration g/L in a L tank corresponds to g. Since the initial amount is g, the solution increases toward .
Worked example 2: Bernoulli equation reduced to linear form
Problem. Solve
Method.
- This is Bernoulli with , , and .
- Use
- Differentiate:
- Divide the original equation by where :
- Substitute and :
- Multiply by :
- This is linear. The integrating factor is
- Multiply:
- Recognize the product derivative:
- Return to :
Answer.
with the additional solution from the original equation.
Check. Substituting into gives
so the transformed equation is satisfied.
Code
import numpy as np
from scipy.integrate import solve_ivp
def tank_rhs(t, A):
return 2.0 - A[0] / 25.0
t_eval = np.linspace(0.0, 150.0, 301)
sol = solve_ivp(tank_rhs, (0.0, 150.0), [20.0], t_eval=t_eval)
exact = 50.0 - 30.0 * np.exp(-t_eval / 25.0)
max_error = np.max(np.abs(sol.y[0] - exact))
print(f"computed final amount = {sol.y[0, -1]:.4f} g")
print(f"exact final amount = {exact[-1]:.4f} g")
print(f"max error on grid = {max_error:.2e}")
Common pitfalls
- Dividing by , , or another factor without checking whether it gives an equilibrium solution.
- Using the integrating factor before the equation is in the normalized form .
- Forgetting the constant of integration after integrating .
- Treating an implicit solution as if it must always be solved explicitly for .
- Missing interval restrictions such as when or appears.
- Ignoring units in models; a term with units of amount cannot be added to a term with units of amount per time.
- Reporting only the algebraic family and skipping the initial condition. For an initial value problem, the constant must be determined and the final curve should be checked against the starting value.
- Assuming every first-order model has a closed elementary form. Direction fields and numerical solvers are legitimate tools when recognition tests fail.