Jugami Calculus

Jugami › Calculus › Differential Equations

Differential Equations

Know the slope everywhere, find the curve.

Most laws of nature do not tell you where something is. They tell you how fast it is changing: a population grows in proportion to its size, a hot drink cools in proportion to how much hotter it is than the room. An equation that links a function to its own derivative is a differential equation, and solving one means finding the function.

On this page: slope fields and Euler’s method with a graph you can tap, separable equations, growth and decay, half-life, Newton’s law of cooling, logistic growth, equilibria, six worked examples, nine practice problems and an eight-question quiz.

A slope field for the logistic equation y′ = y(1 − y/3): short grey segments show the slope at each point. Three blue solution curves, starting at y = 0.15, 0.6 and 4, all level off at the dashed gold line y = 3, the carrying capacity.y′ = y(1 − y/3)carrying capacity 3
Each short segment shows the slope y′ = y(1 − y/3) at that point. Solution curves follow the segments, and all of these level off at y = 3.

Section IWhat is a differential equation?

A differential equation is an equation involving an unknown function and its derivatives. The simplest kind is y′ = f(x): that is just antidifferentiation, so y = ∫ f(x) dx. More interesting ones involve y itself, such as y′ = 2y, which says “the rate of change is twice the current value.”

A solution is a function that makes the equation true. Check y = e2x: its derivative is 2e2x = 2y. So is y = Ce2x for any constant C: a differential equation usually has a whole family of solutions. An initial condition such as y(0) = 5 picks out one member, here C = 5. The order is the highest derivative that appears; everything on this page is first order.

Section IISlope fields and Euler’s method

For y′ = f(x, y) you can compute the slope of the solution at every point without solving anything. Draw a short segment with that slope at each point of a grid and you get a slope field. A solution curve is a curve that is tangent to the segments everywhere it goes.

Euler’s method turns that into arithmetic. From a starting point (x₀, y₀), walk a small step h along the current slope, then repeat:

yn+1 = yn + h · f(xn, yn),   xn+1 = xn + h

Each step uses the slope at its start, so the error builds up; halving h roughly halves the error. The smooth blue curve in the explorer uses the Runge–Kutta (RK4) method, which averages four slopes per step and is far more accurate for the same h.

Section IIISeparable equations

An equation is separable if it can be written dy/dx = g(x) h(y). Put every y on one side and every x on the other, then integrate both sides:

∫ 1 over h(y) dy = ∫ g(x) dx

Worked through for dy/dx = 2xy, y(0) = 3:

dy/y = 2x dxSeparate (assuming y ≠ 0)ln|y| = x² + CIntegrate both sidesy = Aex², with A = ±e^CExponentiatey = 3ex²y(0) = 3 gives A = 3

Two cautions. Dividing by h(y) loses any constant solution where h(y) = 0 (here y = 0), so check those separately. And solutions can blow up: y′ = y², y(0) = 1 gives y = 1/(1 − x), which shoots to infinity at x = 1 even though the equation looks harmless.

Section IVExponential growth and decay

If a quantity changes at a rate proportional to its size, y′ = ky. Separating gives

y = y₀ekt

with growth when k > 0 and decay when k < 0. The doubling time is ln 2 / k, and for decay written as y = y₀e−kt the half-life is ln 2 / k: after every half-life, half of what was left remains. Carbon-14, used to date ancient wood and bone, has a half-life of about 5,730 years.

Newton’s law of cooling says an object’s temperature T changes at a rate proportional to the difference from the surrounding temperature Ts:

dT/dt = −k(T − Ts),   so   T = Ts + (T₀ − Ts)e−kt

The difference decays exponentially, so a hot drink cools fast at first and then more and more slowly.

Section VLogistic growth

Real populations cannot grow exponentially for ever: food and space run out. The logistic equation slows growth as the population P approaches a carrying capacity K:

dP/dt = rP(1 − P/K)

When P is small the bracket is about 1 and growth is nearly exponential; as P nears K the bracket goes to 0. The equation is separable (using partial fractions), and its solution is the S-shaped logistic curve

P(t) = K over 1 + Ae−rt,   A = (K − P₀)/P₀

Growth is fastest at P = K/2, the steepest point of the S. Pick the logistic equation in the explorer above and start near 0 to see it.

Section VIEquilibria and stability, briefly

