← SciSim / Mathematics

Taylor & Maclaurin Series

Approximate any smooth function by polynomials — using only its derivatives at one point.
🎓 Tier: HSC → Standard Undergraduate

📊 Section 1 — Interactive Simulation

Pick a function $f$ and an expansion point $a$. Slide the order $N$ — watch the Taylor polynomial $T_N(x) = \sum_{k=0}^N \frac{f^{(k)}(a)}{k!}(x-a)^k$ wrap tighter and tighter around $f$. The error region shows where the partial sum diverges from $f$.

f(x) plot
f(x*) at probe
—
Tₙ(x*) at probe
—
|f − Tₙ| at x*
—
order N
—
k-th coefficient cₙ
—
expansion point a
—
distance |x* − a|
—
Lagrange bound
—

Animation

Function Preset

Parameters

Display Options

Tips

• Press ▶ Play to grow $N$ — see how the polynomial wraps further.
• Try 1/(1−x) with $a=0$: it diverges at $x=1$ (radius = 1).
• Try e^(−1/x²): every Maclaurin coefficient is 0, so $T_N \equiv 0$ but $f \neq 0$ — Taylor series can fail to represent the function!

🪜 Section 2 — The Idea, Step by Step

From "guess the road ahead" all the way to the Lagrange remainder — one gentle climb, no jumps.

Start Here — the everyday picture

Glance at your speedometer while walking. Knowing where you are and how fast you're going right now, you can already guess where you'll be a second from now — without watching the whole road. Taylor's idea is exactly this: if you know everything about a curve at one single point — its height, its slope, how that slope is bending, and so on — you can rebuild the whole curve nearby using nothing fancier than a polynomial. The more local detail you feed in, the further out your guess stays trustworthy.

Build · the first two guesses
The point you stand on is the expansion point $a$. The crudest guess is a flat line at the curve's height there: $T_0(x) = f(a)$. Add the slope and you get the tangent line, $T_1(x) = f(a) + f'(a)(x-a)$ — the "linear approximation" you may already know from physics. Worked number: for $f(x)=e^x$ at $a=0$ we have $f(0)=1$ and $f'(0)=1$, so $T_1(x)=1+x$. Then $e^{0.1}\approx 1.1$ versus the true $1.10517\ldots$ — off by only about $0.005$. Match the curvature too and the parabola $T_2$ does even better.
Deepen · matching one more derivative each time
Every extra derivative you match buys one more power of $(x-a)$. The full Taylor polynomial collects them all: $$T_N(x) = \sum_{k=0}^{N} \frac{f^{(k)}(a)}{k!}\,(x-a)^k,$$ where the $k!$ in each denominator is exactly what tames the fast-growing derivatives. How wrong you can be is pinned down by the Lagrange remainder $R_N(x) = \dfrac{f^{(N+1)}(\xi)}{(N+1)!}(x-a)^{N+1}$: that $(x-a)^{N+1}$ factor is the whole story — the fit is razor-sharp right at $a$ and frays the further you wander. In the sim above, the $N$ slider sets how many derivatives you match, $a$ slides the point you build from, and $x^*$ marks where the true $f$ and your polynomial are compared.

Try This in the Sim Above

1 · Watch it wrap. Pick $e^x$ and drag $N$ from $0$ upward — the orange polynomial hugs the blue curve over a wider and wider stretch.

2 · Hit the wall. Pick $1/(1-x)$ with $a=0$ and slide $x^*$ past $1$: the polynomial flies off no matter how large $N$ gets. You've crossed the radius of convergence $R=1$.

3 · See it fail. Pick $e^{-1/x^2}$: every coefficient is $0$, so $T_N$ stays pinned flat on the axis while the real function lifts away — a perfectly smooth function whose Taylor series refuses to rebuild it.

📐 Section 3 — Taylor's Theorem & Derivation

From the definition to the Lagrange remainder.

Taylor Polynomial & Series

