Salick Academy

Differential Equations and Modelling

No calculator

A differential equation relates a quantity to its own rate of change. That is how nearly every physical law is stated, which is why solving them matters.

What a differential equation is

An equation containing a derivative. Its order is the highest derivative present:

dydx=2x(first order)d2ydx2+4y=0(second order)\frac{dy}{dx} = 2x \qquad \text{(first order)} \qquad \frac{d^2y}{dx^2} + 4y = 0 \qquad \text{(second order)}

The simplest kind is solved by integrating directly:

dydx=2x⇒y=x2+C\frac{dy}{dx} = 2x \quad \Rightarrow \quad y = x^2 + C

The +C+C makes this the general solution — a whole family of curves. A boundary condition such as y=5y = 5 when x=1x = 1 picks one out: 5=1+C5 = 1 + C, so C=4C = 4 and y=x2+4y = x^2 + 4. That is the particular solution.

Separation of variables

If the equation can be written as dydx=f(x)g(y)\dfrac{dy}{dx} = f(x)g(y), gather the yy's on one side and the xx's on the other, then integrate both sides.

Solve dydx=xy\dfrac{dy}{dx} = xy.

1y dy=x dx\frac{1}{y}\,dy = x\,dx ∫1y dy=∫x dx\int \frac{1}{y}\,dy = \int x\,dx ln⁡∣y∣=x22+C\ln|y| = \frac{x^2}{2} + C y=Aex2/2y = A e^{x^2/2}

where A=eCA = e^C absorbs the constant.

The growth and decay equation. dydt=ky\dfrac{dy}{dt} = ky separates the same way:

ln⁡∣y∣=kt+C⇒y=Aekt\ln|y| = kt + C \quad \Rightarrow \quad y = Ae^{kt}

with AA the value at t=0t = 0. Positive kk gives growth; negative kk gives decay.

The integrating factor

For a first-order linear equation

dydx+P(x) y=Q(x)\frac{dy}{dx} + P(x)\,y = Q(x)

multiply through by the integrating factor

IF=e∫P dx\text{IF} = e^{\int P\,dx}

The left side then becomes an exact derivative:

ddx(IF×y)=IF×Q\frac{d}{dx}\big(\text{IF} \times y\big) = \text{IF} \times Q

so integrating both sides finishes the job.

Solve dydx+2y=ex\dfrac{dy}{dx} + 2y = e^x.

IF=e∫2 dx=e2x\text{IF} = e^{\int 2\,dx} = e^{2x} ddx(e2xy)=e2x⋅ex=e3x\frac{d}{dx}\left(e^{2x}y\right) = e^{2x} \cdot e^x = e^{3x} e2xy=e3x3+Ce^{2x}y = \frac{e^{3x}}{3} + C y=ex3+Ce−2xy = \frac{e^x}{3} + Ce^{-2x}

Check: y′+2y=(ex3−2Ce−2x)+(2ex3+2Ce−2x)=exy' + 2y = \left(\frac{e^x}{3} - 2Ce^{-2x}\right) + \left(\frac{2e^x}{3} + 2Ce^{-2x}\right) = e^x ✓

Solve dydx+yx=x\dfrac{dy}{dx} + \dfrac{y}{x} = x.

IF=e∫1xdx=eln⁡x=x\text{IF} = e^{\int \frac1x dx} = e^{\ln x} = x ddx(xy)=x2⇒xy=x33+C⇒y=x23+Cx\frac{d}{dx}(xy) = x^2 \quad \Rightarrow \quad xy = \frac{x^3}{3} + C \quad \Rightarrow \quad y = \frac{x^2}{3} + \frac{C}{x}

Second-order equations

For ad2ydx2+bdydx+cy=0a\dfrac{d^2y}{dx^2} + b\dfrac{dy}{dx} + cy = 0, try y=emxy = e^{mx}. This produces the auxiliary equation

am2+bm+c=0am^2 + bm + c = 0

and the shape of the solution depends on its roots:

Roots General solution
distinct real m1,m2m_1, m_2 y=Aem1x+Bem2xy = Ae^{m_1x} + Be^{m_2x}
repeated real mm y=(A+Bx)emxy = (A + Bx)e^{mx}
complex α±βi\alpha \pm \beta i y=eαx(Acos⁡βx+Bsin⁡βx)y = e^{\alpha x}\big(A\cos\beta x + B\sin\beta x\big)

Solve y′′−5y′+6y=0y'' - 5y' + 6y = 0.

m2−5m+6=0⇒(m−2)(m−3)=0m^2 - 5m + 6 = 0 \quad \Rightarrow \quad (m-2)(m-3) = 0 y=Ae2x+Be3xy = Ae^{2x} + Be^{3x}

Solve y′′+4y′+4y=0y'' + 4y' + 4y = 0.

m2+4m+4=(m+2)2=0m^2 + 4m + 4 = (m+2)^2 = 0

A repeated root m=−2m = -2, so

y=(A+Bx)e−2xy = (A + Bx)e^{-2x}

Solve y′′+4y=0y'' + 4y = 0.

m2+4=0⇒m=±2im^2 + 4 = 0 \quad \Rightarrow \quad m = \pm 2i

Here α=0\alpha = 0 and β=2\beta = 2:

y=Acos⁡2x+Bsin⁡2xy = A\cos 2x + B\sin 2x

— an oscillation, which is why complex roots describe vibrating systems.

Particular integrals

When the right-hand side is not zero,

general solution=complementary function+particular integral\text{general solution} = \text{complementary function} + \text{particular integral}

The complementary function solves the equation with zero on the right; the particular integral is any single solution of the full equation. Guess its form from the right-hand side:

Right-hand side Try
constant y=ky = k
linear in xx y=px+qy = px + q
ekxe^{kx} y=λekxy = \lambda e^{kx}
sin⁡kx\sin kx or cos⁡kx\cos kx y=λcos⁡kx+μsin⁡kxy = \lambda\cos kx + \mu\sin kx

Solve y′′−5y′+6y=12y'' - 5y' + 6y = 12.

Complementary function: Ae2x+Be3xAe^{2x} + Be^{3x}, from above.

Particular integral: try y=ky = k, so y′=y′′=0y' = y'' = 0 and 6k=126k = 12, giving k=2k = 2.

y=Ae2x+Be3x+2y = Ae^{2x} + Be^{3x} + 2

Modelling

Exponential growth and decay. "The rate of change is proportional to the amount present" is

dPdt=kP⇒P=P0ekt\frac{dP}{dt} = kP \quad \Rightarrow \quad P = P_0e^{kt}

Population growth, compound interest and radioactive decay are all this equation, with kk negative for decay.

Newton's law of cooling. "The rate of cooling is proportional to the excess temperature over the surroundings":

dθdt=−k(θ−θs)\frac{d\theta}{dt} = -k(\theta - \theta_s)

Separating gives

θ=θs+Ae−kt\theta = \theta_s + Ae^{-kt}

so the temperature approaches θs\theta_s but never quite reaches it — the object cools quickly at first, then ever more slowly, which matches what a cup of coffee actually does.