For an equation y′ = f(y), an equilibrium is a value where f(y) = 0: start there and you stay there for ever. It is stable if nearby solutions move towards it, and unstable if they move away. Read it from the sign of f: if f > 0 just below and f < 0 just above, solutions are squeezed in, so it is stable.

For the logistic equation, P = K is stable and P = 0 is unstable. For cooling, room temperature is stable. For y′ = y, y = 0 is unstable. The note under each equation in the explorer says which is which.

Section VIIWorked examples

Example 1: a separable equation

Solve dy/dx = −2xy with y(0) = 3.

dy/y = −2x dxSeparateln|y| = −x² + CIntegratey = 3e−x²y(0) = 3

✓ y′ = 3e−x² · (−2x) = −2xy.

Example 2: doubling bacteria

A culture of 500 bacteria doubles every 3 hours. How many are there after 10 hours?

P = 500 · 2t/3Doubling time 3 hoursP(10) = 500 · 210/3 ≈ 5,039.68Answer: about 5,040

✓ Equivalently k = ln 2/3 and P = 500e10k.

Example 3: carbon dating

A piece of wood has 30% of the carbon-14 it had when it was alive. Taking the half-life as 5,730 years, how old is it?

0.3 = (1/2)t/5730Fraction leftt = 5730 · ln(1/0.3) / ln 2Take logarithmst ≈ 9,953 yearsAnswer

✓ Between 1 half-life (50% left) and 2 half-lives (25% left), as it should be.

Example 4: Newton’s law of cooling

Soup at 80 °C is left in a 20 °C room and is 60 °C after 5 minutes. What is its temperature after 15 minutes?

T = 20 + 60e−ktT₀ − Tₛ = 60e−5k = 40/60 = 2/3Use the 5-minute readingT(15) = 20 + 60 · (2/3)³15 minutes is three 5-minute periodsT(15) ≈ 37.78 °CAnswer

✓ The difference from the room goes 60 → 40 → 26.7 → 17.8, shrinking by the same factor every 5 minutes.

Example 5: a logistic population

Fish in a lake follow P′ = 0.4P(1 − P/500) with P(0) = 50. Find P(5).

A = (500 − 50)/50 = 9Constant in the solutionP = 500/(1 + 9e−0.4t)Logistic solutionP(5) = 500/(1 + 9e−2) ≈ 225.43Answer: about 225 fish

✓ Still below K/2 = 250, so the population is still speeding up at t = 5.

Example 6: Euler’s method by hand

Use Euler’s method with h = 0.1 to estimate y(0.2) for y′ = x + y, y(0) = 1.

y₁ = 1 + 0.1 · (0 + 1) = 1.1Step 1 at x = 0y₂ = 1.1 + 0.1 · (0.1 + 1.1) = 1.22Step 2 at x = 0.1

✓ The exact solution is y = 2eˣ − x − 1, so y(0.2) ≈ 1.242806 and the error is about 0.022806.

Section VIIICommon mistakes

  • Forgetting + C. Add it when you integrate, then use the initial condition to find it.
  • Using C after exponentiating as if it were eC. ex² + C = Aex², not ex² + C.
  • Losing constant solutions when dividing by h(y).
  • Mixing up k. k = ln 2 ÷ half-life, not half-life ÷ ln 2.
  • Cooling to 0. The temperature approaches the room temperature, not zero.

Section IXPractice problems