If $f$ has $N+1$ continuous derivatives near $a$, the Taylor polynomial of order $N$ at $a$ is $$T_N(x) \;=\; \sum_{k=0}^{N} \frac{f^{(k)}(a)}{k!}\,(x-a)^k = f(a) + f'(a)(x-a) + \frac{f''(a)}{2!}(x-a)^2 + \cdots + \frac{f^{(N)}(a)}{N!}(x-a)^N.$$ The Maclaurin series is the special case $a=0$. The Taylor series is the limit: $$f(x) \overset{?}{=} \sum_{k=0}^{\infty} \frac{f^{(k)}(a)}{k!}\,(x-a)^k.$$ Equality holds when the remainder $R_N(x) = f(x) - T_N(x) \to 0$ as $N\to\infty$.

Taylor's Theorem (Lagrange Remainder)

If $f$ is $(N+1)$-times differentiable on the interval between $a$ and $x$, there exists $\xi$ strictly between $a$ and $x$ such that $$R_N(x) \;=\; f(x) - T_N(x) \;=\; \frac{f^{(N+1)}(\xi)}{(N+1)!}\,(x-a)^{N+1}.$$

In particular, if $\abs{f^{(N+1)}}\le M$ on $[a,x]$, then $\abs{R_N(x)} \le \dfrac{M}{(N+1)!}\abs{x-a}^{N+1}$ — the practical error bound.

Symbol Table

SymbolMeaningType
$f$ Function being approximated $(N+1)$-times differentiable near $a$
$a$ Expansion point — center of approximationReal
$f^{(k)}(a)$ $k$-th derivative of $f$ at $a$ Real, $f^{(0)}=f$
$T_N(x)$ Taylor polynomial of order $N$ at $a$ Polynomial in $x$, degree $\le N$
$c_k$ Taylor coefficient $f^{(k)}(a)/k!$ Real
$R_N(x)$ Remainder: $f(x) - T_N(x)$ Real, $\to 0$ inside radius of convergence
$R$ Radius of convergence $R \in [0,\infty]$, distance to nearest singularity in $\C$
$\xi$ Mean-value point in Lagrange remainder Strictly between $a$ and $x$

Derivation — Why $c_k = f^{(k)}(a)/k!$?

Step 1 · Suppose $f$ has a power series at $a$
Assume $f(x) = c_0 + c_1(x-a) + c_2(x-a)^2 + c_3(x-a)^3 + \cdots$ converges in some interval around $a$. The goal: solve for the $c_k$'s in terms of $f$.
Step 2 · Plug in $x=a$ to recover $c_0$
All terms with $(x-a)^k$ for $k \geq 1$ vanish: $f(a) = c_0$. So $c_0 = f(a)$.
Step 3 · Differentiate and plug in $x=a$ for $c_1$
$f'(x) = c_1 + 2c_2(x-a) + 3c_3(x-a)^2 + \cdots$. At $x=a$: $f'(a) = c_1$, so $c_1 = f'(a)$.
Step 4 · Differentiate twice for $c_2$
$f''(x) = 2 c_2 + 6 c_3(x-a) + 12 c_4 (x-a)^2 + \cdots = 2!\,c_2 + 3!\,c_3(x-a) + \cdots$. At $x=a$: $f''(a) = 2!\,c_2$, so $c_2 = f''(a)/2!$.
Step 5 · General coefficient — pattern
Differentiate $k$ times and set $x=a$: every term except the $k$-th vanishes, and the $k$-th becomes $k!\,c_k$. So $f^{(k)}(a) = k!\,c_k$, giving $\boxed{c_k = \dfrac{f^{(k)}(a)}{k!}.}$
Step 6 · Lagrange remainder via repeated integration by parts
Apply the Fundamental Theorem of Calculus and integrate by parts $N$ times: $f(x) - f(a) = \int_a^x f'(t)\,dt = (x-a)f'(a) + \int_a^x (x-t)f''(t)\,dt$, and continuing: $f(x) = T_N(x) + \dfrac{1}{N!}\int_a^x (x-t)^N f^{(N+1)}(t)\,dt$. By the integral mean-value theorem, this equals $\dfrac{f^{(N+1)}(\xi)}{(N+1)!}(x-a)^{N+1}$ for some $\xi$ between $a$ and $x$.
Step 7 · When does $T_N \to f$?
$T_N(x) \to f(x)$ iff $R_N(x) \to 0$. Sufficient condition: $\abs{f^{(N+1)}(\xi)}/(N+1)! \to 0$ on the interval. For $e^x$: derivatives bounded by $e^{|x|}$, factorial dominates, $R_N \to 0$ everywhere — radius is infinity. For $1/(1-x)$ at $a=0$: derivatives blow up, radius is exactly 1.

