Skip to content
Family Table Math
Auto

Introduction to Differential Equations

A differential equation is an equation that involves a derivative, like dPdt=0.03P\dfrac{dP}{dt} = 0.03P. Instead of telling you what a quantity is, it tells you how the quantity changes. That is often exactly what we know about the real world: populations grow faster when there are more animals, and hot soup cools faster when it is much hotter than the room. This page shows how to turn words into a differential equation and how to check whether a function solves one.

A differential equation (often shortened to “DE”) relates a function to one or more of its derivatives. Some examples:

dydx=2xdydx=x−ydPdt=kPy′′+9y=0\frac{dy}{dx} = 2x \qquad\quad \frac{dy}{dx} = x - y \qquad\quad \frac{dP}{dt} = kP \qquad\quad y'' + 9y = 0

The unknown is a function, not a number. Solving a DE means finding a function (or a whole family of functions) that makes the equation true for every value of the input.

Writing a differential equation from words

Section titled “Writing a differential equation from words”

The phrase “the rate of change of QQ” means the derivative dQdt\dfrac{dQ}{dt} (if QQ changes with time tt). “Is proportional to” means “equals a constant kk times”.

WordsDifferential equation
The rate of change of PP is proportional to PP.dPdt=kP\dfrac{dP}{dt} = kP
The rate of change of yy with respect to xx is proportional to the square of yy.dydx=ky2\dfrac{dy}{dx} = ky^2
The rate of change of TT is proportional to the difference between TT and 2020.dTdt=k(T−20)\dfrac{dT}{dt} = k(T - 20)
The rate of change of hh is inversely proportional to hh.dhdt=kh\dfrac{dh}{dt} = \dfrac{k}{h}
The rate of change of yy is jointly proportional to xx and yy.dydx=kxy\dfrac{dy}{dx} = kxy

The sign of kk carries meaning: if the quantity is increasing, k>0k \gt 0; if it is decreasing, k<0k \lt 0. Some books write a decreasing quantity as −k-k with k>0k \gt 0 instead. Either way is fine, as long as you say which.