Try each one on paper first, then open the answer to check your steps.

  1. Show that y = e2x is a solution of y′ = 2y. Checking

    Show answer and steps
    y′ = 2e2xDifferentiate2y = 2e2x = y′ ✓Substitute

    ✓ So is y = Ce2x for every constant C: one equation, a whole family of solutions.

  2. Solve dy/dx = xy with y(0) = 1. Separable

    Show answer and steps
    dy/y = x dxSeparateln|y| = x²/2 + CIntegrate both sidesy = ex²/2y(0) = 1 gives C = 0

    ✓ y(2) = e² ≈ 7.389056.

  3. Solve dy/dx = x/y with y(0) = 2. Separable

    Show answer and steps
    y dy = x dxSeparatey²/2 = x²/2 + CIntegratey² = x² + 4, so y = √(x² + 4)y(0) = 2 gives C = 2; take the positive root

    ✓ Check: y′ = x/√(x² + 4) = x/y.

  4. A substance has a half-life of 5 years. How much of an 80 g sample is left after 15 years? Half-life

    Show answer and steps
    15 years = 3 half-livesCount half-lives80 · (1/2)³ = 10 gAnswer

    ✓ With k = ln 2/5: 80e−15k = 80 · 2−3 = 10.

  5. A drug has a half-life of 10 hours. Find k in A = A₀e−kt. Decay constant

    Show answer and steps
    e−10k = 1/2Half is left after 10 hoursk = ln 2/10 ≈ 0.069315 per hourAnswer

    ✓ In general k = ln 2 ÷ half-life.

  6. Coffee at 90 °C sits in a 20 °C room and is 60 °C after 10 minutes. When does it reach 40 °C? Cooling

    Show answer and steps
    T − 20 = 70e−ktNewton’s law of cooling40/70 = e−10k, so k = ln(7/4)/10Use the 10-minute reading20/70 = e−kt, so t = 10 ln 3.5 / ln 1.75Solve for tt ≈ 22.386 minutesAnswer

    ✓ Cooling slows as the coffee nears room temperature: 30 degrees in the first 10 minutes, then 20 more in about 12.4.

  7. A population follows P′ = 0.5P(1 − P/1000) with P(0) = 100. When is it growing fastest? Logistic

    Show answer and steps
    P = 1000/(1 + 9e−0.5t)Logistic solution, A = (1000 − 100)/100 = 9Fastest at P = K/2 = 500, when 9e−0.5t = 1Midpoint of the S-curvet = 2 ln 9 ≈ 4.394449Answer

    ✓ P′ = 0.5 · 500 · ½ = 125 there, its largest value.

  8. Find the equilibria of y′ = y(y − 2) and say whether each is stable. Equilibria

    Show answer and steps
    y(y − 2) = 0 gives y = 0 and y = 2Set y′ = 0Below 0: y′ > 0; between: y′ < 0; above 2: y′ > 0Sign of y′y = 0 stable, y = 2 unstableAnswer

    ✓ Solutions near 0 are pushed towards it from both sides; near 2 they are pushed away.

  9. Use Euler’s method with h = 0.5 to estimate y(1) for y′ = y, y(0) = 1. Euler’s method

    Show answer and steps
    y₁ = 1 + 0.5 · 1 = 1.5Step 1y₂ = 1.5 + 0.5 · 1.5 = 2.25Step 2

    ✓ The exact value is e ≈ 2.718282, so the error is about 0.468282. Halving h roughly halves the error.

Section XSelf-guided quiz: eight quick questions

Choose one answer for each question, then press “Check my answers.” Your best score is saved only in this browser.

1. Which function solves y′ = 3y?
2. The equation y′ = ky with k < 0 describes:
3. A substance has a half-life of 4 hours. What fraction is left after 12 hours?
4. Newton’s law of cooling, with room temperature Tₛ, says dT/dt equals:
5. For P′ = 0.2P(1 − P/600), the carrying capacity is:
6. A logistic population grows fastest when P equals:
7. One Euler step with h = 1 for y′ = y, y(0) = 1 gives y(1) ≈
8. Who proposed the logistic model of population growth in 1838?

Section XIThe Bernoullis, Euler and Verhulst

Differential equations arrived with calculus itself, and Leibniz’s circle in the 1690s treated them as a public contest. In December 1695 Jacob Bernoulli proposed, in the journal Acta Eruditorum, the equation now called the Bernoulli equation. Leibniz published a solution in 1696 by changing the variable to turn it into a linear equation, and Jacob’s brother Johann Bernoulli found another method.

Leonhard Euler, who had been taught by Johann Bernoulli, wrote the great textbook Institutiones calculi integralis, whose first volume appeared in St Petersburg in 1768. In it he described approximating a solution by taking small steps along the slope, the idea now called Euler’s method.

In 1838 the Belgian mathematician Pierre-François Verhulst, a student of Adolphe Quetelet, published a short note on the law of population growth. Against the idea that population grows geometrically for ever, he proposed the equation we now call the logistic equation, and in a paper of 1844 (published 1845) he called its solution the “logistic” curve, without explaining the name. His work was largely forgotten until Raymond Pearl and Lowell Reed rediscovered the curve in 1920.

NotesSources and credits

Credits: every graph and diagram on this page is original SVG, computed from the actual equations, made for Jugami. The slope field explorer runs live in your browser with plain JavaScript, no outside libraries.