Simulation ↔ Symbol Mapping

slider N order of the Taylor polynomial $T_N$
slider a expansion point — series is centered at $a$
slider x* probe — point at which to compare $f(x^*)$ vs $T_N(x^*)$
readout cₙ $N$-th Taylor coefficient $f^{(N)}(a)/N!$
readout |f − Tₙ| actual remainder magnitude at $x^*$
readout Lagrange bound$M\abs{x^*-a}^{N+1}/(N+1)!$ where $M = \sup\abs{f^{(N+1)}}$ on $[a, x^*]$
graph Error vs N $\log\abs{R_N(x^*)}$ vs $N$ — for entire functions, super-exponential decay
graph radius visualize convergence radius; outside it, $T_N(x)$ diverges as $N\to\infty$

Worked Example — Maclaurin Series of $\sin(x)$, $\cos(x)$, $e^x$

$e^x$ at $a=0$: all derivatives are $e^0 = 1$, so $c_k = 1/k!$. Thus $e^x = \sum_{k=0}^\infty \dfrac{x^k}{k!} = 1 + x + \dfrac{x^2}{2!} + \dfrac{x^3}{3!} + \cdots$. Radius $R = \infty$.

$\sin(x)$ at $a=0$: derivatives cycle $\sin\to\cos\to-\sin\to-\cos\to\sin\to\cdots$, so $f^{(k)}(0) = 0, 1, 0, -1, 0, 1, \ldots$. Result: $\sin x = \sum_{k=0}^\infty \dfrac{(-1)^k x^{2k+1}}{(2k+1)!} = x - \dfrac{x^3}{3!} + \dfrac{x^5}{5!} - \cdots$. $R = \infty$.

$\cos(x)$ at $a=0$: similarly, $\cos x = \sum_{k=0}^\infty \dfrac{(-1)^k x^{2k}}{(2k)!} = 1 - \dfrac{x^2}{2!} + \dfrac{x^4}{4!} - \cdots$. $R = \infty$.

Numerical check: $\sin(0.5)$ true value $0.479425539\ldots$. $T_5(0.5) = 0.5 - 0.5^3/6 + 0.5^5/120 = 0.5 - 0.020833\ldots + 0.000260\ldots = 0.479427\ldots$. Error $\approx 1.5\times 10^{-6}$ — Lagrange bound: $\abs{x}^7/7! = 0.5^7/5040 \approx 1.55\times 10^{-6}$. Matches!

Famous identity: Combine these to get $e^{ix} = \cos x + i \sin x$ (Euler) by checking series coefficients term-by-term. $\boxed{e^{i\pi} + 1 = 0.}$

Reference: Stewart, J. — Calculus, 8th ed., Ch. 11 §11.10 "Taylor and Maclaurin Series"; Spivak, M. — Calculus, 4th ed., Ch. 24 (Taylor's theorem with full rigor); Apostol, T. — Calculus, Vol. 1, §7.7–§7.8; Rudin, W. — Principles of Mathematical Analysis, 3rd ed., Theorem 5.15 (Taylor's theorem on $\R$); Bromwich, T. — An Introduction to the Theory of Infinite Series, classical treatment.

❓ Section 4 — Frequently Asked Questions

🧮Conceptual What's the difference between a Taylor polynomial and a Taylor series?▶

A Taylor polynomial $T_N(x)$ is finite — a polynomial of degree $\leq N$. It always exists for any $N$ when $f$ is $N$-times differentiable, and it's an approximation: $f(x) = T_N(x) + R_N(x)$, with the remainder $R_N$ measurable but generally nonzero. The Taylor series is the infinite sum $\sum_{k=0}^\infty f^{(k)}(a)(x-a)^k/k!$ — it's a limit object that may or may not converge, and even if it converges, may not equal $f$ (see the bump-function example). So: polynomial = approximation tool with explicit error, series = formal infinite object that's only useful when it converges to $f$.

