Approximating a curve with a polynomial
A Taylor series rebuilds a smooth function as an infinite sum of polynomial terms, each built from the function's derivatives at a single point. The idea is that if you know a function's value, slope, curvature, and every higher-order 'bendiness' at one point x = a, you know enough to reconstruct the whole function nearby - and often much further than 'nearby' actually suggests.
f(x) = f(a) + f'(a)(x-a) + f''(a)/2!·(x-a)² + f'''(a)/3!·(x-a)³ + ...
= Σ (from n=0 to ∞) f⁽ⁿ⁾(a)/n! · (x-a)ⁿ
Maclaurin series (a = 0), the three classics:
sin(x) = x - x³/3! + x⁵/5! - x⁷/7! + ...
cos(x) = 1 - x²/2! + x⁴/4! - x⁶/6! + ...
eⁿ = 1 + x + x²/2! + x³/3! + x⁴/4! + ...
Why factorials and powers, specifically
Each term is built to match one derivative exactly at x = a and leave every other captured derivative untouched. Differentiating the n-th term, (x-a) to the n over n!, exactly n times gives 1, and the n! in the denominator is precisely what cancels the n! that falls out of repeatedly differentiating x to the n - so the coefficient (the n-th derivative at a, divided by n!) is the unique choice that makes the polynomial's n-th derivative at a equal the true function's n-th derivative at a, for every n simultaneously. Truncate the infinite sum after the (x-a) to the N term and you get the Taylor polynomial of degree N - the best possible polynomial approximation of that degree in the sense that it matches the function and its first N derivatives exactly at the expansion point.
How fast the approximation improves
For sin and cos, doubling from a degree-2 to a degree-4 polynomial roughly squares the accuracy near x = 0, because each new term is smaller by a factor of about x squared over (n+1)(n+2) - for |x| well under 1 that shrinks very fast, which is why N = 5 already nails sin(x) to graphics-level precision for |x| under 2. The Lagrange remainder bounds exactly how wrong a degree-N truncation can be:
R_N(x) = f⁽ᴜ⁺¹⁾(ξ)/(N+1)! · (x-a)^(N+1) for some ξ between a and x for sin, cos: |f⁽ᴜ⁺¹⁾(ξ)| ≤ 1 always, so |R_N(x)| ≤ |x|^(N+1) / (N+1)!
That factorial in the denominator is doing the real work: (N+1)! grows faster than any fixed power of x, so for sin and cos the remainder eventually collapses to zero for every real x no matter how large - the series converges everywhere. e to the x behaves the same way, converging for all real x, which is why it is such a reliable building block in numerical libraries.
Where the polynomial gives up: the radius of convergence
Not every function is this cooperative. ln(1+x) and 1/(1-x) have Taylor series that only converge inside a radius of convergence - for both of these, |x| under 1 - because the function itself has a singularity (a point where it blows up or is undefined) at a finite distance from the expansion point, and no polynomial, however high degree, can reproduce a genuine blow-up. Outside that radius the partial sums do not merely lose accuracy slowly; they diverge outright, which is a useful reminder that 'more terms is always better' only holds inside the region where the series actually converges.
Why this matters beyond the math classroom
Taylor approximation is the quiet engine behind an enormous amount of applied computing. A CPU's implementation of sin(), cos() and exp() ultimately reduces the input to a small range and evaluates a short polynomial - often not the raw Taylor series but a refined variant (a minimax polynomial) that spreads the error evenly across the interval instead of concentrating it near the expansion point. Physics engines linearise nonlinear forces with a first-order Taylor term to keep simulations solvable each frame; Newton's method for root-finding is literally 'invert the degree-1 Taylor polynomial and repeat'; and error propagation in experimental science almost always starts by Taylor-expanding a measurement function to first order around the measured values.
Frequently asked questions
Why does the Taylor series for sin(x) use only odd powers of x?
Because sin(x) is an odd function (sin(-x) = -sin(x)), and every derivative of an odd function alternates between odd and even symmetry in a fixed pattern that forces every even-power coefficient in its Maclaurin expansion to be exactly zero, leaving only the x, x cubed, x to the fifth, ... terms.
How many terms do I need for a good approximation?
It depends on both the function and how far x is from the expansion point. For sin and cos near x = 0, five or six terms already give graphics-level accuracy out to about |x| less than 3-4; near the edge of a function's radius of convergence, even hundreds of terms may barely help, because the remainder shrinks slowly there.
Why do some Taylor series only work for a limited range of x?
If the function has a singularity - a point where it is undefined or blows up - at some finite distance from the expansion point, the series can only converge up to that distance, called the radius of convergence. ln(1+x) and 1/(1-x), both singular at x = -1 or x = 1 respectively, only converge for |x| less than 1.
Try it live
Everything above runs in your browser — open Taylor Series and change the parameters while it is running. Nothing is installed, nothing is uploaded, the whole model lives in one tab.
▶ Open Taylor Series simulation