Differential EquationsSolving First-Order Equations1 of 7
Solving First-Order Equations · 1

What Is a Differential Equation?

In real problems, we rarely know the formula for a function over time up front, so we find it by writing down the rule for how it is changing right now.

1

Rules of Change

A differential equation is an equation that relates an unknown function to one or more of its derivatives. Instead of solving an algebraic equation like x+3=5\unknown{x} + 3 = 5 for a single mystery number, we are solving a rule of change for a whole mystery function: a curve over time.

Rules of Change
amount y\text{amount } \htmlClass{lc-blue}{y}
time t\text{time } t
y(t)= ?\htmlClass{lc-blue}{y(t)} = \htmlClass{lc-blue}{\,?}

Here is how we write a differential equation for a cooling cup of coffee.

Text solution
Temperature gapWrite the difference between the coffee's current temperature T\unknown{T} and the 20∘C20^\circ\text{C} room.
gap\displaystyle \text{gap} =T−20\displaystyle = \unknown{T - 20}
Rate of changeSet the rate of temperature change dTdt\firstderiv{\frac{dT}{dt}} equal to a constant −k-k times that gap, with a negative sign because heat flows out when the coffee is warmer than the room.
dTdt⏟rate of change=−k(T−20)⏟temperature gap\displaystyle \begin{aligned}\firstderiv{\underbrace{\frac{dT}{dt}}_{\text{rate of change}}} &= -k\unknown{\underbrace{(T - 20)}_{\text{temperature gap}}}\end{aligned}

At any moment, the temperature gap T−20\unknown{T - 20} alone sets the slope dTdt\firstderiv{\frac{dT}{dt}} of the temperature curve: steeply downward when the coffee is hot, flat right at 20∘C20^\circ\text{C}, and tilting upward if the coffee starts cooler than the room.

The temperature difference between the coffee and the 20°C room sets how fast the temperature changes (the slope) right at that moment.

When forces control motion, Newton's second law (F=maF = m\higherderiv{a}) relates an object's position y\unknown{y} to both its first derivative and its second derivative in the same rule:

md2ydt2⏟acceleration=−bdydt⏟velocity−ky⏟position\displaystyle \begin{aligned}m\higherderiv{\underbrace{\frac{d^2y}{dt^2}}_{\text{acceleration}}} &= -b\firstderiv{\underbrace{\frac{dy}{dt}}_{\text{velocity}}} - k\unknown{\underbrace{y}_{\text{position}}}\end{aligned}
2

Reading a Differential Equation

No single technique solves every differential equation, so before trying to solve one, we check four things about it (its variables, derivative type, order, and linearity) to see what kind of equation we have.