Key takeaway: Taylor polynomials always exist; Taylor series may diverge or converge to the wrong function.
🔬Simulation What does "Term-by-term Build-up" mode show?▶

It animates how each new term $\dfrac{f^{(k)}(a)}{k!}(x-a)^k$ contributes to the partial sum. Mode shows $T_0 = f(a)$ (a horizontal line), then $T_1$ adds the tangent slope (linear approximation), $T_2$ adds the parabola correction, $T_3$ adds the cubic, and so on — each term highlights in a different color and its contribution is plotted alongside. You can clearly see the Taylor polynomial "wrap" further around $f$: $T_2$ matches function value + slope + curvature at $a$; $T_3$ matches up to the third derivative, and so on. By order $N$, $T_N$ matches all derivatives up to order $N$ at $a$ exactly.

Key takeaway: each term adds one more derivative-matched contribution at $a$; the polynomial gets better only near $a$.
🌍Applied Where do Taylor series get used in practice?▶

Almost everywhere a non-polynomial function meets a computer. CPUs compute $\sin, \cos, \exp, \log$ via low-order polynomial approximations (often Chebyshev-modified Taylor) — your hardware multiplies and adds, that's it. Physics: small-angle approximation $\sin\theta \approx \theta$ is $T_1$; pendulum equation linearization for SHM. Numerical methods: Newton's method's quadratic convergence comes from Taylor expansion. ODE solvers: Runge-Kutta methods are Taylor-series-matched at intermediate points. Machine learning: gradient descent uses $T_1$, Newton uses $T_2$ (the Hessian). Statistics: delta method approximates variance of $g(X)$ via $T_1$ around $\E[X]$. Quantum mechanics: time-evolution operator $e^{-iHt/\hbar}$ expanded in $t$.

Key takeaway: every computer's transcendental function is a Taylor-style polynomial; small-angle / linearization tricks in physics are $T_1$.
💡Non-Obvious Why does $1/(1-x)$ have radius of convergence 1, but no real singularity is at $x=\pm 1$ for $1/(1+x^2)$?▶

The radius of convergence is determined by the nearest singularity in the complex plane, not just the real line. $1/(1-x)$ has a real singularity at $x=1$ — distance 1 from origin, so $R=1$. $1/(1+x^2)$ has no real singularities, but factoring over $\C$: $1+x^2 = (1+ix)(1-ix)$ — singularities at $x=\pm i$, complex distance from 0 is exactly 1. So the Maclaurin series $1 - x^2 + x^4 - x^6 + \cdots$ converges only for $\abs{x}<1$. This is Carl Friedrich Gauss's deep insight: Taylor series "see" complex singularities even when computed only with real values. This is why $1/(1+x^2)$ misbehaves at $x=\pm 1$ even though $f$ is smooth there.

Key takeaway: radius of convergence = distance to nearest complex singularity. Real-line smoothness isn't enough.
📐Computational How many terms do I need for $\eps$-accuracy when computing $\sin(x)$?▶

Use the Lagrange bound: $\abs{R_N(x)} \le \dfrac{1}{(N+1)!}\abs{x}^{N+1}$ since $\abs{\sin^{(k)}}\le 1$. For $\sin(\pi/4)$: need $(\pi/4)^{N+1}/(N+1)! < \eps$. For $\eps = 10^{-6}$: $N=7$ suffices — and because $\sin$'s degree-8 term vanishes, $T_7 = T_8$, so the sharper bound is $(\pi/4)^9/9! \approx 3\times 10^{-7}$ (note $(\pi/4)^8/8! \approx 3.6\times 10^{-6}$ alone would not clear $10^{-6}$). For $\eps = 10^{-15}$ (machine precision): $N=15$. Practical CPUs use a smarter trick: range reduction (use $\sin(x+2\pi k) = \sin(x)$ to bring $x$ to $[-\pi/4, \pi/4]$), then a low-degree minimax polynomial — typically degree 7 or 11 — chosen by Remez algorithm to minimize maximum error rather than error at one point. So Taylor itself is rarely used in CPUs; its idea is.