To check whether a function is a solution, substitute it into the differential equation:

  1. Find the derivatives the equation needs (y′y', and y′′y'' if it appears).
  2. Substitute yy and its derivatives into both sides.
  3. Simplify. If the two sides are equal for every xx, the function is a solution.

You don’t need to know how to solve the equation to check a solution. Checking is just differentiating and simplifying.

A differential equation usually has infinitely many solutions. For example, every function y=x2+Cy = x^2 + C solves dydx=2x\dfrac{dy}{dx} = 2x, because the derivative of any constant is 00.

  • The general solution is the whole family, written with an arbitrary constant: y=x2+Cy = x^2 + C.
  • A particular solution is one specific member, picked out by an initial condition such as y(1)=3y(1) = 3. Here 3=12+C3 = 1^2 + C gives C=2C = 2, so the particular solution is y=x2+2y = x^2 + 2.
Several curves y = x squared + C for different values of C, all with the same shape shifted up or down. The particular solution y = x squared + 2 passes through the point (1, 3). −2 −1 1 2 −2 −1 1 2 3 4 5 (1, 3) y = x² + 2
Every curve y=x2+Cy = x^2 + C solves dydx=2x\frac{dy}{dx} = 2x. The initial condition y(1)=3y(1) = 3 picks out one of them.

A differential equation together with an initial condition is called an initial value problem. You will learn to find general and particular solutions yourself in separation of variables.

Water drains from a tank so that the rate of change of the depth hh (in metres) with respect to time tt (in minutes) is proportional to the square root of the depth. Write a differential equation for hh.

Solution. “The rate of change of the depth” is dhdt\dfrac{dh}{dt}. “Proportional to the square root of the depth” means khk\sqrt{h}:

dhdt=kh\frac{dh}{dt} = k\sqrt{h}

The tank is draining, so hh is decreasing and k<0k \lt 0. (Equivalently, dhdt=−kh\dfrac{dh}{dt} = -k\sqrt{h} with k>0k \gt 0.)

Show that y=3e2x−1y = 3e^{2x} - 1 is a solution of dydx=2y+2\dfrac{dy}{dx} = 2y + 2.

Solution. Find the derivative of the proposed solution:

dydx=6e2x\frac{dy}{dx} = 6e^{2x}

Now substitute yy into the right side:

2y+2=2(3e2x−1)+2=6e2x−2+2=6e2x2y + 2 = 2(3e^{2x} - 1) + 2 = 6e^{2x} - 2 + 2 = 6e^{2x}

Both sides equal 6e2x6e^{2x} for every xx, so y=3e2x−1y = 3e^{2x} - 1 is a solution.

Show that y=sin⁡(3x)+cos⁡(3x)y = \sin(3x) + \cos(3x) solves y′′+9y=0y'' + 9y = 0. (Angles are in radians, as always in calculus.)

Solution. Differentiate twice using the chain rule:

y′=3cos⁡(3x)−3sin⁡(3x)y′′=−9sin⁡(3x)−9cos⁡(3x)\begin{aligned} y' &= 3\cos(3x) - 3\sin(3x) \\ y'' &= -9\sin(3x) - 9\cos(3x) \end{aligned}

Substitute into the left side:

y′′+9y=−9sin⁡(3x)−9cos⁡(3x)+9(sin⁡(3x)+cos⁡(3x))=0y'' + 9y = -9\sin(3x) - 9\cos(3x) + 9\big(\sin(3x) + \cos(3x)\big) = 0

The left side equals the right side, 00, so it is a solution. The same steps show that y=2sin⁡(3x)y = 2\sin(3x) and y=−5cos⁡(3x)y = -5\cos(3x) are solutions too: this equation has infinitely many solutions.

For which values of kk is y=ekxy = e^{kx} a solution of y′′−y′−6y=0y'' - y' - 6y = 0?

Solution. With y=ekxy = e^{kx}, we have y′=kekxy' = ke^{kx} and y′′=k2ekxy'' = k^2e^{kx}. Substitute:

k2ekx−kekx−6ekx=ekx(k2−k−6)=0k^2e^{kx} - ke^{kx} - 6e^{kx} = e^{kx}(k^2 - k - 6) = 0

Since ekxe^{kx} is never 00, we need

k2−k−6=0⇒(k−3)(k+2)=0⇒k=3 or k=−2k^2 - k - 6 = 0 \quad\Rightarrow\quad (k - 3)(k + 2) = 0 \quad\Rightarrow\quad k = 3 \ \text{or}\ k = -2

Check k=3k = 3: 9e3x−3e3x−6e3x=09e^{3x} - 3e^{3x} - 6e^{3x} = 0. ✓

Checking only one side, or only one point. A function is a solution only if both sides agree for every xx in an interval. Plugging in x=0x = 0 and getting a match is not enough. Simplify both sides into the same expression.

Forgetting the chain rule. The derivative of e2xe^{2x} is 2e2x2e^{2x}, and the derivative of sin⁡(3x)\sin(3x) is 3cos⁡(3x)3\cos(3x). Missing the inner derivative makes a true solution look wrong.

Mixing up “proportional to” and “equal to”. “The rate is proportional to PP” is dPdt=kP\dfrac{dP}{dt} = kP, not dPdt=P\dfrac{dP}{dt} = P. Always include the constant kk.

Writing the quantity instead of its rate. “The rate of change of TT is proportional to T−20T - 20” describes dTdt\dfrac{dT}{dt}, so the equation is dTdt=k(T−20)\dfrac{dT}{dt} = k(T - 20), not T=k(T−20)T = k(T - 20).

Thinking a DE has only one answer. Without an initial condition, there is a whole family of solutions. Write the general solution with its constant, and only find the constant when you are given a point.

1. (Warm-up) The rate of change of the mass mm of a radioactive sample with respect to time tt is proportional to the mass. Write a differential equation. What is the sign of the constant?

Solutiondmdt=km\frac{dm}{dt} = km

The sample is decaying, so mm is decreasing and k<0k \lt 0.

2. (Warm-up) Show that y=5e−3ty = 5e^{-3t} is a solution of dydt=−3y\dfrac{dy}{dt} = -3y.

Solution

Left side: dydt=−15e−3t\dfrac{dy}{dt} = -15e^{-3t}.

Right side: −3y=−3(5e−3t)=−15e−3t-3y = -3(5e^{-3t}) = -15e^{-3t}.

The sides are equal for every tt, so it is a solution.

3. (Core) A cup of coffee cools in a room kept at 21∘C21^\circ\text{C}. The rate of change of the coffee’s temperature TT (in degrees Celsius) with respect to time tt (in minutes) is proportional to the difference between TT and the room temperature. Write a differential equation, and explain the sign of the constant while the coffee is hotter than the room.

SolutiondTdt=k(T−21)\frac{dT}{dt} = k(T - 21)

While the coffee is hotter than the room, T−21>0T - 21 \gt 0 and the coffee is cooling, so dTdt<0\dfrac{dT}{dt} \lt 0. A positive number times kk is negative, so k<0k \lt 0.

4. (Core) Show that y=1x+Cy = \dfrac{1}{x + C} is a solution of dydx=−y2\dfrac{dy}{dx} = -y^2 for every constant CC. Then find the particular solution with y(0)=12y(0) = \dfrac{1}{2}.

Solution

Write y=(x+C)−1y = (x + C)^{-1}. Then

dydx=−(x+C)−2=−1(x+C)2=−(1x+C)2=−y2\frac{dy}{dx} = -(x + C)^{-2} = -\frac{1}{(x + C)^2} = -\left(\frac{1}{x + C}\right)^2 = -y^2

So it is a solution for every CC. For the initial condition:

10+C=12⇒C=2\frac{1}{0 + C} = \frac{1}{2} \quad\Rightarrow\quad C = 2

The particular solution is y=1x+2y = \dfrac{1}{x + 2}.

5. (Core) Show that y=xexy = xe^x is a solution of y′′−2y′+y=0y'' - 2y' + y = 0.

Solution

By the product rule:

y′=ex+xexy′′=ex+(ex+xex)=2ex+xex\begin{aligned} y' &= e^x + xe^x \\ y'' &= e^x + (e^x + xe^x) = 2e^x + xe^x \end{aligned}

Substitute:

(2ex+xex)−2(ex+xex)+xex=2ex+xex−2ex−2xex+xex=0(2e^x + xe^x) - 2(e^x + xe^x) + xe^x = 2e^x + xe^x - 2e^x - 2xe^x + xe^x = 0

The left side is 00, so y=xexy = xe^x is a solution.

6. (Core) Which of these are solutions of dydx=yx\dfrac{dy}{dx} = \dfrac{y}{x} (for x≠0x \ne 0)?

  • (a) y=4xy = 4x
  • (b) y=x+1y = x + 1
  • (c) y=−xy = -x
Solution

(a) dydx=4\dfrac{dy}{dx} = 4 and yx=4xx=4\dfrac{y}{x} = \dfrac{4x}{x} = 4. Yes, a solution.

(b) dydx=1\dfrac{dy}{dx} = 1 but yx=x+1x=1+1x\dfrac{y}{x} = \dfrac{x + 1}{x} = 1 + \dfrac{1}{x}, which is not 11. Not a solution.

(c) dydx=−1\dfrac{dy}{dx} = -1 and yx=−xx=−1\dfrac{y}{x} = \dfrac{-x}{x} = -1. Yes, a solution.

7. (Core) Show that y=Cex−x−1y = Ce^x - x - 1 solves dydx=x+y\dfrac{dy}{dx} = x + y for every constant CC. Then find the particular solution through the point (0,2)(0, 2).

Solution

Left side: dydx=Cex−1\dfrac{dy}{dx} = Ce^x - 1.

Right side: x+y=x+Cex−x−1=Cex−1x + y = x + Ce^x - x - 1 = Ce^x - 1.

The sides match, so it is a solution for every CC. At (0,2)(0, 2):

2=Ce0−0−1=C−1⇒C=32 = Ce^0 - 0 - 1 = C - 1 \quad\Rightarrow\quad C = 3

The particular solution is y=3ex−x−1y = 3e^x - x - 1.

8. (Challenge) Find all values of rr for which y=xry = x^r is a solution of x2y′′−2xy′−4y=0x^2y'' - 2xy' - 4y = 0 (for x>0x \gt 0).

Solution

With y=xry = x^r: y′=rxr−1y' = rx^{r-1} and y′′=r(r−1)xr−2y'' = r(r - 1)x^{r-2}. Substitute:

x2⋅r(r−1)xr−2−2x⋅rxr−1−4xr=0xr(r(r−1)−2r−4)=0xr(r2−3r−4)=0\begin{aligned} x^2 \cdot r(r - 1)x^{r-2} - 2x \cdot rx^{r-1} - 4x^r &= 0 \\ x^r\big(r(r - 1) - 2r - 4\big) &= 0 \\ x^r(r^2 - 3r - 4) &= 0 \end{aligned}

Since xr>0x^r \gt 0 for x>0x \gt 0, we need r2−3r−4=(r−4)(r+1)=0r^2 - 3r - 4 = (r - 4)(r + 1) = 0, so r=4r = 4 or r=−1r = -1.

Check r=4r = 4: x2(12x2)−2x(4x3)−4x4=12x4−8x4−4x4=0x^2(12x^2) - 2x(4x^3) - 4x^4 = 12x^4 - 8x^4 - 4x^4 = 0. ✓

9. (Challenge) Show that y=tan⁡(x+C)y = \tan(x + C) solves dydx=1+y2\dfrac{dy}{dx} = 1 + y^2 for every constant CC (radians). Find the particular solution with y(0)=1y(0) = 1, and give the largest open interval containing x=0x = 0 on which it is defined.

Solutiondydx=sec⁡2(x+C)=1+tan⁡2(x+C)=1+y2\frac{dy}{dx} = \sec^2(x + C) = 1 + \tan^2(x + C) = 1 + y^2

using the identity sec⁡2θ=1+tan⁡2θ\sec^2\theta = 1 + \tan^2\theta. So it is a solution for every CC.

For y(0)=1y(0) = 1: tan⁡C=1\tan C = 1, so C=π4C = \dfrac{\pi}{4} and y=tan⁡(x+π4)y = \tan\left(x + \dfrac{\pi}{4}\right).

Tangent is defined between consecutive vertical asymptotes, so we need −π2<x+π4<π2-\dfrac{\pi}{2} \lt x + \dfrac{\pi}{4} \lt \dfrac{\pi}{2}, which gives

−3π4<x<π4-\frac{3\pi}{4} \lt x \lt \frac{\pi}{4}