First-Order Equations

Study Sheet

First-Order Equations

Separable equations and integrating factors

The Two Workhorse Methods

Tip
Separable: sort, then integrate
xy123456−2−11234
Slope field of y′=−ln⁡22yy' = -\tfrac{\ln 2}{2}y: the curve from 44 passes 22 at x=2x = 2 and 11 at x=4x = 4; the one from −2-2 halves too.

If dydx=g(x)h(y)\tfrac{dy}{dx} = g(x)h(y), move all yy’s left and xx’s right: dyh(y)=g(x) dx\tfrac{dy}{h(y)} = g(x)\,dx, integrate both sides, and solve for yy. The prototype y′=kyy' = ky gives exponential growth/decay y=y0ekxy = y_0e^{kx}, and half-life problems are the case k=−ln⁡2t1/2k = -\tfrac{\ln 2}{t_{1/2}}. For instance, a half-life of 22 gives k=−ln⁡22k = -\tfrac{\ln 2}{2}, and y=y0e−(ln⁡2)x/2=y0 2−x/2y = y_0e^{-(\ln 2)x/2} = y_0\,2^{-x/2}.

Why moving the differentials is legitimate: if y(x)y(x) is a solution, then y′(x)h(y(x))=g(x)\dfrac{y'(x)}{h(y(x))} = g(x) holds for every xx, and integrating both sides in xx turns the left side into ∫dyh(y)\int \frac{dy}{h(y)} by the substitution u=y(x)u = y(x) — the chain rule run backward. So every solution satisfies H(y)=G(x)+CH(y) = G(x) + C with H′=1hH' = \tfrac1h and G′=gG' = g, and the constant CC labels which curve you are on. The division needs h(y)≠0h(y) \ne 0: each root y∗y^* of hh is a constant solution y≡y∗y \equiv y^* that the division discards, and you add it back by hand.

Tip
Linear: multiply by the integrating factor

For y′+p(x)y=q(x)y' + p(x)y = q(x), multiply through by μ=e∫p dx\mu = e^{\int p\,dx}: the left side collapses to (μy)′(\mu y)' by design, and one integration finishes it. Example: y′+y=exy' + y = e^x with μ=ex\mu = e^x gives (exy)′=e2x(e^xy)' = e^{2x}, hence y=ex2+Ce−xy = \tfrac{e^x}{2} + Ce^{-x}.

Why μ\mu has that formula: we want the left side μy′+μp y\mu y' + \mu p\,y to be the derivative of the product μy\mu y, which is μy′+μ′y\mu y' + \mu' y. The two agree exactly when μ′=pμ\mu' = p\mu — a separable equation for μ\mu whose solution is μ=e∫p dx\mu = e^{\int p\,dx}. Any antiderivative will do: a different constant of integration only rescales μ\mu, and the rescaling cancels when you divide at the end.

Example
Always verify by plugging back

Claimed solution of y′=xyy' = xy, y(0)=2y(0)=2: y=2ex2/2y = 2e^{x^2/2}. Check: y′=2xex2/2=x⋅yy' = 2xe^{x^2/2} = x\cdot y ✓ and y(0)=2y(0) = 2 ✓ — a thirty-second check that catches most integration slips.

The check is decisive because it is the definition: a function is a solution exactly when substituting it makes the two sides agree for every xx and the initial value matches. It catches the typical slips. The tempting wrong answer y=ex2/2+1y = e^{x^2/2} + 1 (constant added instead of multiplied) has y′=xex2/2y' = xe^{x^2/2} but xy=xex2/2+xxy = xe^{x^2/2} + x; the two sides differ by xx, so it is not a solution.

Side note
Significance: the two methods cover most of nature

Radioactive dating, drug clearance, RC circuits, compound interest, and atmospheric pressure with altitude are all separable or linear first-order equations. Carbon-14 dating is literally the half-life computation of this topic applied to archaeology: measure the remaining fraction, invert ekte^{kt}.

Try it
Try it: triage then solve

Is y′=xyy' = \dfrac{x}{y} separable, linear, or both? Solve it with y(0)=2y(0) = 2.

Show the answer

Separable but not linear: the right side factors as x⋅1yx\cdot\tfrac1y, but yy sits in a denominator, so the equation cannot be written as y′+p(x)y=q(x)y' + p(x)y = q(x). Separate: y dy=x dxy\,dy = x\,dx. Integrate: y22=x22+C\tfrac{y^2}{2} = \tfrac{x^2}{2} + C, so y2=x2+2Cy^2 = x^2 + 2C. The data give 4=0+2C4 = 0 + 2C, so y2=x2+4y^2 = x^2 + 4. Take the positive root, because the curve passes through y(0)=2>0y(0) = 2 > 0 and can never reach y=0y = 0, where the equation is undefined: y=x2+4y = \sqrt{x^2 + 4}, defined for all xx. Verify: y′=xx2+4=xyy' = \dfrac{x}{\sqrt{x^2+4}} = \dfrac{x}{y} ✓ and y(0)=2y(0) = 2 ✓.

Separable Equations: Lost Solutions and Blow-Up

Tip
Where a solution lives

A solution of an initial-value problem is a function on an interval containing the initial point. Separation often produces a formula that breaks down somewhere — a vertical asymptote, the logarithm of zero, arctan⁡\arctan asked for a value it cannot take — and the solution lives only on the largest interval through the initial point on which the formula stays finite and differentiable. The constant solutions y≡y∗y \equiv y^*, one for each root of hh, are checked separately.

Nothing in y′=y2y' = y^2 looks dangerous, yet its solutions reach infinity at a finite xx. The slope is the square of the height, so the higher the curve, the faster it climbs, and climbing from 11 to ∞\infty costs only ∫1∞dyy2=1\int_1^\infty \frac{dy}{y^2} = 1 unit of xx. A linear equation y′+p(x)y=q(x)y' + p(x)y = q(x) with continuous pp and qq cannot do this — its solutions exist wherever pp and qq are continuous — so blow-up is a nonlinear effect, and the way to find it is to solve and look at where the formula fails.

Example
Worked: a solution that reaches infinity
xy−2−11−2−11234x = 1
Slope field of y′=y2y' = y^2: the solution through (0,1)(0, 1) escapes to infinity as x→1x \to 1; the faint curve starts at y(0)=−1y(0) = -1.

Solve y′=y2y' = y^2, y(0)=1y(0) = 1, and find where the solution exists.

Step 1 — separate. This divides by y2y^2, which is safe here because the initial value 1≠01 \ne 0 keeps us off the constant solution y≡0y \equiv 0: y−2 dy=dxy^{-2}\,dy = dx.

Step 2 — integrate both sides: −1y=x+C-\dfrac1y = x + C.

Step 3 — use the data now, while the constant is still visible: −1=0+C-1 = 0 + C, so C=−1C = -1 and −1y=x−1-\tfrac1y = x - 1, i.e. y=11−xy = \dfrac{1}{1 - x}.

Step 4 — the interval: the formula has a vertical asymptote at x=1x = 1. A solution is a continuous function through (0,1)(0, 1), so it lives on (−∞,1)(-\infty, 1) only; the branch of the same formula for x>1x > 1 is a different curve.

Step 5 — verify: y′=1(1−x)2=y2y' = \dfrac{1}{(1-x)^2} = y^2 ✓ and y(0)=1y(0) = 1 ✓.

Example
Worked: a tangent in disguise

Solve y′=2x(1+y2)y' = 2x(1 + y^2), y(0)=0y(0) = 0.

Step 1 — the right side factors as g(x)h(y)g(x)h(y) with g=2xg = 2x and h=1+y2h = 1 + y^2; since hh is never zero, there are no constant solutions to lose.

Step 2 — separate and integrate: ∫dy1+y2=∫2x dx\displaystyle\int\frac{dy}{1 + y^2} = \int 2x\,dx gives arctan⁡y=x2+C\arctan y = x^2 + C.

Step 3 — the data: arctan⁡0=0\arctan 0 = 0, so C=0C = 0.

Step 4 — solve for yy, which is where the interval appears: arctan⁡y\arctan y only takes values in (−π2,π2)\left(-\tfrac\pi2, \tfrac\pi2\right), so arctan⁡y=x2\arctan y = x^2 is possible only while x2<π2x^2 < \tfrac\pi2, and there y=tan⁡(x2)y = \tan(x^2).

Step 5 — the solution exists for ∣x∣<π/2≈1.2533|x| < \sqrt{\pi/2} \approx 1.2533 and tends to +∞+\infty at both ends.

Step 6 — verify: y′=2xsec⁡2(x2)=2x(1+tan⁡2(x2))=2x(1+y2)y' = 2x\sec^2(x^2) = 2x\left(1 + \tan^2(x^2)\right) = 2x(1 + y^2) ✓.

Side note
Where it goes wrong: dividing away the answer

Solve y′=y2y' = y^2 with y(0)=0y(0) = 0 by the same separation: −1y=x+C-\tfrac1y = x + C, and the data demand −10=C-\tfrac10 = C — no value of CC works. The conclusion “there is no solution” is false: y≡0y \equiv 0 satisfies y′=0=y2y' = 0 = y^2 and y(0)=0y(0) = 0. It was lost in the first step, where dividing by y2y^2 assumed y≠0y \ne 0. Before dividing by h(y)h(y), list the roots of hh; each is a constant solution, and one of them may be the answer.

Try it
Try it: solve, then find where the solution lives

Solve y′=e−ycos⁡xy' = e^{-y}\cos x with y(0)=0y(0) = 0, and give the largest interval containing 00 on which the solution exists.

Show the answer

Separate: ey dy=cos⁡x dxe^{y}\,dy = \cos x\,dx (no constant solutions are lost, since e−ye^{-y} is never 00). Integrate: ey=sin⁡x+Ce^{y} = \sin x + C; the data give 1=0+C1 = 0 + C. So ey=1+sin⁡xe^y = 1 + \sin x and y=ln⁡(1+sin⁡x)y = \ln(1 + \sin x). The logarithm needs 1+sin⁡x>01 + \sin x > 0, which fails only where sin⁡x=−1\sin x = -1; the nearest such points to 00 are x=−π2x = -\tfrac\pi2 and x=3π2x = \tfrac{3\pi}{2}. The solution lives on (−π2,3π2)\left(-\tfrac\pi2, \tfrac{3\pi}{2}\right) and plunges to −∞-\infty at both ends. Verify: y′=cos⁡x1+sin⁡xy' = \dfrac{\cos x}{1 + \sin x}, and e−ycos⁡x=cos⁡x1+sin⁡xe^{-y}\cos x = \dfrac{\cos x}{1 + \sin x} ✓.

Linear Equations with Variable Coefficients

Tip
Standard form first, then the factor

Before computing μ\mu, divide by the coefficient of y′y' so that the equation reads y′+p(x)y=q(x)y' + p(x)y = q(x). Then μ=e∫p dx\mu = e^{\int p\,dx}, (μy)′=μq(\mu y)' = \mu q, and

y=1μ(∫μq dx+C).y = \frac{1}{\mu}\left(\int \mu q\,dx + C\right).

The constant enters as Cμ\dfrac{C}{\mu}: every solution is one particular solution plus CC times the homogeneous solution 1μ=e−∫p dx\dfrac1\mu = e^{-\int p\,dx}.

The recipe μ=e∫p\mu = e^{\int p} came from matching μy′+μpy\mu y' + \mu p y against (μy)′=μy′+μ′y(\mu y)' = \mu y' + \mu' y, and that match has a bare μy′\mu y' in it, so it only works when y′y' has coefficient 11. The shape y=yp+Cμy = y_p + \tfrac{C}{\mu} also has a reason: the difference of two solutions solves z′+pz=0z' + pz = 0, whose solutions are exactly Ce−∫pCe^{-\int p}. When p>0p > 0 that homogeneous part decays, so solutions forget their starting values and merge onto one curve; when p<0p < 0 they spread apart.

Example
Worked: a variable-coefficient IVP

Solve xy′+2y=4x2xy' + 2y = 4x^2 for x>0x > 0, with y(1)=2y(1) = 2.

Step 1 — standard form: divide by xx (allowed, since x>0x > 0): y′+2x y=4xy' + \dfrac2x\,y = 4x, so p=2xp = \dfrac2x and q=4xq = 4x.

Step 2 — the factor: μ=e∫2/x dx=e2ln⁡x=x2\mu = e^{\int 2/x\,dx} = e^{2\ln x} = x^2.

Step 3 — multiply the standard form by x2x^2: x2y′+2xy=4x3x^2y' + 2xy = 4x^3, and the left side is (x2y)′(x^2y)' — confirm this with the product rule before going on, since it is the whole point of μ\mu.

Step 4 — integrate: x2y=x4+Cx^2y = x^4 + C, so y=x2+Cx2y = x^2 + \dfrac{C}{x^2}.

Step 5 — the data: 2=1+C2 = 1 + C, so C=1C = 1 and y=x2+1x2y = x^2 + \dfrac{1}{x^2}.

Step 6 — verify in the original form: xy′=x(2x−2x3)=2x2−2x2xy' = x\left(2x - \dfrac{2}{x^3}\right) = 2x^2 - \dfrac{2}{x^2} and 2y=2x2+2x22y = 2x^2 + \dfrac{2}{x^2}, which add to 4x24x^2 ✓.

Example
Worked: a factor with a Gaussian

Solve y′−2xy=xy' - 2xy = x, y(0)=0y(0) = 0.

Step 1 — the equation is already in standard form, with p=−2xp = -2x and q=xq = x.

Step 2 — the factor: μ=e∫−2x dx=e−x2\mu = e^{\int -2x\,dx} = e^{-x^2}.

Step 3 — multiply through: (e−x2y)′=xe−x2(e^{-x^2}y)' = xe^{-x^2}.

Step 4 — integrate with the substitution w=−x2w = -x^2, dw=−2x dxdw = -2x\,dx: ∫xe−x2dx=−12e−x2\int xe^{-x^2}dx = -\tfrac12e^{-x^2}, so e−x2y=−12e−x2+Ce^{-x^2}y = -\tfrac12e^{-x^2} + C and y=−12+Cex2y = -\tfrac12 + Ce^{x^2}.

Step 5 — the data: 0=−12+C0 = -\tfrac12 + C, so y=12(ex2−1)y = \tfrac12\left(e^{x^2} - 1\right).

Step 6 — verify: y′=xex2y' = xe^{x^2}, and 2xy+x=x(ex2−1)+x=xex22xy + x = x\left(e^{x^2} - 1\right) + x = xe^{x^2} ✓. Here p=−2x<0p = -2x < 0 for x>0x > 0, so the homogeneous part Cex2Ce^{x^2} grows: nearby solutions separate instead of merging.

Example
Worked: transient and steady state
xy12345678−11
Solutions of y′+y=sin⁡xy' + y = \sin x from y(0)=2y(0) = 2, 00 and −1.5-1.5 all merge onto the steady oscillation (dashed).

Solve y′+y=sin⁡xy' + y = \sin x, y(0)=0y(0) = 0, and describe what happens for large xx.

Step 1 — p=1p = 1, so μ=ex\mu = e^x and (exy)′=exsin⁡x(e^xy)' = e^x\sin x.

Step 2 — integrate by parts twice; the integral reappears with the opposite sign, and solving for it gives ∫exsin⁡x dx=12ex(sin⁡x−cos⁡x)\int e^x\sin x\,dx = \tfrac12e^x(\sin x - \cos x).

Step 3 — so exy=12ex(sin⁡x−cos⁡x)+Ce^xy = \tfrac12e^x(\sin x - \cos x) + C and y=12(sin⁡x−cos⁡x)+Ce−xy = \tfrac12(\sin x - \cos x) + Ce^{-x}.

Step 4 — the data: 0=−12+C0 = -\tfrac12 + C, so C=12C = \tfrac12 and y=12(sin⁡x−cos⁡x)+12e−xy = \tfrac12(\sin x - \cos x) + \tfrac12e^{-x}.

Step 5 — verify: y′=12(cos⁡x+sin⁡x)−12e−xy' = \tfrac12(\cos x + \sin x) - \tfrac12e^{-x}, and adding yy leaves sin⁡x\sin x ✓.

Step 6 — read it: the term Ce−xCe^{-x} (the transient) dies whatever CC is, so every solution settles onto the same steady oscillation 12(sin⁡x−cos⁡x)=22sin⁡ ⁣(x−π4)\tfrac12(\sin x - \cos x) = \tfrac{\sqrt2}{2}\sin\!\left(x - \tfrac\pi4\right), of amplitude 22≈0.707\tfrac{\sqrt2}{2} \approx 0.707, lagging the forcing by π4\tfrac\pi4.

Side note
Where it goes wrong: a factor built from the wrong p

For xy′+2y=4x2xy' + 2y = 4x^2, reading p=2p = 2 straight off the page gives μ=e2x\mu = e^{2x}. Multiplying the equation by it gives xe2xy′+2e2xyxe^{2x}y' + 2e^{2x}y on the left, but (e2xy)′=e2xy′+2e2xy(e^{2x}y)' = e^{2x}y' + 2e^{2x}y: the first terms differ by the factor xx, so the left side is not the derivative of μy\mu y and the method has nothing to integrate. The formula e∫pe^{\int p} assumes y′y' has coefficient 11; dividing by xx first gives p=2xp = \tfrac2x and μ=x2\mu = x^2.

Try it
Try it: standard form, factor, data

Solve xy′+y=3x2xy' + y = 3x^2 for x>0x > 0 with y(1)=2y(1) = 2.

Show the answer

Standard form: y′+1x y=3xy' + \dfrac1x\,y = 3x, so p=1xp = \tfrac1x and μ=eln⁡x=x\mu = e^{\ln x} = x. Multiplying back by xx gives (xy)′=3x2(xy)' = 3x^2 — the original left side xy′+yxy' + y was already the derivative (xy)′(xy)', which the method discovers for you. Integrate: xy=x3+Cxy = x^3 + C, so y=x2+Cxy = x^2 + \dfrac{C}{x}. Data: 2=1+C2 = 1 + C, so C=1C = 1 and y=x2+1xy = x^2 + \dfrac1x. Verify: xy′+y=x(2x−1x2)+x2+1x=3x2xy' + y = x\left(2x - \dfrac{1}{x^2}\right) + x^2 + \dfrac1x = 3x^2 ✓.

Proofs & Why It Matters

Tip
Proof: the integrating factor works

With μ=e∫p dx\mu = e^{\int p\,dx}, note μ′=pμ\mu' = p\mu (chain rule). Then (μy)′=μy′+μ′y=μ(y′+py)(\mu y)' = \mu y' + \mu'y = \mu\left(y' + py\right) — the product rule rebuilds the left side of y′+py=qy' + py = q exactly. So the equation becomes (μy)′=μq(\mu y)' = \mu q; integrate once and divide by μ\mu. The factor is engineered so the product rule does the collapsing. ■\blacksquare

Reminder — The differentiation rules:  (xn)′=nxn−1,(fg)′=f′g+fg′,(fg)′=f′g−fg′g2,(f(g(x)))′=f′(g(x))g′(x)(x^{n})'=nx^{n-1},\quad (fg)'=f'g+fg',\quad \left(\tfrac{f}{g}\right)'=\frac{f'g-fg'}{g^{2}},\quad \big(f(g(x))\big)'=f'(g(x))g'(x)
Tip
Proof: separation of variables is legitimate

If dydx=g(x)h(y)\tfrac{dy}{dx} = g(x)h(y) with h(y)≠0h(y) \ne 0, divide: y′(x)h(y(x))=g(x)\tfrac{y'(x)}{h(y(x))} = g(x). Integrate both sides in xx; on the left, substitute u=y(x)u = y(x), du=y′(x)dxdu = y'(x)dx (the chain rule in reverse): ∫duh(u)=∫g(x) dx\int\tfrac{du}{h(u)} = \int g(x)\,dx.

The informal "move the dydy" is shorthand for exactly this substitution — nothing illegal happens. ■\blacksquare

Tip
Proof: exponential solutions and half-life

y′=kyy' = ky separates to ∫dyy=∫k dx\int\tfrac{dy}{y} = \int k\,dx, so ln⁡∣y∣=kx+C\ln|y| = kx + C and y=y0ekxy = y_0e^{kx} — and this is the only solution: if zz also solves it, then (ze−kx)′=z′e−kx−kze−kx=0(z e^{-kx})' = z'e^{-kx} - kze^{-kx} = 0, so ze−kxze^{-kx} is constant. Setting y(t1/2)=y02y(t_{1/2}) = \tfrac{y_0}{2} gives ekt1/2=12e^{kt_{1/2}} = \tfrac12, i.e. k=−ln⁡2t1/2k = -\tfrac{\ln 2}{t_{1/2}}. ■\blacksquare

Going Deeper: Explanations & Worked Problems

Concept
Reading an equation: which method, and why

Given y′=(something)y' = (\text{something}), the triage is: can the right side be factored as g(x)h(y)g(x)h(y) — a pure-xx piece times a pure-yy piece? Then separate. Is it linear in yy — expressible as y′+p(x)y=q(x)y' + p(x)y = q(x) with yy appearing alone to the first power? Then integrating factor.

(y′=x−yy' = x - y hides its linearity until rearranged: y′+y=xy' + y = x.) Some equations are both (y′=kyy' = ky), many are neither — those go to slope fields, Euler, or substitutions. Two habits matter more than any method. First, track the constant from the moment you integrate: it lives inside the exponential as y=Cekxy = Ce^{kx}, not tacked on the end as ekx+Ce^{kx} + C — a wrong constant placement is the single most common first-order error. Second, plug the final answer back into the original equation; ten seconds of differentiation catches nearly everything.

Example
Worked: a separable IVP with the constant handled honestly

Solve y′=xyy' = xy with y(0)=2y(0) = 2.

Step 1 — separate: dyy=x dx\dfrac{dy}{y} = x\,dx (noting y≡0y \equiv 0 is a solution we are not on, since y(0)=2y(0) = 2).

Step 2 — integrate both sides: ln⁡∣y∣=x22+C\ln|y| = \tfrac{x^2}{2} + C.

Step 3 — exponentiate carefully: ∣y∣=eCex2/2|y| = e^Ce^{x^2/2}, and absorbing the sign into a new constant A=±eCA = \pm e^C: y=Aex2/2y = Ae^{x^2/2} — the constant is multiplicative.

Step 4 — apply the initial condition: 2=Ae0=A2 = Ae^0 = A, so y=2ex2/2y = 2e^{x^2/2}.

Step 5 — verify: y′=2xex2/2⋅1=x⋅yy' = 2xe^{x^2/2}\cdot 1 = x\cdot y ✓ and y(0)=2y(0) = 2 ✓. Watch what Step 3 prevented: writing y=ex2/2+Cy = e^{x^2/2} + C and "solving" C=1C = 1 gives a function that fails the original equation instantly.

Example
Worked: an integrating-factor IVP, start to finish

Solve y′+2y=6y' + 2y = 6 with y(0)=0y(0) = 0.

Step 1 — identify p=2p = 2, q=6q = 6; the factor is μ=e∫2 dx=e2x\mu = e^{\int 2\,dx} = e^{2x}.

Step 2 — multiply the whole equation: e2xy′+2e2xy=6e2xe^{2x}y' + 2e^{2x}y = 6e^{2x}, whose left side is exactly (e2xy)′(e^{2x}y)' — that collapse is guaranteed by the construction, so if it does not factor cleanly, recheck μ\mu.

Step 3 — integrate: e2xy=3e2x+Ce^{2x}y = 3e^{2x} + C.

Step 4 — solve: y=3+Ce−2xy = 3 + Ce^{-2x}; the condition y(0)=0y(0) = 0 gives C=−3C = -3, so y=3−3e−2xy = 3 - 3e^{-2x}.

Step 5 — verify and interpret: y′=6e−2xy' = 6e^{-2x} and y′+2y=6e−2x+6−6e−2x=6y' + 2y = 6e^{-2x} + 6 - 6e^{-2x} = 6 ✓; the solution climbs from 00 toward the equilibrium 33 (where y′=0y' = 0 forces 2y=62y = 6) — the phase-line picture and the formula telling one story.