Key takeaway: $N=7$ Taylor terms give $\sin$ to $10^{-6}$; CPUs use cleverer minimax polynomials of similar low degree.
🎓Deep / Advanced What's the connection between Taylor series and complex analysis?▶

It's profound. In real analysis, "smooth" (infinitely differentiable) functions can have Taylor series that don't converge, or converge to the wrong function ($e^{-1/x^2}$ is smooth at 0 with all derivatives = 0, but is nonzero elsewhere). In complex analysis, the situation is much cleaner: a function holomorphic on a disk is automatically equal to its Taylor series there. This is Cauchy's integral theorem + Cauchy's formula: $f^{(n)}(a) = \dfrac{n!}{2\pi i}\oint \dfrac{f(z)}{(z-a)^{n+1}}\,dz$. The radius of convergence is exactly the distance to the nearest singularity in $\C$. Functions that equal their Taylor series everywhere are called analytic (or "real-analytic" on $\R$). Holomorphic ⇒ analytic in $\C$, but not in $\R$ — that's why complex analysis is so much "nicer".

Key takeaway: in $\C$, holomorphic = analytic, automatically. In $\R$, smooth ≠ analytic. Complex analysis is where Taylor really lives.
🧮Conceptual Why does the Taylor polynomial only approximate well near $a$?▶

Because of the $(x-a)^{N+1}$ factor in the remainder: $\abs{R_N(x)} \le M\abs{x-a}^{N+1}/(N+1)!$. When $\abs{x-a}$ is small, this is tiny — even for low $N$. When $\abs{x-a}$ is moderate, you need large $N$ to overcome the $(x-a)^{N+1}$ factor. When $\abs{x-a}$ exceeds the radius of convergence, no $N$ helps: the remainder grows. Geometrically: $T_N$ matches all derivatives at $a$, so it agrees with $f$ "infinitely closely" at $a$ — but it has no information about $f$'s behavior far from $a$. The polynomial extrapolates based purely on what it sees near $a$, which is only locally meaningful.

Key takeaway: $(x-a)^{N+1}$ factor makes Taylor a local tool; for global approximation use Chebyshev or Fourier.
Best resource: 3Blue1Brown — "Taylor series" (Essence of Calculus, Ch. 11); Paul's Online Math Notes — "Taylor Series" (https://tutorial.math.lamar.edu/Classes/CalcII/TaylorSeries.aspx); MIT OCW 18.01 — Single Variable Calculus, Lec 38–39; Better Explained — "Taylor Series"; Khan Academy — Calculus, Series & Taylor; Wolfram MathWorld — Taylor Series.

⚠️ Section 5 — Misconceptions & Common Errors

