Linear First-Order Equations

Suppose a tank holds brine whose concentration is stirred by an inflow. That inflow itself changes with time. How does the amount of salt evolve? This question, and hundreds like it in circuits, mixing, cooling, and population models, leads to a differential equation. In this equation, the unknown function and its derivative appear only to the first power. But the coefficients are allowed to depend on the independent variable. Such equations are not generally separable. The forcing term g(t)g(t) and the coefficient p(t)p(t) tangle yy and tt together. This resists factoring into tt-stuff times yy-stuff. The remarkable fact is that every such equation can be solved in closed form. This works by a single unifying trick. Multiply through by a cleverly chosen function called an integrating factor. It is chosen precisely so that the left side collapses into the derivative of a product. This converts the differential equation into something you can integrate directly. The trick is old — it goes back to Leibniz in the 1690s. It is one of the first places a student sees a general strategy. That strategy is "transform the equation into a shape you already know how to solve." The big picture is that linear first-order equations sit at the base of a tower. The integrating-factor idea reappears, generalized, when treating Exact Equations and general Integrating Factors for nonlinear equations. The explicit solution formula derived here is also a seed. From it, the variation-of-parameters method for higher-order linear equations grows. The entire linear theory is later reorganized using the The Laplace Transform: Definition and Existence. This transform converts differentiation into algebra. This article gives the precise definition of a linear first-order equation. It builds geometric intuition via slope fields. It proves the general solution formula rigorously (existence, uniqueness, and an explicit closed form). It works two asymmetric examples in full. It shows exactly which hypothesis cannot be dropped, and why.

Key takeaways
  • A linear first-order ODE has the form y′+p(t)y=g(t)y' + p(t)y = g(t), with no powers or products of yy and y′y'.
  • The integrating factor μ(t)=e∫p(t) dt\mu(t) = e^{\int p(t)\,dt} turns the left side into (μy)′(\mu y)'.
  • Multiplying by μ(t)\mu(t) and integrating gives an explicit formula for every solution.
  • Continuity of pp and gg on an interval guarantees a unique solution through any initial point in that interval.
  • The general solution is (particular solution) + (constant) ×\times (homogeneous solution) — a preview of linear superposition.
  • Key idea: multiply by μ(t)=e∫p dt\mu(t)=e^{\int p\,dt} so the left-hand side becomes a single derivative, (μy)′(\mu y)', which integrates directly.

Where this lives today

The integrating-factor solution to y′+p(t)y=g(t)y'+p(t)y=g(t) is not a historical curiosity; it is a working tool across quantitative science.

Circuits. An RL circuit with resistance RR, inductance LL, and a time-varying source voltage E(t)E(t) obeys L i′+R i=E(t)L\,i' + R\,i = E(t), exactly a linear first-order equation with p(t)=R/Lp(t)=R/L, g(t)=E(t)/Lg(t)=E(t)/L; the integrating-factor formula gives the current i(t)i(t) directly, including the transient decay e−Rt/Le^{-Rt/L} from the homogeneous part.

Population and pharmacokinetics. Drug concentration in the bloodstream with a time-dependent infusion rate I(t)I(t) and constant elimination rate kk satisfies C′+kC=I(t)C' + kC = I(t); clinicians use exactly this formula to predict blood concentration profiles for variable-rate IV infusions.

Newton's law of cooling with variable ambient temperature. If the surrounding temperature Ta(t)T_a(t) oscillates (e.g. daily temperature cycles), the object's temperature obeys T′+kT=kTa(t)T' + kT = kT_a(t), again solved by the integrating factor, producing phase-shifted, damped oscillatory responses relevant to building thermal modeling.

Numerical analysis and control theory. The variation-of-constants formula proven here is the prototype for the matrix exponential solution x˙=A(t)x+b(t)\dot{\mathbf x} = A(t)\mathbf x + \mathbf b(t) in linear systems and control theory, where μ(t)\mu(t) generalizes to a fundamental matrix.

Transform methods. The The Laplace Transform: Definition and Existence later re-derives and vastly generalizes this solution formula algebraically, converting the ODE into sy^(s)−y0+p∗y^=g^(s)s\hat y(s) - y_0 + p\ast \hat y = \hat g(s)-type algebraic relations for constant-coefficient cases, recovering the integrating-factor result as a special case and extending naturally to higher-order and coupled systems.

Numerical ODE solvers. Implicit and exponential integrators used in stiff ODE solvers (e.g. exponential Euler methods) are direct numerical descendants of the exact integrating-factor formula, using e∫pe^{\int p}-type factors to stabilize step sizes for stiff linear parts of a system.

Ask the tutor: How does the integrating-factor method change if p(t)p(t) and g(t)g(t) are replaced by matrices and vectors in a linear system x′=A(t)x+b(t)\mathbf{x}' = A(t)\mathbf{x} + \mathbf{b}(t)?

DefinitionLinear First-Order Differential Equation

A linear first-order ordinary differential equation is an equation of the form