Reading a Differential Equation
dTdt=−k(T−20)md2ydt2=−bdydt−kyx2y′′′+sin⁡(x) y′=exyd2θdt2+gLsin⁡(θ)=0∂u∂t=c2∂2u∂x2\displaystyle \small\begin{aligned} \htmlClass{lc-pink}{\frac{dT}{dt}} &= -k(\htmlClass{lc-blue}{T - 20}) \\[6pt] m\htmlClass{lc-orange}{\frac{d^2y}{dt^2}} &= -b\htmlClass{lc-pink}{\frac{dy}{dt}} - k\htmlClass{lc-blue}{y} \\[6pt] x^2\htmlClass{lc-orange}{y'''} + \sin(x)\,\htmlClass{lc-pink}{y'} &= e^x\htmlClass{lc-blue}{y} \\[6pt] \htmlClass{lc-orange}{\frac{d^2\theta}{dt^2}} + \tfrac{g}{L}\sin(\htmlClass{lc-blue}{\theta}) &= 0 \\[6pt] \htmlClass{lc-pink}{\frac{\partial u}{\partial t}} &= c^2\htmlClass{lc-orange}{\frac{\partial^2u}{\partial x^2}} \end{aligned}
What kind is each?\displaystyle \text{What kind is each?}

You can read the roles of the letters directly off the derivative fractions:

m⏟parameterd2y⏞dependentvariabledt2+b⏟parameterdydt⏟independentvariable+k⏟parametery=0\displaystyle \underbrace{m}_{\text{parameter}} \higherderiv{\frac{d^2 \unknown{\overbrace{y}^{\begin{gathered}\scriptstyle\text{dependent} \\[-2pt] \scriptstyle\text{variable}\end{gathered}}}}{dt^2}} + \underbrace{b}_{\text{parameter}} \frac{\firstderiv{dy}}{\firstderiv{d} \underbrace{t}_{\begin{gathered}\scriptstyle\text{independent} \\[-2pt] \scriptstyle\text{variable}\end{gathered}}} + \underbrace{k}_{\text{parameter}} \unknown{y} = 0

Whether an equation uses ordinary derivatives dd or partial derivatives ∂\partial depends on how many independent variables the unknown function has:

dTdt=−k(T−20)⏟ODE: T(t) has one input t∂u∂t=c2∂2u∂x2⏟PDE: u(x,t) has two inputs x and t\displaystyle \begin{aligned}&\underbrace{\firstderiv{\frac{dT}{dt}} = -k(\unknown{T - 20})}_{\text{ODE: } \unknown{T}(t) \text{ has one input } t} \\[12pt] &\underbrace{\firstderiv{\frac{\partial u}{\partial t}} = c^2 \higherderiv{\frac{\partial^2 u}{\partial x^2}}}_{\text{PDE: } \unknown{u}(x, t) \text{ has two inputs } x \text{ and } t}\end{aligned}

When finding the order of an equation, pay attention to where the number sits so you don't confuse taking a derivative several times with raising a derivative to an exponent:

(dydx)3⏟first derivative, cubed (first-order)+y=0d3ydx3⏟differentiated 3 times (third-order)+y=0\displaystyle \begin{aligned}\underbrace{\left(\firstderiv{\frac{dy}{dx}}\right)^3}_{\text{first derivative, cubed (first-order)}} + \unknown{y} &= 0 \\[12pt] \underbrace{\higherderiv{\frac{d^3y}{dx^3}}}_{\text{differentiated 3 times (third-order)}} + \unknown{y} &= 0\end{aligned}

Here is how we classify x2y′′′+sin⁡(x)y′=exyx^2 \higherderiv{y'''} + \sin(x)\firstderiv{y'} = e^x \unknown{y} and compare its linearity with the pendulum equation d2θdt2+gLsin⁡(θ)=0\higherderiv{\frac{d^2\theta}{dt^2}} + \frac{g}{L}\sin(\unknown{\theta}) = 0.

Text solution
Identify the variablesIn prime notation, y\unknown{y} is the unknown dependent variable, and the xx in the coefficients shows that y\unknown{y} is a function of xx (so y′=dydx\firstderiv{y'} = \firstderiv{\frac{dy}{dx}}).
x2y′′′+sin⁡(x)y′\displaystyle x^2 \higherderiv{y'''} + \sin(x)\firstderiv{y'} =exy\displaystyle = e^x \unknown{y}
Find the orderLook for the highest derivative in the equation, ignoring powers on the independent variable xx.
y′′′⏟third derivative  ⟹  third-order ODE\displaystyle \higherderiv{\underbrace{y'''}_{\text{third derivative}}} \implies \text{third-order ODE}
Check linearity on the unknown functionIn the first equation, y\unknown{y}, y′\firstderiv{y'}, and y′′′\higherderiv{y'''} are each just raised to the first power in their own terms, whereas in the pendulum equation the unknown angle θ\unknown{\theta} is inside a sine function.
x2y′′′+sin⁡(x)y′=exy⏟linear (only the input x is inside functions)d2θdt2+gLsin⁡(θ)=0⏟nonlinear (unknown θ is inside sin⁡)\displaystyle \begin{aligned}&\underbrace{x^2 \higherderiv{y'''} + \sin(x)\firstderiv{y'} = e^x \unknown{y}}_{\text{linear (only the input } x \text{ is inside functions)}} \\[12pt] &\underbrace{\higherderiv{\frac{d^2\theta}{dt^2}} + \frac{g}{L}\sin(\unknown{\theta}) = 0}_{\text{nonlinear (unknown } \unknown{\theta} \text{ is inside } \sin\text{)}}\end{aligned}
3

Slope Fields and Families of Solutions

A slope field is a grid of short dashes showing the slope a differential equation requires at each point on the graph, letting us see the curves that solve the equation even before we use algebra.

Slope Fields and Families of Solutions
−2\htmlClass{lc-mute}{-2}
−1\htmlClass{lc-mute}{-1}
1\htmlClass{lc-mute}{1}
−1\htmlClass{lc-mute}{-1}
1\htmlClass{lc-mute}{1}
2\htmlClass{lc-mute}{2}
3\htmlClass{lc-mute}{3}
4\htmlClass{lc-mute}{4}
tt
y\htmlClass{lc-blue}{y}
dydt=y\htmlClass{lc-pink}{\dfrac{dy}{dt}} = \htmlClass{lc-blue}{y}

Following the dashes for dydt=y\firstderiv{\frac{dy}{dt}} = \unknown{y} traces out a whole family of curves y=Aet\unknown{y} = \unknown{A}e^t, and choosing a starting point picks out the one curve that passes through it.

Setting the slope at every height gives a whole family of curves, and any starting point picks out the single curve through it.

Once we have a family of solutions, we use the starting point (the initial condition) to find the value of the constant A\unknown{A} for our specific curve.

Text solution
Check the family of solutionsDifferentiate y=Aet\unknown{y} = \unknown{A}e^t to see that the derivative gives back the function itself for any constant A\unknown{A}.
dydt\displaystyle \firstderiv{\frac{dy}{dt}} =ddt(Aet)\displaystyle = \frac{d}{dt}(\unknown{A}e^t) =Aet\displaystyle = \firstderiv{Ae^t} =y\displaystyle = \unknown{y}
Use the initial conditionPlug the starting point t=0,y=3t = 0, \unknown{y} = 3 into y=Aet\unknown{y} = \unknown{A}e^t to solve for A\unknown{A} and find that one curve.
3\displaystyle 3 =Ae0\displaystyle = \unknown{A}e^0 =A  ⟹  y\displaystyle = \unknown{A} \implies \unknown{y} =3et\displaystyle = 3e^t

In the same way, the cooling coffee equation dTdt=−k(T−20)\firstderiv{\frac{dT}{dt}} = -k(\unknown{T - 20}) has a family of exponential solutions where A\unknown{A} is the starting temperature gap above the 20∘C20^\circ\text{C} room at t=0t = 0:

T(t)=20⏟room temperature+A⏟starting gape−kt\displaystyle \begin{aligned}\unknown{T(t)} &= \underbrace{20}_{\text{room temperature}} + \unknown{\underbrace{A}_{\text{starting gap}}} e^{-kt}\end{aligned}
temperature T\text{temperature } T
time t\text{time } t
Room temperature 20∘C\text{Room temperature } 20^\circ\text{C}
(0, 90)(0,\, 90)
Starting gapA=70∘C\htmlClass{lc-blue}{\begin{aligned}\text{Starting gap}\\ A = 70^\circ\text{C}\end{aligned}}
T(t)=20+70e−kt\htmlClass{lc-blue}{T(t)} = 20 + \htmlClass{lc-blue}{70}e^{-kt}

Key concepts

Any equation with a derivative of an unknown function (written as dydt\firstderiv{\frac{dy}{dt}} or with primes like y′\firstderiv{y'} and y′′\higherderiv{y''}) is a differential equation, and solving it means finding that function. A first-order equation defines a slope field and produces an entire family of solution curves with a constant A\unknown{A} (such as y=Aet\unknown{y} = \unknown{A}e^t for dydt=y\firstderiv{\frac{dy}{dt}} = \unknown{y}, or T(t)=20+Ae−kt\unknown{T(t)} = 20 + \unknown{A}e^{-kt} for dTdt=−k(T−20)\firstderiv{\frac{dT}{dt}} = -k(\unknown{T - 20})), while an initial condition like y(0)=3\unknown{y}(0) = 3 fixes the value of A\unknown{A} to pick out one curve (y=3et\unknown{y} = 3e^t).

When reading a differential equation before solving it:

Variables and parameters

In dTdt=−k(T−20)\firstderiv{\frac{dT}{dt}} = -k(\unknown{T - 20}), the top variable T\unknown{T} is the dependent variable (the unknown function), the bottom variable tt is the independent variable (the input), and fixed constants like kk are parameters. A single independent variable gives an ODE with ordinary derivatives dd; multiple independent variables give a PDE with partial derivatives ∂\partial (like ∂u∂t=c2∂2u∂x2\firstderiv{\frac{\partial u}{\partial t}} = c^2 \higherderiv{\frac{\partial^2 u}{\partial x^2}}).

Order

Take the highest derivative in the equation, not the highest exponent. d3ydx3+y=0\higherderiv{\frac{d^3y}{dx^3}} + \unknown{y} = 0 is third-order, but (dydx)3+y=0\left(\firstderiv{\frac{dy}{dx}}\right)^3 + \unknown{y} = 0 only differentiates y\unknown{y} once and is first-order.

Linear vs. nonlinear

Look only at the dependent variable and its derivatives. If each appears to the first power in its own term, the equation is linear, even when the independent variable has powers or functions like in x2y′′′+sin⁡(x)y′=exyx^2 \higherderiv{y'''} + \sin(x)\firstderiv{y'} = e^x \unknown{y}. If the unknown function or any of its derivatives is raised to a power ((y′)2+y=0(\firstderiv{y'})^2 + \unknown{y} = 0, dydt=y2\firstderiv{\frac{dy}{dt}} = \unknown{y}^2), multiplied by another (y⋅y′′=t\unknown{y} \cdot \higherderiv{y''} = t), or inside another function (sin⁡(θ)\sin(\unknown{\theta}) in d2θdt2+gLsin⁡(θ)=0\higherderiv{\frac{d^2\theta}{dt^2}} + \frac{g}{L}\sin(\unknown{\theta}) = 0), the equation is nonlinear.

4

Practice

1

In the differential equation md2hdt2=−mg−cdhdtm\frac{d^2h}{dt^2} = -mg - c\frac{dh}{dt} for a falling object of mass mm in air with drag constant cc and gravity gg, identify the dependent variable, the independent variable, and the parameters.

Look at the derivative fraction dhdt\frac{dh}{dt}: which variable is on top being differentiated, and which is on the bottom?

In the derivatives d2hdt2\higherderiv{\frac{d^2h}{dt^2}} and dhdt\firstderiv{\frac{dh}{dt}}, the variable on top is the height h\unknown{h} (the unknown function we solve for) and the variable on the bottom is time tt (the input h\unknown{h} depends on); swapping top and bottom gives the common wrong answer that tt is dependent and h\unknown{h} is independent. The remaining letters mm, gg, and cc are fixed constants rather than changing variables (don't count gg as a variable just because it isn't attached to a derivative). Dependent variable: h\unknown{h}; independent variable: tt; parameters: mm, gg, and cc.
2

State the order of each differential equation: (a) (d2ydx2)4+x(dydx)5=y\left(\frac{d^2y}{dx^2}\right)^4 + x\left(\frac{dy}{dx}\right)^5 = y and (b) d4ydx4+(dydx)2=y\frac{d^4y}{dx^4} + \left(\frac{dy}{dx}\right)^2 = y.

Look inside the parentheses for how many times yy is differentiated, rather than at the outer exponents raising the whole derivative.

(a)The derivatives in the equation are d2ydx2\higherderiv{\frac{d^2y}{dx^2}} and dydx\firstderiv{\frac{dy}{dx}}. Reading the outer exponents 44 and 55 as derivative orders gives the wrong answer fifth-order (or eighth-order from multiplying 2×42 \times 4), when 44 and 55 are only exponents on the derivatives. Because the highest derivative is d2ydx2\higherderiv{\frac{d^2y}{dx^2}}, (a) is second-order.
(b)The derivatives are d4ydx4\higherderiv{\frac{d^4y}{dx^4}} and dydx\firstderiv{\frac{dy}{dx}}, and the highest derivative is d4ydx4\higherderiv{\frac{d^4y}{dx^4}}, so (b) is fourth-order.
3

For each equation, identify the independent and dependent variables and determine whether the equation is linear or nonlinear: (a) t3y′′−cos⁡(t)y′+ety=0t^3 y'' - \cos(t)y' + e^t y = 0 and (b) x2y′′+y⋅y′=0x^2 y'' + y \cdot y' = 0.

Find the variable that never has a prime on it to identify the input, then check whether powers, products, or functions are applied to yy and its derivatives or only to the input variable.

(a)The primes are on y\unknown{y} and the other variable in the equation is tt, so y\unknown{y} is a function of tt. Calling this equation nonlinear because of t3t^3, cos⁡(t)\cos(t), and ete^t is a common mistake: those functions and powers are only on the independent variable tt, while y\unknown{y}, y′\firstderiv{y'}, and y′′\higherderiv{y''} are each raised to the first power in their own terms. Independent variable: tt; dependent variable: y\unknown{y}; linear.
(b)Here y\unknown{y} is a function of xx. Checking only exponents and seeing first powers on y\unknown{y} and y′\firstderiv{y'} leads to the wrong answer linear; because the unknown y\unknown{y} is multiplied by its derivative y′\firstderiv{y'} in the term y⋅y′\unknown{y} \cdot \firstderiv{y'}, the equation is nonlinear. Independent variable: xx; dependent variable: y\unknown{y}; nonlinear.
4

The wave equation ∂2w∂t2=c2∂2w∂x2\frac{\partial^2 w}{\partial t^2} = c^2 \frac{\partial^2 w}{\partial x^2} models the height ww of a vibrating guitar string at position xx and time tt, where cc is a constant. Is this an ordinary differential equation (ODE) or a partial differential equation (PDE), what is its order, and is it linear or nonlinear?

Count how many independent variables ww depends on in the ∂\partial denominators, find the highest derivative, and check the power of ww and its derivatives.

The unknown height w(x,t)\unknown{w}(x, t) depends on two independent variables (xx and tt) and uses partial derivatives ∂\partial, making it a PDE. The highest derivative on either side is a second derivative (don't add the two second derivatives together to get fourth-order), and w\unknown{w} and its derivatives appear only to the first power (don't let the squared constant c2c^2 trick you into calling it nonlinear). Second-order, linear partial differential equation (PDE).
5

A sample of a chemical that breaks down over time has mass M(t)\unknown{M}(t) at time tt. At any moment, the rate at which the mass decreases is a constant kk times the square of the mass currently remaining. Write the differential equation for M(t)\unknown{M}(t), and state its order and whether it is linear or nonlinear.

Write "rate at which M\unknown{M} decreases" as a derivative with the sign that matches a decreasing quantity, then check what is being squared.

The rate of change of M(t)\unknown{M}(t) is dMdt\firstderiv{\frac{dM}{dt}}, and kk times the square of the current mass is kM2k\unknown{M}^2. Leaving off the minus sign gives the common wrong equation dMdt=kM2\firstderiv{\frac{dM}{dt}} = k\unknown{M}^2, which would mean the mass is growing rather than decreasing. The highest derivative is the first derivative dMdt\firstderiv{\frac{dM}{dt}}, and the unknown function M\unknown{M} is squared. dMdt=−kM2\firstderiv{\frac{dM}{dt}} = -k\unknown{M}^2; first-order and nonlinear.
6

A cup of coffee in a 20∘C20^\circ\text{C} room cools according to dTdt=−0.1(T−20)\firstderiv{\frac{dT}{dt}} = -0.1(\unknown{T - 20}), which has the family of solutions T(t)=20+Ae−0.1t\unknown{T(t)} = 20 + \unknown{A}e^{-0.1t}. If the coffee starts at 90∘C90^\circ\text{C} at t=0t = 0, find the slope of its temperature curve on the slope field at T=90∘C\unknown{T} = 90^\circ\text{C} and at T=30∘C\unknown{T} = 30^\circ\text{C}, and find the value of A\unknown{A} for this curve.

Plug each temperature T\unknown{T} directly into the differential equation to get the slopes, and plug t=0,T=90t = 0, \unknown{T} = 90 into the solution family to solve for the starting gap A\unknown{A}.

Plug T=90\unknown{T} = 90 and T=30\unknown{T} = 30 into dTdt=−0.1(T−20)\firstderiv{\frac{dT}{dt}} = -0.1(\unknown{T - 20}) to find the slopes (forgetting the negative sign gives +7+7 and +1+1, which would mean the coffee is warming up):
At T=90∘C:dTdt=−0.1(90−20)=−7∘C per unit timeAt T=30∘C:dTdt=−0.1(30−20)=−1∘C per unit time\displaystyle \begin{aligned} \text{At } \unknown{T} = 90^\circ\text{C}: \quad \firstderiv{\frac{dT}{dt}} &= -0.1(\unknown{90 - 20}) = -7^\circ\text{C}\text{ per unit time} \\ \text{At } \unknown{T} = 30^\circ\text{C}: \quad \firstderiv{\frac{dT}{dt}} &= -0.1(\unknown{30 - 20}) = -1^\circ\text{C}\text{ per unit time} \end{aligned}
Plug t=0t = 0 and T=90\unknown{T} = 90 into T(t)=20+Ae−0.1t\unknown{T(t)} = 20 + \unknown{A}e^{-0.1t}:
90\displaystyle \unknown{90} =20+Ae0\displaystyle = 20 + \unknown{A}e^0 =20+A\displaystyle = 20 + \unknown{A}
Using the starting temperature for A\unknown{A} gives the common wrong answer A=90\unknown{A} = 90; subtracting the 20∘C20^\circ\text{C} room temperature gives the starting temperature gap.
Slope at 90∘C90^\circ\text{C}: −7∘C-7^\circ\text{C} per unit time; slope at 30∘C30^\circ\text{C}: −1∘C-1^\circ\text{C} per unit time; A=70\unknown{A} = 70.