A · Conceptual Misconceptions
❌ Misconception: "If $f$ is infinitely differentiable, its Taylor series equals $f$." ✅ Correction: Not in general on $\R$. The classic counterexample is $f(x) = e^{-1/x^2}$ for $x\neq 0$ and $f(0)=0$. This $f$ is $C^\infty$ at 0 with $f^{(k)}(0) = 0$ for all $k$. So its Maclaurin series is identically zero — but $f \neq 0$ for $x\neq 0$. Thus the Taylor series converges (to 0) but to the wrong function. Functions that do equal their Taylor series locally are called real-analytic; this is a strictly smaller class than $C^\infty$. In complex analysis, holomorphic ⇒ analytic, no such pathology occurs. 📖 Reference: Spivak — Calculus, 4th ed., Ch. 24 (Cauchy's bump function counterexample).
❌ Misconception: "Higher order $N$ always gives better approximation." ✅ Correction: Only inside the radius of convergence. Outside $R$, increasing $N$ makes things worse — the partial sums diverge to $\pm\infty$. Example: $1/(1-x) = 1 + x + x^2 + \cdots$ for $\abs x < 1$. At $x=2$, $T_5 = 63$ but the true value is $-1$ — $T_N$ blows up to $+\infty$. Even inside $R$, increasing $N$ helps fast near $a$ but slowly near the boundary. 📖 Reference: Apostol — Calculus, Vol. 1, §10.7 (radius of convergence).
❌ Misconception: "The Taylor series of $f$ at $a$ depends only on $f$, not on $a$." ✅ Correction: Different expansion points give different series, even of the same function. $1/(1-x)$ at $a=0$ is $1+x+x^2+\cdots$ with $R=1$. At $a=2$: $1/(1-x) = 1/((1-2)-(x-2)) = -1/(1+(x-2)) = -1 + (x-2) - (x-2)^2 + (x-2)^3 - \cdots$ — different coefficients, different domain $\abs{x-2}<1$ (covering $1 📖 Reference: Stewart — Calculus, 8th ed., Ch. 11 §11.10 (different expansion points).
B · Common Procedural Errors
❌ Error: "Maclaurin series of $\sin(x)$: $T_3 = x - x^3 + x^5/2 - \cdots$" ✅ Correct: $T_3 = x - \dfrac{x^3}{3!} = x - \dfrac{x^3}{6}$. The factorials are critical: $3! = 6$, $5! = 120$, $7! = 5040$. The student dropped the factorials. Justifying rule: the $k$-th coefficient is $f^{(k)}(0)/k!$; the $k!$ is part of the Taylor formula by definition, and forgetting it causes the series to oscillate wildly instead of converging smoothly. 🔍 Why students do this: confuse the series of $\sin(x)$ ($x - x^3/6 + x^5/120 - \cdots$) with formal power series patterns where coefficients come "out of the blue" without factorials.
❌ Error: "Taylor series of $f(x) = e^x$ around $a=2$: $1 + (x-2) + (x-2)^2/2! + \cdots$" ✅ Correct: The coefficients are $f^{(k)}(a)/k! = e^a/k! = e^2/k!$, not $1/k!$. So $e^x = e^2 \big[1 + (x-2) + (x-2)^2/2! + (x-2)^3/3! + \cdots\big] = \sum_{k=0}^\infty \dfrac{e^2}{k!}(x-2)^k$. The $e^2$ factor is essential — it's the value of all derivatives at $a=2$. Justifying rule: $c_k = f^{(k)}(a)/k!$, and for $f=e^x$, $f^{(k)}(x) = e^x$ regardless of $k$, so $f^{(k)}(2) = e^2$. 🔍 Why students do this: memorize the Maclaurin series and forget that the coefficients evaluate at $a$, not at 0.
❌ Error: "$\ln(x) = x - x^2/2 + x^3/3 - \cdots$ for $\abs x<1$" ✅ Correct: That's the series for $\ln(1+x)$, not $\ln(x)$. $\ln(x)$ is undefined at $x=0$, so it has no Maclaurin series at all. The substitution $x \mapsto 1+x$ gives the standard form: $\ln(1+x) = x - \dfrac{x^2}{2} + \dfrac{x^3}{3} - \cdots = \sum_{k=1}^\infty \dfrac{(-1)^{k+1}x^k}{k}$ valid for $-1 < x \leq 1$. To expand $\ln(x)$ at $a=1$: $\ln(x) = (x-1) - (x-1)^2/2 + (x-1)^3/3 - \cdots$ for $0 < x \leq 2$. Justifying rule: Taylor series at $a$ is in powers of $(x-a)$, not $x$. 🔍 Why students do this: confuse "series of $\ln(1+x)$" (a Maclaurin series) with "series of $\ln(x)$" (must be centered elsewhere).
Education research: Martin, J. — "Differences between experts' and students' conceptual images of the mathematical structure of Taylor series convergence", Educational Studies in Mathematics 82(2), 267–283 (2013); Kidron, I. & Zehavi, N. — "The role of animation in teaching the limit concept", ZDM 34(5) (2002); Alcock, L. & Simpson, A. — "Convergence of sequences and series: Interactions between visual reasoning and the learner's beliefs", Educational Studies in Mathematics 58(1), 77–100 (2005); González-Martín, A., Nardi, E. & Biza, I. — "Conceptually-driven and visually-rich tasks in texts and teaching practice: the case of infinite series", IJMEST 42(5), 565–589 (2011).