dydt+p(t) y=g(t),\frac{dy}{dt} + p(t)\,y = g(t),

where pp and gg are given functions of tt (the coefficient and the forcing term, respectively), and y=y(t)y = y(t) is the unknown function. The equation is called linear because the left-hand side is a linear combination of yy and y′y' with coefficients depending only on tt — no terms like y2y^2, yy′y y', sin⁡y\sin y, or (y′)3(y')^3 appear. If g(t)≡0g(t) \equiv 0, the equation is called homogeneous; otherwise it is nonhomogeneous (or inhomogeneous). A function ϕ(t)\phi(t), differentiable on an interval II, is a solution on II if ϕ′(t)+p(t)ϕ(t)=g(t)\phi'(t) + p(t)\phi(t) = g(t) holds for every t∈It \in I. An integrating factor for this equation is a function μ(t)≠0\mu(t) \neq 0 such that

μ(t)[y′+p(t)y]=ddt[μ(t)y]\mu(t)\bigl[y' + p(t) y\bigr] = \frac{d}{dt}\bigl[\mu(t) y\bigr]

identically in yy and y′y', i.e. μ\mu converts the left side into an exact derivative.

Intuition

Picture the equation y′+p(t)y=g(t)y' + p(t) y = g(t) as a rule assigning a slope to every point (t,y)(t,y) in the plane: the slope at (t,y)(t,y) is g(t)−p(t)yg(t) - p(t) y. A solution curve is a curve that, at every one of its points, has exactly the slope prescribed there — it "follows the arrows" of this slope field. Because the slope depends on yy linearly, the slope field has a rigid, orderly structure: along any vertical line t=t0t = t_0, the slope is an affine (linear) function of yy, so the arrows tilt in a single consistent way as yy increases, never folding back on themselves. This rigidity is exactly why a closed-form solution exists for every choice of continuous pp and gg, unlike general nonlinear equations. The integrating factor μ(t)=e∫p(t) dt\mu(t) = e^{\int p(t)\,dt} can be understood as a reweighting of the unknown. Instead of tracking y(t)y(t) directly, track the auxiliary quantity μ(t)y(t)\mu(t) y(t). The differential equation, written in terms of this new quantity, becomes trivial: its derivative is just μ(t)g(t)\mu(t) g(t), a known function of tt alone. Antidifferentiating recovers μy\mu y, and dividing by μ\mu recovers yy. The whole solution process is: multiply, recognize a product rule in reverse, integrate, divide.

Figure
Slope field for y′+y=ty' + y = t (so p(t)=1p(t)=1, g(t)=tg(t)=t), with the solution through (0,1)(0,1)
t y 0 (0, 1) y = t − 1 + 2e^(−t)

The theorem

TheoremExistence, Uniqueness, and Solution Formula for Linear First-Order Equations

Let p(t)p(t) and g(t)g(t) be continuous functions on an open interval II, and let t0∈It_0 \in I and y0∈Ry_0 \in \mathbb{R} be given. Then the initial value problem

y′+p(t)y=g(t),y(t0)=y0y' + p(t) y = g(t), \qquad y(t_0) = y_0

has one and only one solution y=ϕ(t)y = \phi(t) defined on the entire interval II. It is given explicitly by

ϕ(t)=1μ(t)[y0μ(t0)+∫t0tμ(s)g(s) ds],where μ(t)=exp⁡ ⁣(∫t0tp(s) ds).\phi(t) = \frac{1}{\mu(t)}\left[ y_0 \mu(t_0) + \int_{t_0}^{t} \mu(s) g(s)\, ds \right], \qquad \text{where } \mu(t) = \exp\!\left(\int_{t_0}^{t} p(s)\,ds\right).

Equivalently, writing ∫p(t) dt\int p(t)\,dt for any fixed antiderivative of pp and μ(t)=e∫p(t) dt\mu(t) = e^{\int p(t)\,dt}, the general solution of y′+p(t)y=g(t)y' + p(t)y = g(t) on II is

y(t)=1μ(t)∫μ(t)g(t) dt+Cμ(t),C∈R arbitrary,y(t) = \frac{1}{\mu(t)} \int \mu(t) g(t)\, dt + \frac{C}{\mu(t)}, \qquad C \in \mathbb{R} \text{ arbitrary},

and every solution on II arises from exactly one value of CC.

Proof

Technique. Direct construction via an integrating factor, followed by a uniqueness argument using the Fundamental Theorem of Calculus. This is a completely self-contained argument; it invokes only Separable Equations-style integration and basic calculus, not any later machinery.

Step 1: Existence of the integrating factor. Since pp is continuous on II, it has an antiderivative on II; fix one and call it P(t)=∫t0tp(s) dsP(t) = \int_{t_0}^t p(s)\,ds, so P′(t)=p(t)P'(t) = p(t) for all t∈It \in I (this uses the Fundamental Theorem of Calculus, valid because pp is continuous). Define

μ(t)=eP(t).\mu(t) = e^{P(t)}.

Since μ\mu is a composition of the exponential function with a differentiable function, μ\mu is differentiable on II, and by the chain rule,

μ′(t)=P′(t)eP(t)=p(t)μ(t).\mu'(t) = P'(t) e^{P(t)} = p(t)\mu(t).

Also μ(t)=eP(t)>0\mu(t) = e^{P(t)} > 0 for every tt, since the exponential function is everywhere positive. In particular μ(t)≠0\mu(t) \neq 0 on II, so division by μ(t)\mu(t) is always legitimate.

Step 2: μ\mu collapses the left side into a derivative. Suppose y=ϕ(t)y = \phi(t) is any differentiable function on II. Consider the product μ(t)ϕ(t)\mu(t)\phi(t). By the product rule,

ddt[μ(t)ϕ(t)]=μ′(t)ϕ(t)+μ(t)ϕ′(t)=p(t)μ(t)ϕ(t)+μ(t)ϕ′(t)=μ(t)[ϕ′(t)+p(t)ϕ(t)].\frac{d}{dt}\bigl[\mu(t)\phi(t)\bigr] = \mu'(t)\phi(t) + \mu(t)\phi'(t) = p(t)\mu(t)\phi(t) + \mu(t)\phi'(t) = \mu(t)\bigl[\phi'(t) + p(t)\phi(t)\bigr].

Hence for any differentiable function ϕ\phi,

μ(t)[ϕ′(t)+p(t)ϕ(t)]=ddt[μ(t)ϕ(t)].(∗)\mu(t)\bigl[\phi'(t) + p(t)\phi(t)\bigr] = \frac{d}{dt}\bigl[\mu(t)\phi(t)\bigr]. \tag{$\ast$}

This confirms μ\mu is an integrating factor in the sense of the definition: it converts y′+p(t)yy' + p(t)y into an exact derivative (μy)′(\mu y)', for every candidate yy, before we have even assumed ϕ\phi solves anything.

Step 3: Reduction of the ODE to a quadrature. Suppose ϕ\phi solves y′+p(t)y=g(t)y' + p(t)y = g(t) on II. Multiplying both sides of the equation by μ(t)\mu(t) (legitimate, since this is an equality of functions and μ(t)\mu(t) is a specific nonzero number at each tt) gives

μ(t)[ϕ′(t)+p(t)ϕ(t)]=μ(t)g(t).\mu(t)\bigl[\phi'(t) + p(t)\phi(t)\bigr] = \mu(t) g(t).

By (∗)(\ast), the left side equals ddt[μ(t)ϕ(t)]\frac{d}{dt}[\mu(t)\phi(t)]. So

ddt[μ(t)ϕ(t)]=μ(t)g(t)for all t∈I.\frac{d}{dt}\bigl[\mu(t)\phi(t)\bigr] = \mu(t)g(t) \quad \text{for all } t \in I.

The right-hand side, μ(t)g(t)\mu(t)g(t), is continuous on II because μ\mu and gg are both continuous there (μ\mu is even C1C^1, gg is given continuous). By the Fundamental Theorem of Calculus, integrating both sides from t0t_0 to tt (both in II, and II is an interval so the segment between them lies in II) gives

μ(t)ϕ(t)−μ(t0)ϕ(t0)=∫t0tμ(s)g(s) ds.\mu(t)\phi(t) - \mu(t_0)\phi(t_0) = \int_{t_0}^t \mu(s) g(s)\, ds.

Imposing ϕ(t0)=y0\phi(t_0) = y_0 and solving for ϕ(t)\phi(t) (dividing by μ(t)≠0\mu(t) \neq 0, Step 1) yields exactly the claimed formula

ϕ(t)=1μ(t)[y0μ(t0)+∫t0tμ(s)g(s) ds].(†)\phi(t) = \frac{1}{\mu(t)}\left[ y_0 \mu(t_0) + \int_{t_0}^t \mu(s)g(s)\,ds \right]. \tag{$\dagger$}

This shows: if a solution to the IVP exists on II, it must be given by (†)(\dagger). This proves uniqueness, granting existence.

Step 4: Existence — verify (†)(\dagger) actually solves the IVP. We must check the converse: that the function ϕ\phi defined by formula (†)(\dagger) really does satisfy the differential equation and the initial condition, not merely that it is forced by the algebra above. Define ϕ\phi by (†)(\dagger). First,

ϕ(t0)=1μ(t0)[y0μ(t0)+∫t0t0μ(s)g(s) ds]=1μ(t0)[y0μ(t0)+0]=y0,\phi(t_0) = \frac{1}{\mu(t_0)}\Big[y_0\mu(t_0) + \int_{t_0}^{t_0}\mu(s)g(s)\,ds\Big] = \frac{1}{\mu(t_0)}\big[y_0 \mu(t_0) + 0\big] = y_0,

using that an integral from t0t_0 to t0t_0 is zero. This verifies the initial condition. Next, differentiate (†)(\dagger). Write ϕ(t)=μ(t)−1[A+F(t)]\phi(t) = \mu(t)^{-1}\left[A + F(t)\right] where A=y0μ(t0)A = y_0\mu(t_0) is a constant and F(t)=∫t0tμ(s)g(s) dsF(t) = \int_{t_0}^t \mu(s)g(s)\,ds. Since μ(s)g(s)\mu(s)g(s) is continuous on II, the Fundamental Theorem of Calculus gives F′(t)=μ(t)g(t)F'(t) = \mu(t)g(t), and FF is differentiable (hence continuous) on II. Since μ\mu is differentiable and nowhere zero on II, μ−1\mu^{-1} is differentiable, with ddtμ(t)−1=−μ(t)−2μ′(t)=−μ(t)−2p(t)μ(t)=−p(t)μ(t)−1\frac{d}{dt}\mu(t)^{-1} = -\mu(t)^{-2}\mu'(t) = -\mu(t)^{-2}p(t)\mu(t) = -p(t)\mu(t)^{-1}. By the product rule,

ϕ′(t)=−p(t)μ(t)−1[A+F(t)]+μ(t)−1F′(t)=−p(t)ϕ(t)+μ(t)−1μ(t)g(t)=−p(t)ϕ(t)+g(t).\phi'(t) = -p(t)\mu(t)^{-1}\big[A+F(t)\big] + \mu(t)^{-1} F'(t) = -p(t)\phi(t) + \mu(t)^{-1}\mu(t)g(t) = -p(t)\phi(t) + g(t).

Rearranging, ϕ′(t)+p(t)ϕ(t)=g(t)\phi'(t) + p(t)\phi(t) = g(t) for every t∈It \in I. So ϕ\phi genuinely solves the differential equation on all of II, and combined with ϕ(t0)=y0\phi(t_0)=y_0, ϕ\phi solves the IVP on all of II.

Step 5: Uniqueness, restated. Step 3 showed any solution on II must coincide with the specific function (†)(\dagger) (the algebra in Step 3 used only that ϕ\phi solves the equation and satisfies ϕ(t0)=y0\phi(t_0)=y_0, and every step there was a reversible algebraic/integration manipulation forcing a unique output). Step 4 showed that function indeed solves the IVP. Hence the solution exists and is unique on all of II.

Step 6: General solution formula. Two antiderivatives of pp differ by a constant, so any two choices of integrating factor e∫p dte^{\int p\,dt} differ by a positive multiplicative constant, which does not affect the ratio μ(t)−1∫μ(t)g(t) dt\mu(t)^{-1}\int \mu(t)g(t)\,dt up to an additive constant of integration. Concretely, from (μy)′=μg(\mu y)' = \mu g, integrating without fixed limits gives μ(t)y(t)=∫μ(t)g(t) dt+C\mu(t) y(t) = \int \mu(t) g(t)\, dt + C for an arbitrary constant C∈RC \in \mathbb{R} (this is exactly the general antiderivative, again by the Fundamental Theorem of Calculus, since μg\mu g is continuous), so

y(t)=1μ(t)∫μ(t)g(t) dt+Cμ(t).y(t) = \frac{1}{\mu(t)}\int \mu(t) g(t)\,dt + \frac{C}{\mu(t)}.

Every choice of CC gives a solution by the same verification as Step 4 (with AA replaced by CC), and every solution corresponds to exactly one CC, namely C=μ(t0)y(t0)−∫t0tμ(s)g(s)ds∣t=t0C = \mu(t_0)y(t_0) - \int_{t_0}^{t}\mu(s)g(s)ds|_{t=t_0}-type matching to any one data point, by the uniqueness in Step 5. This proves the general-solution claim. ■\blacksquare

∎
CorollaryHomogeneous case

If g(t)≡0g(t) \equiv 0 on II and pp is continuous on II, the unique solution of y′+p(t)y=0y' + p(t)y=0, y(t0)=y0y(t_0)=y_0, is

y(t)=y0exp⁡(−∫t0tp(s) ds).y(t) = y_0 \exp\left(-\int_{t_0}^t p(s)\,ds\right).

In particular the only solution vanishing at some point of II is the identically zero solution — a fact used repeatedly when arguing two solutions of a nonhomogeneous linear equation differ by a multiple of the homogeneous solution.

Worked examples

Example 1 (variable coefficient, nonzero forcing, nonzero initial time). Solve

ty′−2y=t5sin⁡(3t),y(π)=0,t>0.t y' - 2y = t^5 \sin(3t), \qquad y(\pi) = 0, \qquad t > 0.

Step 1 — standardize. Divide by tt (valid since t>0t>0):

y′−2ty=t4sin⁡(3t).y' - \frac{2}{t} y = t^4 \sin(3t).

So p(t)=−2/tp(t) = -2/t, g(t)=t4sin⁡(3t)g(t) = t^4\sin(3t), both continuous on I=(0,∞)I=(0,\infty), which contains t0=πt_0=\pi. Step 2 — integrating factor.

∫p(t) dt=∫−2t dt=−2ln⁡t(t>0),\int p(t)\,dt = \int -\frac{2}{t}\,dt = -2\ln t \quad (t>0),

so take

μ(t)=e−2ln⁡t=t−2.\mu(t) = e^{-2\ln t} = t^{-2}.

Check: μ′=−2t−3=p(t)μ(t)=(−2/t)(t−2)\mu' = -2t^{-3} = p(t)\mu(t) = (-2/t)(t^{-2}). ✓. Step 3 — multiply through.

t−2y′−2t−3y=t−2⋅t4sin⁡(3t)=t2sin⁡(3t),t^{-2} y' - 2t^{-3} y = t^{-2}\cdot t^4 \sin(3t) = t^2 \sin(3t),

and the left side is ddt[t−2y]\dfrac{d}{dt}\left[t^{-2} y\right] by construction. Step 4 — integrate. We need ∫t2sin⁡(3t) dt\int t^2 \sin(3t)\,dt. Integrate by parts twice. First: let u=t2u=t^2, dv=sin⁡(3t) dtdv = \sin(3t)\,dt, so du=2t dtdu = 2t\,dt, v=−13cos⁡(3t)v = -\tfrac13\cos(3t):

∫t2sin⁡(3t) dt=−t23cos⁡(3t)+23∫tcos⁡(3t) dt.\int t^2\sin(3t)\,dt = -\frac{t^2}{3}\cos(3t) + \frac{2}{3}\int t\cos(3t)\,dt.

Second, on ∫tcos⁡(3t) dt\int t\cos(3t)\,dt: let u=tu=t, dv=cos⁡(3t)dtdv=\cos(3t)dt, du=dtdu=dt, v=13sin⁡(3t)v=\tfrac13\sin(3t):

∫tcos⁡(3t) dt=t3sin⁡(3t)−13∫sin⁡(3t) dt=t3sin⁡(3t)+19cos⁡(3t).\int t\cos(3t)\,dt = \frac{t}{3}\sin(3t) - \frac13\int \sin(3t)\,dt = \frac{t}{3}\sin(3t) + \frac{1}{9}\cos(3t).

Combine:

∫t2sin⁡(3t) dt=−t23cos⁡(3t)+23[t3sin⁡(3t)+19cos⁡(3t)]+C=−t23cos⁡(3t)+2t9sin⁡(3t)+227cos⁡(3t)+C.\int t^2\sin(3t)\,dt = -\frac{t^2}{3}\cos(3t) + \frac{2}{3}\left[\frac{t}{3}\sin(3t) + \frac19\cos(3t)\right] + C = -\frac{t^2}{3}\cos(3t) + \frac{2t}{9}\sin(3t) + \frac{2}{27}\cos(3t) + C.

So

t−2y=−t23cos⁡(3t)+2t9sin⁡(3t)+227cos⁡(3t)+C.t^{-2} y = -\frac{t^2}{3}\cos(3t) + \frac{2t}{9}\sin(3t) + \frac{2}{27}\cos(3t) + C.

Step 5 — solve for yy.

y(t)=−t43cos⁡(3t)+2t39sin⁡(3t)+2t227cos⁡(3t)+Ct2.y(t) = -\frac{t^4}{3}\cos(3t) + \frac{2t^3}{9}\sin(3t) + \frac{2t^2}{27}\cos(3t) + C t^2.

Step 6 — impose y(π)=0y(\pi)=0. Since 3π3\pi has cos⁡(3π)=cos⁡(π)=−1\cos(3\pi) = \cos(\pi) = -1 (as 3π=π+2π3\pi = \pi + 2\pi, cosine period 2π2\pi) and sin⁡(3π)=0\sin(3\pi)=0:

0=−π43(−1)+2π39(0)+2π227(−1)+Cπ2=π43−2π227+Cπ2.0 = -\frac{\pi^4}{3}(-1) + \frac{2\pi^3}{9}(0) + \frac{2\pi^2}{27}(-1) + C\pi^2 = \frac{\pi^4}{3} - \frac{2\pi^2}{27} + C\pi^2.

Solve for CC:

Cπ2=2π227−π43⟹C=227−π23.C\pi^2 = \frac{2\pi^2}{27} - \frac{\pi^4}{3} \quad\Longrightarrow\quad C = \frac{2}{27} - \frac{\pi^2}{3}.

Final answer.

y(t)=−t43cos⁡(3t)+2t39sin⁡(3t)+2t227cos⁡(3t)+(227−π23)t2,t>0.y(t) = -\frac{t^4}{3}\cos(3t) + \frac{2t^3}{9}\sin(3t) + \frac{2t^2}{27}\cos(3t) + \left(\frac{2}{27} - \frac{\pi^2}{3}\right) t^2, \qquad t>0.

This solution is valid and unique on the entire interval (0,∞)(0,\infty) by the theorem, since p,gp,g are continuous there.

Example 2 (mixing problem — a genuine modeling application). A 200-liter tank initially contains 40 kg of dissolved salt in 100 liters of brine. Starting at t=0t=0, brine containing 0.5 kg/L0.5\,\text{kg/L} of salt flows in at 5 L/min5\,\text{L/min}, while the well-mixed solution drains out at only 3 L/min3\,\text{L/min} (so the tank fills up over time). Find the amount of salt Q(t)Q(t) (in kg) for 0≤t<500 \le t < 50 (the tank overflows at t=50t=50, since it gains 2 L/min net and starts at 100 L, filling the remaining 100 L in 50 min). Setting up the equation. Volume in the tank at time tt: inflow rate 55 L/min, outflow rate 33 L/min, so net rate +2+2 L/min, giving

V(t)=100+2tliters.V(t) = 100 + 2t \quad \text{liters}.

Salt balance: rate in minus rate out.

rate in=5⋅0.5=2.5 kg/min (constant),\text{rate in} = 5 \cdot 0.5 = 2.5 \ \text{kg/min (constant)},
rate out=3⋅Q(t)V(t)=3Q100+2t kg/min,\text{rate out} = 3 \cdot \frac{Q(t)}{V(t)} = \frac{3Q}{100+2t} \ \text{kg/min},

since the outflow concentration equals the tank's current concentration Q/VQ/V (well-mixed assumption). So

Q′(t)=2.5−3Q100+2t,Q(0)=40.Q'(t) = 2.5 - \frac{3Q}{100+2t}, \qquad Q(0) = 40.

Rearrange to standard linear form:

Q′+3100+2tQ=2.5.Q' + \frac{3}{100+2t} Q = 2.5.

Here p(t)=3100+2tp(t) = \dfrac{3}{100+2t} and g(t)=2.5g(t) = 2.5, both continuous on [0,50)[0,50) (the denominator 100+2t≥100>0100+2t \ge 100 > 0 throughout), so the theorem applies with I=[0,50)I = [0,50) extended to an open interval containing it, and t0=0t_0 = 0. Integrating factor.

∫p(t) dt=∫3100+2t dt=32ln⁡(100+2t)(since 100+2t>0),\int p(t)\,dt = \int \frac{3}{100+2t}\,dt = \frac{3}{2}\ln(100+2t) \quad (\text{since } 100+2t>0),

so

μ(t)=e32ln⁡(100+2t)=(100+2t)3/2.\mu(t) = e^{\frac32 \ln(100+2t)} = (100+2t)^{3/2}.

Multiply through and integrate.

ddt[(100+2t)3/2Q]=2.5 (100+2t)3/2.\frac{d}{dt}\left[(100+2t)^{3/2} Q\right] = 2.5\,(100+2t)^{3/2}.

Integrate the right side using the substitution u=100+2tu = 100+2t, du=2 dtdu = 2\,dt:

∫2.5(100+2t)3/2 dt=2.5⋅12∫u3/2 du=1.25⋅25u5/2+C=12u5/2+C=12(100+2t)5/2+C.\int 2.5(100+2t)^{3/2}\,dt = 2.5 \cdot \frac{1}{2}\int u^{3/2}\,du = 1.25 \cdot \frac{2}{5} u^{5/2} + C = \frac12 u^{5/2} + C = \frac12 (100+2t)^{5/2} + C.

So

(100+2t)3/2Q(t)=12(100+2t)5/2+C,(100+2t)^{3/2} Q(t) = \frac12 (100+2t)^{5/2} + C,
Q(t)=12(100+2t)+C(100+2t)−3/2.Q(t) = \frac12(100+2t) + C(100+2t)^{-3/2}.

Apply the initial condition Q(0)=40Q(0)=40.

40=12(100)+C(100)−3/2=50+C1000,40 = \frac12(100) + C(100)^{-3/2} = 50 + \frac{C}{1000},
C=1000(40−50)=−10000.C = 1000(40-50) = -10000.

Final answer.

Q(t)=12(100+2t)−10000(100+2t)3/2=(50+t)−10000(100+2t)3/2,0≤t<50.\boxed{Q(t) = \frac12(100+2t) - \frac{10000}{(100+2t)^{3/2}} = (50+t) - \frac{10000}{(100+2t)^{3/2}}}, \qquad 0 \le t < 50.

Sanity checks: at t=0t=0, Q(0)=50−10000/1000=50−10=40Q(0) = 50 - 10000/1000 = 50-10 = 40 ✓, matching the given initial condition. As t→∞t\to\infty (formally, ignoring the overflow constraint), Q(t)≈50+tQ(t) \approx 50+t while the equilibrium concentration 2.5/3⋅V(t)2.5/3 \cdot V(t)-type behavior is approached; the correction term 10000(100+2t)−3/2→010000(100+2t)^{-3/2} \to 0, so the solution is asymptotic to 50+t50+t, i.e. concentration Q/V→(50+t)/(100+2t)→1/2=0.5Q/V \to (50+t)/(100+2t) \to 1/2 = 0.5 kg/L, matching the inflow concentration — exactly the physically expected long-run behavior since outflow becomes a vanishing fraction of the ever-larger tank relative to a constant inflow rate of pure input concentration. This qualitative check confirms the algebra.

CounterexampleWhy continuity of pp cannot be dropped

The theorem requires pp (and gg) to be continuous on an interval containing t0t_0. Drop this and both existence and uniqueness can fail on any interval straddling the discontinuity. Consider

ty′−2y=0⟺y′−2ty=0,t y' - 2y = 0 \quad \Longleftrightarrow \quad y' - \frac{2}{t} y = 0,

so p(t)=−2/tp(t) = -2/t, which is not continuous at t=0t=0 — it is not even defined there. Try to solve the IVP y(0)=0y(0) = 0 on the interval I=(−1,1)I = (-1,1), which contains the discontinuity at t=0t=0. Direct substitution shows y(t)=Ct2y(t) = C t^2 solves ty′−2y=C(2t2)−2Ct2=0ty'-2y = C(2t^2) - 2Ct^2=0 for every constant CC, and every one of these satisfies y(0)=0y(0)=0. So the IVP y(0)=0y(0)=0 has infinitely many solutions on (−1,1)(-1,1) — uniqueness fails completely. Worse, try the IVP y(0)=1y(0)=1 on the same interval. If y=Ct2y=Ct^2 then y(0)=0≠1y(0)=0 \ne 1 for every CC, and one can show no differentiable function satisfies both the ODE and y(0)=1y(0)=1 on an interval containing 00: near t=0t=0 the equation forces y(t)/t2→y(t)/t^2 \to finite behavior incompatible with y(0)=1≠0y(0)=1\ne0 while y′−2ty=0y'-\tfrac2t y=0 forces y(t)=Ct2y(t) = Ct^2 for t≠0t\ne 0 by the corollary applied separately on (0,1)(0,1) and (−1,0)(-1,0), and any such piecewise solution is forced to vanish at t=0t=0 if continuous there. So existence fails for this data. This is precisely because p(t)=−2/tp(t) = -2/t blows up at t0=0t_0=0: the interval of continuity for pp is really (0,∞)(0,\infty) or (−∞,0)(-\infty,0), never an interval containing 00. The theorem's guarantee — existence and uniqueness on the whole interval II — is only as strong as the interval on which p,gp,g are continuous, and one must never apply the formula across a singularity of pp.

Scope, edge cases & common traps

SituationWhat happens
p,gp, g continuous on all of R\mathbb{R}Solution exists and is unique for all t∈Rt \in \mathbb{R}; no finite escape time (linear equations with everywhere-continuous coefficients never blow up in finite time).
pp has a discontinuity (e.g. jump, pole) at t=at=aSolve separately on each maximal interval of continuity not containing aa; matching solutions across aa requires extra physical/continuity conditions, and uniqueness across aa can fail (see counterexample).
gg piecewise continuous (e.g. a switched forcing)Solve on each piece, then match values at the switch point to fix constants — standard in circuits with a switch closing at t=t1t=t_1.
Forgetting CCThe homogeneous solution Ce−∫p dtCe^{-\int p\,dt} must be retained; omitting it silently discards the entire one-parameter family of solutions and violates the initial condition in general.
Sign error in ∫p dt\int p\,dtμ(t)=e∫p dt\mu(t) = e^{\int p\,dt}, not e−∫p dte^{-\int p\,dt}; the sign is easy to flip and instantly breaks (∗)(\ast) in the proof.
Dividing by tt (or another vanishing factor) to reach standard formValid only away from the zero; changes the natural domain of the problem — always re-state the interval II after this step.

The mathematician behind it

Origins · 1 minGottfried Wilhelm Leibniz and how this was discovered
GW
Gottfried Wilhelm Leibniz
1646–1716 · Co-inventor of calculus, Hanover

Leibniz developed the calculus notation and many of its early techniques, including the method for solving linear first-order differential equations by an integrating factor, in correspondence and papers during the 1690s. Working alongside Jacob and Johann Bernoulli on a flood of new differential equations arising from mechanics and geometry, Leibniz recognized that multiplying an equation by a well-chosen factor could reduce it to something directly integrable — the germinal idea behind essentially all of the elementary solution techniques that followed, including separation of variables and, much later, the systematic linear theory built on matrix exponentials and transforms.

History
- 1675–1676: Leibniz develops the fundamental notation and rules of calculus, including ∫\int and dd.
- 1691: Leibniz publishes a general method for solving what we now call linear first-order ODEs, using an integrating factor.
- 1694–1697: The Bernoulli brothers extend these methods, including to the nonlinear Bernoulli equation, reducible to the linear case by substitution.
- 1743: Leonhard Euler formalizes and generalizes integrating-factor and exact-equation techniques in his systematic treatment of differential equations.
- 1800s: The theory is subsumed into the broader existence-uniqueness framework (Picard–Lindelöf) and, later, into linear systems theory and transform methods.
Why is the equation called "linear" if g(t)g(t) can be a wild nonlinear function of tt?

"Linear" refers strictly to how the unknown yy and its derivative y′y' enter the equation, not to how the independent variable tt enters. The left side y′+p(t)yy' + p(t)y is a linear (degree-one, no products) combination of yy and y′y'; the coefficients p(t)p(t) and the forcing term g(t)g(t) can be arbitrarily nonlinear or even non-elementary functions of tt alone, and this does not affect linearity in yy. This distinction matters because linearity in yy is exactly what makes superposition, the integrating-factor trick, and closed-form solvability possible — none of that requires gg or pp to be simple functions of tt.

What if I cannot compute ∫p(t) dt\int p(t)\,dt or ∫μ(t)g(t) dt\int \mu(t) g(t)\,dt in closed form?

The theorem guarantees existence and uniqueness regardless of whether the integrals are elementary; the formula ϕ(t)=μ(t)−1[y0μ(t0)+∫t0tμ(s)g(s) ds]\phi(t) = \mu(t)^{-1}[y_0\mu(t_0) + \int_{t_0}^t \mu(s)g(s)\,ds] is a rigorous, exact representation of the solution even when the integrals must be left as definite integrals or evaluated numerically. This is common with equations like y′+ty=et2sin⁡ty' + ty = e^{t^2}\sin t: the solution is entirely legitimate and well-defined, just not expressible via elementary functions, and one reports it either as a definite integral or approximates it numerically.

How does this relate to separable equations?

Separable Equations are those where y′=f(t)h(y)y'=f(t)h(y) can be split as dy/h(y)=f(t) dtdy/h(y) = f(t)\,dt. A linear equation y′+p(t)y=g(t)y'+p(t)y=g(t) is separable only in the special homogeneous case g≡0g\equiv0, since then y′/y=−p(t)y'/y = -p(t) separates cleanly. Once g≢0g\not\equiv0, the equation is generically not separable — you cannot isolate all yy-dependence on one side — which is exactly why the integrating-factor method, a genuinely different technique, is needed for the nonhomogeneous case.

Does the integrating-factor method generalize beyond first order?

Yes, in spirit. For higher-order linear equations, the analogous tool is variation of parameters, which uses a fundamental set of homogeneous solutions in place of the single factor μ(t)\mu(t). For systems x′=A(t)x+b(t)\mathbf x' = A(t)\mathbf x + \mathbf b(t), the scalar μ(t)=e∫p dt\mu(t)=e^{\int p\,dt} generalizes to a matrix-valued fundamental solution Φ(t)\Phi(t), and the analogous formula x(t)=Φ(t)[x0+∫Φ(s)−1b(s) ds]\mathbf x(t) = \Phi(t)\left[\mathbf x_0 + \int \Phi(s)^{-1}\mathbf b(s)\,ds\right] holds under suitable hypotheses. The scalar case here is the base of that entire hierarchy.

Can p(t)p(t) or g(t)g(t) be complex-valued, or can tt range over an unbounded interval like [0,∞)[0,\infty)?

Yes to both. The proof only used continuity, the Fundamental Theorem of Calculus, and basic algebra, none of which require real-valuedness or a bounded interval; it goes through verbatim for complex-valued p,gp,g (interpreting the exponential via its complex power series) and for I=(a,∞)I=(a,\infty), (−∞,b)(-\infty,b), or all of R\mathbb R. This generality is exactly what is exploited later when linear equations with complex or oscillatory forcing (e.g. g(t)=eiωtg(t)=e^{i\omega t}) are solved via the same formula.

Is the integrating factor unique?

No — any positive constant multiple of μ(t)=e∫p dt\mu(t)=e^{\int p\,dt} is also a valid integrating factor, since constant multiples don't affect whether (∗)(\ast) holds (both sides simply get scaled by the same constant). What is unique, given the equation, is the family {Ce∫p dt:C≠0}\{Ce^{\int p\,dt} : C\neq 0\}; conventionally one fixes C=1C=1 (or, as in the theorem, picks the antiderivative vanishing at t0t_0) for simplicity, but the final solution y(t)y(t) that results is identical regardless of that choice.

What goes wrong if I try to apply this method to a genuinely nonlinear equation like y′+p(t)y2=g(t)y' + p(t)y^2 = g(t)?

The key identity (∗)(\ast) in the proof crucially used that yy and y′y' appear to the first power, so that μ(t)[y′+p(t)y]\mu(t)[y'+p(t)y] literally equals ddt[μ(t)y]\frac{d}{dt}[\mu(t)y] by the product rule. If y2y^2 replaces yy, no single multiplier μ(t)\mu(t) turns μ(t)[y′+p(t)y2]\mu(t)[y' + p(t)y^2] into an exact derivative of a simple product, because the product rule applied to μy\mu y produces a term linear in yy, not y2y^2. Such equations (e.g. the Bernoulli equation y′+p(t)y=g(t)yny'+p(t)y = g(t)y^n) require a nonlinear substitution, like v=y1−nv=y^{1-n}, to convert them into a linear equation first — a different, though related, technique building directly on this one.

Before this

Where this leads