10. Adv: Laplace transforms

📖 Reading · 10 min
💡 Every code box below is live — edit it and hit Run.

§13.5 and §13.6 solved constant-coefficient equations by turning calculus into algebra — guess e^{rx}, solve a polynomial. The Laplace transform generalizes that trick into a complete alternate universe: convert the entire differential equation, initial conditions included, into a single algebraic equation, solve for an unknown function of a new variable s, then convert back. This closing lesson of the module builds the transform, its key derivative property, and uses it to re-derive a result already found — as a check that the machinery genuinely works.

The Laplace transform

\mathcal L\{f(t)\}=F(s)=\int_0^\infty e^{-st}f(t)\,dt

— an improper integral (§4.10), converting a function of t into a new function of s. A short table, computable directly from §4.10's techniques:

\mathcal L\{1\}=\frac1s\qquad\mathcal L\{e^{at}\}=\frac1{s-a}\qquad\mathcal L\{\sin(at)\}=\frac a{s^2+a^2}\qquad\mathcal L\{\cos(at)\}=\frac s{s^2+a^2}

(each derivable exactly as §4.10 handled \int_0^\infty e^{-x}dx-style integrals — an antiderivative followed by an infinite-limit evaluation.)

The property that makes it work: transforming a derivative

\mathcal L\{f'(t)\}=sF(s)-f(0)

Proof, using integration by parts (§4.6): with u=e^{-st}, dv=f'(t)\,dt,

\int_0^\infty e^{-st}f'(t)\,dt=\Big[e^{-st}f(t)\Big]_0^\infty+s\int_0^\infty e^{-st}f(t)\,dt=\big(0-f(0)\big)+sF(s)

(the boundary term vanishes at \infty for functions of reasonable growth, and equals -f(0) at t=0).

Applying this twice gives the second-derivative version:

\mathcal L\{f''(t)\}=s^2F(s)-sf(0)-f'(0)

This is the entire payoff of the method: differentiation with respect to t becomes multiplication by s (with a correction for initial conditions) after transforming — exactly the way logarithms once turned multiplication into addition. A differential equation in y(t) becomes an algebraic equation in Y(s)=\mathcal L\{y(t)\}, already carrying the initial conditions built in from the start (no separate "solve for the constants" step needed at the end, unlike §13.5's method).

The method

  1. Take the Laplace transform of both sides of the differential equation, using the derivative property to replace y',y'' with algebraic expressions in Y(s) and the given initial conditions.
  2. Solve the resulting algebraic equation for Y(s).
  3. Recognize Y(s)'s pieces from the transform table (often after a partial-fraction decomposition, §4.9, to break Y(s) into simple recognizable pieces) and read off y(t)=\mathcal L^{-1}\{Y(s)\}.

Doing it in Python

Solving y''-3y'+2y=0, y(0)=1, y'(0)=0 via the Laplace transform — the exact equation and initial conditions from §13.5's worked example, used here as a cross-check:

import sympy as sp

s, t = sp.symbols('s t')
Y = sp.Function('Y')

# L{y''} - 3*L{y'} + 2*L{y} = 0, with y(0)=1, y'(0)=0
# s^2*Y - s*y(0) - y'(0) - 3*(s*Y - y(0)) + 2*Y = 0
Y_s = sp.Symbol('Y_s')
equation = sp.Eq(s**2*Y_s - s*1 - 0 - 3*(s*Y_s - 1) + 2*Y_s, 0)
Y_solution = sp.solve(equation, Y_s)[0]
print(f"Y(s) = {Y_solution}")

partial_fractions = sp.apart(Y_solution, s)
print(f"partial fractions: {partial_fractions}")

y_t = sp.inverse_laplace_transform(Y_solution, s, t)
print(f"y(t) = {sp.simplify(y_t)}")

Confirming the transform table entries directly from the integral definition:

import sympy as sp

s, t, a = sp.symbols('s t a', positive=True)

L_1 = sp.laplace_transform(1, t, s, noconds=True)
L_exp = sp.laplace_transform(sp.exp(a*t), t, s, noconds=True)
L_sin = sp.laplace_transform(sp.sin(a*t), t, s, noconds=True)

print(f"L{{1}} = {L_1}")
print(f"L{{e^(at)}} = {L_exp}")
print(f"L{{sin(at)}} = {L_sin}")

Confirming the derivative property directly, for a specific function:

import sympy as sp

s, t = sp.symbols('s t', positive=True)
f = sp.sin(t)
f_prime = sp.diff(f, t)

F = sp.laplace_transform(f, t, s, noconds=True)
direct_transform_of_derivative = sp.laplace_transform(f_prime, t, s, noconds=True)
predicted = s * F - f.subs(t, 0)

print(f"L{{f'}} computed directly = {direct_transform_of_derivative}")
print(f"s*F(s) - f(0) predicted  = {sp.simplify(predicted)}")

Worked example

Solve y''-3y'+2y=0, y(0)=1, y'(0)=0 using the Laplace transform.

Transform both sides, using \mathcal L\{y''\}=s^2Y-sy(0)-y'(0)=s^2Y-s and \mathcal L\{y'\}=sY-y(0)=sY-1:

\big(s^2Y-s\big)-3\big(sY-1\big)+2Y=0

Solve for Y(s):

Y\big(s^2-3s+2\big)=s-3\ \Longrightarrow\ Y(s)=\frac{s-3}{s^2-3s+2}=\frac{s-3}{(s-1)(s-2)}

Partial fractions (§4.9): $\dfrac{s-3}{(s-1)(s-2)}=\dfrac A{s-1}+\dfrac B{s-2}$. A(s-2)+B(s-1)=s-3. At s=1: -A=-2\Rightarrow A=2. At s=2: B=-1.

Y(s)=\frac2{s-1}-\frac1{s-2}

Invert, using \mathcal L\{e^{at}\}=\dfrac1{s-a} (from the table) read in reverse:

\boxed{y(t)=2e^t-e^{2t}}

Sanity check. This is exactly §13.5's answer to the identical initial value problem, found there entirely differently — via the characteristic equation and solving a 2\times2 linear system for the constants. Two structurally unrelated methods landing on the same function is a strong independent confirmation of both. Notice, too, that the Laplace method never needed a separate "apply initial conditions" step at the end — they were baked into Y(s) from the very first line, a genuine structural difference from §13.5's approach. ✓

Your turn

1. Using the transform table, find \mathcal L\{\cos(3t)\}.

2. Solve y'-2y=0, y(0)=5 using the Laplace transform (a first-order equation — only \mathcal L\{y'\}=sY-y(0) is needed).

3. True or false: the Laplace transform can only be applied to equations with constant coefficients.

Solutions

1. From the table, \mathcal L\{\cos(at)\}=\dfrac s{s^2+a^2} with a=3:

\boxed{\mathcal L\{\cos(3t)\}=\frac s{s^2+9}}

2. $\mathcal L{y'}-2\mathcal L{y}=0\Rightarrow(sY-5)-2Y=0 \Rightarrow Y(s-2)=5\Rightarrow Y=\dfrac5{s-2}$.

Reading directly from the table (\mathcal L\{e^{at}\}=\frac1{s-a}, here scaled by 5):

\boxed{y(t)=5e^{2t}}

(Matching the elementary separable solution from §13.1's own family of equations, y'=ky, with k=2, y_0=5.)

3. False. While this lesson (and most introductory treatments) only worked constant-coefficient examples, the Laplace transform's real strength — beyond what fit in this course's scope — is handling equations with discontinuous forcing terms: a switch flipped on at a specific time, a hammer-strike impulse, or other piecewise-defined right-hand sides that §13.6's undetermined coefficients has no table entry for at all. The transform converts these directly into algebra (via the Heaviside step function and its own transform rule) just as smoothly as it handled the polynomial right side here — a genuine reach beyond what any single-variable technique in this module could offer.

Check yourself in code

Solve y''-3y'+2y=0, y(0)=1, y'(0)=0 using the Laplace transform.

Print exactly this:

Y(s) = (s - 3)/(s**2 - 3*s + 2)
partial fractions: 2/(s - 1) - 1/(s - 2)
import sympy as sp

s, Y_s = sp.symbols('s Y_s')

equation = sp.Eq(s**2*Y_s - s*1 - 0 - 3*(s*Y_s - 1) + 2*Y_s, 0)
Y_solution = sp.solve(equation, Y_s)[0]
print("Y(s) = ...")

partial_fractions = sp.apart(Y_solution, s)
print("partial fractions: ...")
import sympy as sp

s, Y_s = sp.symbols('s Y_s')

equation = sp.Eq(s**2*Y_s - s*1 - 0 - 3*(s*Y_s - 1) + 2*Y_s, 0)
Y_solution = sp.solve(equation, Y_s)[0]
print(f"Y(s) = {Y_solution}")

partial_fractions = sp.apart(Y_solution, s)
print(f"partial fractions: {partial_fractions}")

The Laplace transform, F(s)=\int_0^\infty e^{-st}f(t)\,dt, converts differentiation into multiplication by s (with initial conditions built directly into the transformed equation), turning a differential equation into ordinary algebra — solve for Y(s), decompose with §4.9's partial fractions, and read y(t) back off a short transform table. Cross-checked against §13.5's characteristic-equation answer for the identical problem, the two independent methods agree exactly, and the transform's real advantage — reaching equations with discontinuous forcing that no other technique in this module can touch — extends well beyond this course's scope.

That closes this module's tour of differential equations — slope fields and Euler's method, three first-order exact-solving techniques, real-world models, second-order equations both homogeneous and forced, series solutions, systems, and the Laplace transform. Next: two closing modules applying this course's full toolkit — first to the calculus underneath machine learning, then to the rigorous foundations the whole course has been quietly resting on.