← Math|29 of 100
Calculus

Taylor Series and Approximations

Master Taylor and Maclaurin series, convergence, and their use in function approximation.

πŸ“‚ SeriesπŸ“– Lesson 29 of 100πŸŽ“ Free Course

Advertisement

Why It Matters

ℹ️ Why It Matters

Taylor series are one of the most powerful tools in mathematics, providing a bridge between complicated functions and simple polynomials. They allow us to:

  • Linearize nonlinear functions locally (the foundation of Newton's method and gradient descent analysis)
  • Approximate transcendental functions like exe^x, sin⁑x\sin x, and ln⁑x\ln x using only arithmetic operations
  • Analyze function behavior near a point using derivative information alone
  • Derive fundamental results in physics, engineering, and machine learning Every time you use np.exp(), np.sin(), or np.log() in code, the underlying computation relies on polynomial approximations rooted in Taylor series. Understanding them gives you insight into numerical computing, optimization, and the behavior of neural networks near initialization.

What is a Taylor Series

DfTaylor Series

A Taylor series represents a function f(x)f(x) as an infinite sum of terms calculated from the values of its derivatives at a single point aa. If ff is infinitely differentiable at aa, the Taylor series of ff about aa is:

f(x)=f(a)+fβ€²(a)(xβˆ’a)+fβ€²β€²(a)2!(xβˆ’a)2+fβ€²β€²β€²(a)3!(xβˆ’a)3+β‹―f(x) = f(a) + f'(a)(x-a) + \frac{f''(a)}{2!}(x-a)^2 + \frac{f'''(a)}{3!}(x-a)^3 + \cdots

Taylor Series (General Form)

f(x)=βˆ‘n=0∞f(n)(a)n!(xβˆ’a)nf(x) = \sum_{n=0}^{\infty}\frac{f^{(n)}(a)}{n!}(x-a)^n

Here,

  • f(n)(a)f^{(n)}(a)=The nth derivative of f evaluated at the center point a
  • aa=The center (expansion point) of the series
  • n!n!=Factorial of n (1Β·2Β·3Β·...Β·n)
  • (xβˆ’a)n(x-a)^n=The nth power of the distance from a

ℹ️ Intuition

Think of a Taylor series as building a polynomial approximation piece by piece:

  1. The 0th term f(a)f(a) matches the function value at aa
  2. The 1st term fβ€²(a)(xβˆ’a)f'(a)(x-a) matches the slope at aa
  3. The 2nd term fβ€²β€²(a)2!(xβˆ’a)2\frac{f''(a)}{2!}(x-a)^2 matches the curvature at aa
  4. Each higher-order term captures finer details of the function's shape

The more terms you include, the better the approximation becomes β€” and for many functions, the infinite sum converges to the exact function value.


Maclaurin Series

A Maclaurin series is simply a Taylor series centered at a=0a = 0. It is the most commonly used form because derivatives at zero are often easier to compute.

Maclaurin Series

f(x)=βˆ‘n=0∞f(n)(0)n!xn=f(0)+fβ€²(0)x+fβ€²β€²(0)2!x2+fβ€²β€²β€²(0)3!x3+β‹―f(x) = \sum_{n=0}^{\infty}\frac{f^{(n)}(0)}{n!}x^n = f(0) + f'(0)x + \frac{f''(0)}{2!}x^2 + \frac{f'''(0)}{3!}x^3 + \cdots

Here,

  • f(n)(0)f^{(n)}(0)=The nth derivative of f evaluated at 0
  • n!n!=Factorial of n
  • xnx^n=The nth power of x (no shift needed since a=0)

πŸ“Deriving the Maclaurin Series for $e^x$

Problem: Find the Maclaurin series for f(x)=exf(x) = e^x.

Solution:

  • f(x)=exβ‡’f(0)=1f(x) = e^x \Rightarrow f(0) = 1
  • fβ€²(x)=exβ‡’fβ€²(0)=1f'(x) = e^x \Rightarrow f'(0) = 1
  • fβ€²β€²(x)=exβ‡’fβ€²β€²(0)=1f''(x) = e^x \Rightarrow f''(0) = 1
  • In general, f(n)(0)=1f^{(n)}(0) = 1 for all nn

Substituting into the Maclaurin formula:

ex=βˆ‘n=0∞xnn!=1+x+x22!+x33!+x44!+β‹―e^x = \sum_{n=0}^{\infty}\frac{x^n}{n!} = 1 + x + \frac{x^2}{2!} + \frac{x^3}{3!} + \frac{x^4}{4!} + \cdots

This series converges for all x∈Rx \in \mathbb{R}.


Common Taylor Expansions

Memorizing these standard expansions is essential β€” they appear constantly in calculus, differential equations, and numerical methods.

FunctionMaclaurin SeriesConvergence Domain
exe^xβˆ‘n=0∞xnn!=1+x+x22!+x33!+β‹―\displaystyle\sum_{n=0}^{\infty}\frac{x^n}{n!} = 1 + x + \frac{x^2}{2!} + \frac{x^3}{3!} + \cdotsAll xx
sin⁑x\sin xβˆ‘n=0∞(βˆ’1)nx2n+1(2n+1)!=xβˆ’x33!+x55!βˆ’β‹―\displaystyle\sum_{n=0}^{\infty}\frac{(-1)^n x^{2n+1}}{(2n+1)!} = x - \frac{x^3}{3!} + \frac{x^5}{5!} - \cdotsAll xx
cos⁑x\cos xβˆ‘n=0∞(βˆ’1)nx2n(2n)!=1βˆ’x22!+x44!βˆ’β‹―\displaystyle\sum_{n=0}^{\infty}\frac{(-1)^n x^{2n}}{(2n)!} = 1 - \frac{x^2}{2!} + \frac{x^4}{4!} - \cdotsAll xx
ln⁑(1+x)\ln(1+x)βˆ‘n=1∞(βˆ’1)n+1xnn=xβˆ’x22+x33βˆ’β‹―\displaystyle\sum_{n=1}^{\infty}\frac{(-1)^{n+1} x^n}{n} = x - \frac{x^2}{2} + \frac{x^3}{3} - \cdotsβˆ’1<x≀1-1 < x \leq 1
11βˆ’x\frac{1}{1-x}βˆ‘n=0∞xn=1+x+x2+x3+β‹―\displaystyle\sum_{n=0}^{\infty} x^n = 1 + x + x^2 + x^3 + \cdotsβˆ₯xβˆ₯<1\|x\| < 1
11+x\frac{1}{1+x}βˆ‘n=0∞(βˆ’1)nxn=1βˆ’x+x2βˆ’x3+β‹―\displaystyle\sum_{n=0}^{\infty} (-1)^n x^n = 1 - x + x^2 - x^3 + \cdotsβˆ₯xβˆ₯<1\|x\| < 1
arctan⁑x\arctan xβˆ‘n=0∞(βˆ’1)nx2n+12n+1=xβˆ’x33+x55βˆ’β‹―\displaystyle\sum_{n=0}^{\infty}\frac{(-1)^n x^{2n+1}}{2n+1} = x - \frac{x^3}{3} + \frac{x^5}{5} - \cdotsβˆ₯xβˆ₯≀1\|x\| \leq 1
sinh⁑x\sinh xβˆ‘n=0∞x2n+1(2n+1)!=x+x33!+x55!+β‹―\displaystyle\sum_{n=0}^{\infty}\frac{x^{2n+1}}{(2n+1)!} = x + \frac{x^3}{3!} + \frac{x^5}{5!} + \cdotsAll xx
cosh⁑x\cosh xβˆ‘n=0∞x2n(2n)!=1+x22!+x44!+β‹―\displaystyle\sum_{n=0}^{\infty}\frac{x^{2n}}{(2n)!} = 1 + \frac{x^2}{2!} + \frac{x^4}{4!} + \cdotsAll xx
(1+x)Ξ±(1+x)^\alphaβˆ‘n=0∞(Ξ±n)xn=1+Ξ±x+Ξ±(Ξ±βˆ’1)2!x2+β‹―\displaystyle\sum_{n=0}^{\infty}\binom{\alpha}{n} x^n = 1 + \alpha x + \frac{\alpha(\alpha-1)}{2!}x^2 + \cdotsβˆ₯xβˆ₯<1\|x\| < 1

πŸ’‘ Pattern Recognition

  • Odd functions (sin⁑x\sin x, arctan⁑x\arctan x, sinh⁑x\sinh x) have only odd powers
  • Even functions (cos⁑x\cos x, cosh⁑x\cosh x) have only even powers
  • The series for ln⁑(1+x)\ln(1+x) and arctan⁑x\arctan x have no factorial in the denominator
  • The geometric series 11βˆ’x\frac{1}{1-x} is the foundation for many other expansions

Convergence

Not every Taylor series converges to its original function. Understanding convergence is critical.

ThRadius of Convergence

For a power series βˆ‘n=0∞cn(xβˆ’a)n\displaystyle\sum_{n=0}^{\infty} c_n (x-a)^n, there exists a radius Rβ‰₯0R \geq 0 such that:

  • The series converges absolutely for ∣xβˆ’a∣<R|x-a| < R
  • The series diverges for ∣xβˆ’a∣>R|x-a| > R
  • At the boundary ∣xβˆ’a∣=R|x-a| = R, convergence must be checked separately

The radius can be computed using the Ratio Test:

R=lim⁑nβ†’βˆžβˆ£cncn+1∣R = \lim_{n \to \infty} \left|\frac{c_n}{c_{n+1}}\right|

or equivalently:

1R=lim⁑nβ†’βˆžβˆ£cn+1cn∣\frac{1}{R} = \lim_{n \to \infty} \left|\frac{c_{n+1}}{c_n}\right|

πŸ“Finding the Radius of Convergence

Problem: Find the radius of convergence for βˆ‘n=0∞xnn!\displaystyle\sum_{n=0}^{\infty} \frac{x^n}{n!}.

Solution: Let cn=1n!c_n = \frac{1}{n!}. Then:

1R=lim⁑nβ†’βˆžβˆ£cn+1cn∣=lim⁑nβ†’βˆžn!(n+1)!=lim⁑nβ†’βˆž1n+1=0\frac{1}{R} = \lim_{n \to \infty} \left|\frac{c_{n+1}}{c_n}\right| = \lim_{n \to \infty} \frac{n!}{(n+1)!} = \lim_{n \to \infty} \frac{1}{n+1} = 0

Therefore R=∞R = \infty, meaning the series converges for all xx. This is why exe^x can be evaluated for any real number.

⚠️ Convergence Caveats

  • A Taylor series may converge but not to the original function (e.g., f(x)=eβˆ’1/x2f(x) = e^{-1/x^2} for xβ‰ 0x \neq 0, f(0)=0f(0)=0)
  • This happens when the function is not analytic β€” the remainder Rn(x)R_n(x) does not tend to zero
  • For most elementary functions encountered in practice, the Taylor series does converge to the function within its radius of convergence

Taylor's Theorem with Remainder

ThTaylor's Theorem (Lagrange Remainder)

If ff is (n+1)(n+1)-times differentiable on an interval containing aa and xx, then:

f(x)=βˆ‘k=0nf(k)(a)k!(xβˆ’a)k⏟Pn(x)Β (TaylorΒ polynomial)+Rn(x)⏟Remainderf(x) = \underbrace{\sum_{k=0}^{n}\frac{f^{(k)}(a)}{k!}(x-a)^k}_{P_n(x) \text{ (Taylor polynomial)}} + \underbrace{R_n(x)}_{\text{Remainder}}

where the Lagrange form of the remainder is:

Rn(x)=f(n+1)(c)(n+1)!(xβˆ’a)n+1R_n(x) = \frac{f^{(n+1)}(c)}{(n+1)!}(x-a)^{n+1}

for some cc between aa and xx.

Lagrange Remainder (Error Bound)

∣Rn(x)∣=∣f(n+1)(c)(n+1)!(xβˆ’a)n+1βˆ£β‰€M(n+1)!∣xβˆ’a∣n+1|R_n(x)| = \left|\frac{f^{(n+1)}(c)}{(n+1)!}(x-a)^{n+1}\right| \leq \frac{M}{(n+1)!}|x-a|^{n+1}

Here,

  • Rn(x)R_n(x)=The remainder (error) after n terms
  • cc=Some unknown point between a and x
  • MM=An upper bound: $M \geq \max_{t \in [a,x]} |f^{(n+1)}(t)|$
  • aa=The center of the expansion

πŸ“Bounding the Error

Problem: Approximate e0.1e^{0.1} using the first 4 terms of the Maclaurin series for exe^x. Bound the error.

Solution: The first 4 terms give:

e0.1β‰ˆ1+0.1+(0.1)22+(0.1)36=1+0.1+0.005+0.00016β€Ύ=1.105166β€Ύe^{0.1} \approx 1 + 0.1 + \frac{(0.1)^2}{2} + \frac{(0.1)^3}{6} = 1 + 0.1 + 0.005 + 0.0001\overline{6} = 1.10516\overline{6}

For the error bound, note that f(4)(x)=exf^{(4)}(x) = e^x, so on [0,0.1][0, 0.1]:

M=e0.1<e1<3M = e^{0.1} < e^1 < 3

Therefore:

∣R3(0.1)βˆ£β‰€34!(0.1)4=324Γ—10βˆ’4=1.25Γ—10βˆ’5|R_3(0.1)| \leq \frac{3}{4!}(0.1)^4 = \frac{3}{24} \times 10^{-4} = 1.25 \times 10^{-5}

The true value is e0.1β‰ˆ1.105170918...e^{0.1} \approx 1.105170918..., so the actual error is about 4.2Γ—10βˆ’64.2 \times 10^{-6}, well within our bound.


Approximation Applications

Taylor series are used to compute function values efficiently in practice.

πŸ“Computing $\sin(0.5)$ by Hand

Problem: Use the Maclaurin series for sin⁑x\sin x to compute sin⁑(0.5)\sin(0.5) to 4 decimal places.

Solution: The series is sin⁑x=xβˆ’x33!+x55!βˆ’x77!+β‹―\sin x = x - \frac{x^3}{3!} + \frac{x^5}{5!} - \frac{x^7}{7!} + \cdots

With x=0.5x = 0.5:

  • Term 1: 0.5=0.50.5 = 0.5
  • Term 2: βˆ’(0.5)36=βˆ’0.1256β‰ˆβˆ’0.02083-\frac{(0.5)^3}{6} = -\frac{0.125}{6} \approx -0.02083
  • Term 3: (0.5)5120=0.03125120β‰ˆ0.00026\frac{(0.5)^5}{120} = \frac{0.03125}{120} \approx 0.00026
  • Term 4: βˆ’(0.5)75040β‰ˆβˆ’0.0000015-\frac{(0.5)^7}{5040} \approx -0.0000015

Sum: sin⁑(0.5)β‰ˆ0.5βˆ’0.02083+0.00026βˆ’0.0000015β‰ˆ0.47943\sin(0.5) \approx 0.5 - 0.02083 + 0.00026 - 0.0000015 \approx 0.47943

Exact value: sin⁑(0.5)β‰ˆ0.4794255...\sin(0.5) \approx 0.4794255..., so 4 terms give accuracy to 6 decimal places.

πŸ“Computing $\pi$ Using $\arctan$

Problem: How many terms of the arctan⁑x\arctan x series are needed to compute Ο€\pi to 10 decimal places using Ο€=4arctan⁑(1)\pi = 4\arctan(1)?

Solution: Using arctan⁑(1)=1βˆ’13+15βˆ’17+β‹―\arctan(1) = 1 - \frac{1}{3} + \frac{1}{5} - \frac{1}{7} + \cdots, the error after nn terms is bounded by 12n+1\frac{1}{2n+1}.

For 10 decimal places: 12n+1<10βˆ’10\frac{1}{2n+1} < 10^{-10}, so n>5Γ—109n > 5 \times 10^9.

This is impractical! Better to use the identity:

Ο€4=4arctan⁑(15)βˆ’arctan⁑(1239)\frac{\pi}{4} = 4\arctan\left(\frac{1}{5}\right) - \arctan\left(\frac{1}{239}\right)

which converges much faster.


Polynomial Approximation

DfTaylor Polynomial

The nnth-degree Taylor polynomial of ff about aa is the partial sum:

Pn(x)=βˆ‘k=0nf(k)(a)k!(xβˆ’a)kP_n(x) = \sum_{k=0}^{n}\frac{f^{(k)}(a)}{k!}(x-a)^k

This is the best polynomial approximation of degree nn in the sense that it matches ff and its first nn derivatives at x=ax = a.

ℹ️ Choosing the Right Number of Terms

The number of terms needed depends on:

  1. How far xx is from the center aa (larger ∣xβˆ’a∣|x-a| needs more terms)
  2. How accurate you need the result (more terms = smaller error)
  3. The behavior of higher derivatives (if they grow slowly, fewer terms suffice)

Rule of thumb: For exe^x near x=0x=0, 10 terms give about 7 digits of accuracy for ∣x∣<1|x| < 1. For sin⁑x\sin x and cos⁑x\cos x, 5 terms often suffice for ∣x∣<0.5|x| < 0.5.

Error in Polynomial Approximation

∣f(x)βˆ’Pn(x)βˆ£β‰€Mn+1(n+1)!∣xβˆ’a∣n+1|f(x) - P_n(x)| \leq \frac{M_{n+1}}{(n+1)!}|x-a|^{n+1}

Here,

  • Pn(x)P_n(x)=The nth-degree Taylor polynomial
  • Mn+1M_{n+1}=Maximum of $|f^{(n+1)}|$ on the interval between a and x
  • nn=Degree of the polynomial

Python Implementation

Basic Taylor Approximation

import numpy as np

def taylor_exp(x, n_terms=10):
    """Approximate e^x using the Maclaurin series."""
    result = 0
    for k in range(n_terms):
        result += x**k / np.math.factorial(k)
    return result

# Compare with numpy
x = 1.0
print(f"Exact:  {np.exp(x):.12f}")
print(f"Taylor: {taylor_exp(x, n_terms=10):.12f}")

# Output:
# Exact:  2.718281828459
# Taylor: 2.718281801146

Vectorized Taylor Approximation

import numpy as np

def taylor_sin(x, n_terms=8):
    """Vectorized Maclaurin series for sin(x)."""
    result = np.zeros_like(x, dtype=float)
    for k in range(n_terms):
        sign = (-1)**k
        power = 2*k + 1
        result += sign * x**power / np.math.factorial(power)
    return result

x = np.array([0.1, 0.5, 1.0, 2.0])
print(f"Exact:    {np.sin(x)}")
print(f"Taylor:   {taylor_sin(x)}")
print(f"Error:    {np.abs(np.sin(x) - taylor_sin(x))}")

SymPy Symbolic Taylor Series

from sympy import symbols, series, sin, cos, exp, log, oo

x = symbols('x')

# Taylor series expansions
print("e^x:", series(exp(x), x, 0, n=6))
print("sin(x):", series(sin(x), x, 0, n=8))
print("cos(x):", series(cos(x), x, 0, n=8))
print("ln(1+x):", series(log(1+x), x, 0, n=6))

# Compute specific derivatives
from sympy import factorial
def taylor_coeff(f, x, a, n):
    """Get the nth Taylor coefficient at point a."""
    return f.diff(x, n).subs(x, a) / factorial(n)

print(f" coefficient of x^3 in e^x: {taylor_coeff(exp(x), x, 0, 3)}")

Error Analysis

import numpy as np
import matplotlib.pyplot as plt

def taylor_error_analysis():
    """Compare Taylor approximations of different orders."""
    x = np.linspace(-3, 3, 200)
    exact = np.exp(x)
    
    errors = {}
    for n in [3, 5, 7, 10]:
        approx = np.zeros_like(x)
        for k in range(n + 1):
            approx += x**k / np.math.factorial(k)
        errors[n] = np.abs(exact - approx)
    
    # Plot
    plt.figure(figsize=(10, 6))
    for n, err in errors.items():
        plt.semilogy(x, err, label=f'n={n}')
    plt.xlabel('x')
    plt.ylabel('Absolute Error')
    plt.title('Taylor Series Error for e^x')
    plt.legend()
    plt.grid(True)
    plt.show()

taylor_error_analysis()

Applications in AI/ML

Linearization of Neural Networks

ℹ️ Neural Tangent Kernel (NTK)

The Neural Tangent Kernel describes how neural networks behave near initialization. For a network f(x;ΞΈ)f(\mathbf{x}; \theta) with parameters ΞΈ\theta:

f(x;ΞΈ)β‰ˆf(x;ΞΈ0)+βˆ‡ΞΈf(x;ΞΈ0)T(ΞΈβˆ’ΞΈ0)f(\mathbf{x}; \theta) \approx f(\mathbf{x}; \theta_0) + \nabla_\theta f(\mathbf{x}; \theta_0)^T (\theta - \theta_0)

This is a first-order Taylor expansion around the initial parameters ΞΈ0\theta_0. The NTK is the kernel:

K(x,xβ€²)=βˆ‡ΞΈf(x;ΞΈ0)Tβˆ‡ΞΈf(xβ€²;ΞΈ0)K(\mathbf{x}, \mathbf{x}') = \nabla_\theta f(\mathbf{x}; \theta_0)^T \nabla_\theta f(\mathbf{x}'; \theta_0)

In the infinite-width limit, this linearization becomes exact during training, and the network behaves like a linear model in function space.

Gradient Descent Analysis

Taylor series explain why gradient descent works:

  • The gradient βˆ‡f\nabla f is the first-order Taylor approximation
  • Newton's method uses the second-order Taylor expansion for faster convergence
  • Momentum methods can be viewed as modifying the Taylor approximation landscape

Taylor Series in Loss Functions

Many loss functions are analyzed using Taylor expansions:

  • Cross-entropy loss near zero predictions (gradient explosion)
  • Huber loss as a smooth approximation of MAE
  • Softmax stability analysis (subtracting the max is equivalent to scaling the Taylor series)

Automatic Differentiation Connection

Automatic differentiation (AD) computes exact derivatives β€” the same derivatives needed for Taylor series. Modern ML frameworks like PyTorch and JAX use AD to:

  • Compute gradients for backpropagation
  • Enable higher-order derivatives for Taylor-based optimization
  • Implement the Taylor-mode AD for efficient computation of Taylor coefficients

Common Mistakes

MistakeWhy It's WrongCorrect Approach
Using Taylor series outside the radius of convergenceThe series diverges and gives meaningless resultsAlways check ∣xβˆ’a∣<R|x-a| < R before using the series
Forgetting the factorial in the denominatorCoefficients are f(n)(a)/n!f^{(n)}(a)/n!, not just f(n)(a)f^{(n)}(a)The n!n! comes from repeated differentiation of xnx^n
Assuming all functions have convergent Taylor serieseβˆ’1/x2e^{-1/x^2} (extended by 0 at origin) has all derivatives = 0 at 0Check if Rn(x)β†’0R_n(x) \to 0 as nβ†’βˆžn \to \infty
Using the wrong center pointTaylor series about a=1a=1 cannot approximate near x=0x=0 wellChoose aa close to the xx values of interest
Mixing up sin⁑\sin and cos⁑\cos seriessin⁑\sin has odd powers starting with xx; cos⁑\cos has even powers starting with 1Remember: sin⁑(0)=0\sin(0) = 0 (odd function), cos⁑(0)=1\cos(0) = 1 (even function)
Ignoring alternating signsForgetting (βˆ’1)n(-1)^n in sin⁑\sin, cos⁑\cos, ln⁑(1+x)\ln(1+x) leads to completely wrong valuesAlternating series have special convergence properties; pay attention to signs
Not checking error boundsUsing an approximation without knowing its accuracyAlways bound ∣Rn(x)∣|R_n(x)| using the Lagrange remainder

Interview Questions

Question 1: Why does exe^x have the simplest Maclaurin series?

Answer: Because all derivatives of exe^x are exe^x itself, and e0=1e^0 = 1. So f(n)(0)=1f^{(n)}(0) = 1 for all nn, giving the clean series βˆ‘xnn!\sum \frac{x^n}{n!}. No alternating signs, no zeros β€” every term contributes equally.

Question 2: How would you approximate 1.1\sqrt{1.1} without a calculator?

Answer: Use the binomial series (1+x)Ξ±(1+x)^\alpha with x=0.1x = 0.1 and Ξ±=1/2\alpha = 1/2:

(1+0.1)1/2=1+12(0.1)+(1/2)(βˆ’1/2)2!(0.1)2+β‹―(1+0.1)^{1/2} = 1 + \frac{1}{2}(0.1) + \frac{(1/2)(-1/2)}{2!}(0.1)^2 + \cdots
=1+0.05βˆ’0.00125+0.0000625βˆ’β‹―β‰ˆ1.04881= 1 + 0.05 - 0.00125 + 0.0000625 - \cdots \approx 1.04881

The exact value is β‰ˆ1.0488088...\approx 1.0488088..., so 3 terms give 5 digits of accuracy.

Question 3: Why is the Taylor series for ln⁑(1+x)\ln(1+x) restricted to ∣x∣<1|x| < 1?

Answer: The coefficients cn=(βˆ’1)n+1nc_n = \frac{(-1)^{n+1}}{n} satisfy lim⁑nβ†’βˆžβˆ£cn/cn+1∣=1\lim_{n\to\infty} |c_n/c_{n+1}| = 1, giving R=1R = 1. At x=1x = 1, the series 1βˆ’1/2+1/3βˆ’β‹―1 - 1/2 + 1/3 - \cdots converges (alternating harmonic series), but at x=βˆ’1x = -1 it becomes βˆ’1βˆ’1/2βˆ’1/3βˆ’β‹―-1 - 1/2 - 1/3 - \cdots, which diverges (harmonic series).

Question 4: What's the relationship between Taylor series and Fourier series?

Answer: Both decompose functions into simpler basis functions:

  • Taylor series use polynomial basis {1,x,x2,…}\{1, x, x^2, \ldots\} β€” best for local approximation
  • Fourier series use trigonometric basis {1,cos⁑(nx),sin⁑(nx)}\{1, \cos(nx), \sin(nx)\} β€” best for periodic functions

Taylor series require differentiability; Fourier series work for discontinuous functions. In higher dimensions, Taylor series extend to multivariate polynomials, while Fourier series extend to the Fourier transform.

Question 5: How do Taylor series relate to the concept of analyticity?

Answer: A function is analytic at a point if its Taylor series converges to the function in some neighborhood. All polynomial, exponential, trigonometric, and rational functions (away from poles) are analytic. However, f(x)=eβˆ’1/x2f(x) = e^{-1/x^2} (with f(0)=0f(0)=0) is smooth but not analytic β€” its Taylor series at 0 is identically zero, yet the function is nonzero for xβ‰ 0x \neq 0.

Question 6: Can you use Taylor series to solve differential equations?

Answer: Yes β€” the power series method assumes y(x)=βˆ‘n=0∞anxny(x) = \sum_{n=0}^{\infty} a_n x^n, substitutes into the ODE, and solves for the coefficients recursively. For example, solving yβ€²=yy' = y with y(0)=1y(0) = 1 gives an=1/n!a_n = 1/n!, recovering exe^x. This method works for linear ODEs with polynomial coefficients and is the basis for special functions like Bessel functions and Legendre polynomials.


Practice Problems

Problem 1: Derive the Series

πŸ“Problem: Derive the Maclaurin Series

Find the Maclaurin series for f(x)=11+x2f(x) = \frac{1}{1+x^2} and determine its radius of convergence.

πŸ’‘Solution

Method 1 (Substitution): Since 11βˆ’u=βˆ‘n=0∞un\frac{1}{1-u} = \sum_{n=0}^{\infty} u^n for ∣u∣<1|u| < 1, substitute u=βˆ’x2u = -x^2:

11+x2=βˆ‘n=0∞(βˆ’x2)n=βˆ‘n=0∞(βˆ’1)nx2n=1βˆ’x2+x4βˆ’x6+β‹―\frac{1}{1+x^2} = \sum_{n=0}^{\infty} (-x^2)^n = \sum_{n=0}^{\infty} (-1)^n x^{2n} = 1 - x^2 + x^4 - x^6 + \cdots

Method 2 (Derivatives):

  • f(0)=1f(0) = 1
  • fβ€²(x)=βˆ’2x(1+x2)2β‡’fβ€²(0)=0f'(x) = \frac{-2x}{(1+x^2)^2} \Rightarrow f'(0) = 0
  • fβ€²β€²(x)=βˆ’2(1+x2)2+2xβ‹…2(1+x2)(2x)(1+x2)4=βˆ’2+6x2(1+x2)3β‡’fβ€²β€²(0)=βˆ’2f''(x) = \frac{-2(1+x^2)^2 + 2x \cdot 2(1+x^2)(2x)}{(1+x^2)^4} = \frac{-2+6x^2}{(1+x^2)^3} \Rightarrow f''(0) = -2

The pattern: even derivatives alternate 1,βˆ’2,24,…1, -2, 24, \ldots, odd derivatives are 0 at x=0x=0.

Radius of convergence: R=1R = 1 (from u=βˆ’x2u = -x^2, we need ∣x2∣<1|x^2| < 1, so ∣x∣<1|x| < 1).

Note: This series is the basis for the Leibniz formula for Ο€\pi:

Ο€4=1βˆ’13+15βˆ’17+β‹―\frac{\pi}{4} = 1 - \frac{1}{3} + \frac{1}{5} - \frac{1}{7} + \cdots

obtained by integrating 11+x2\frac{1}{1+x^2} from 0 to 1.

Problem 2: Error Estimation

πŸ“Problem: How Many Terms for 6-Digit Accuracy?

How many terms of the Maclaurin series for cos⁑(0.5)\cos(0.5) are needed to ensure the result is accurate to 6 decimal places?

πŸ’‘Solution

The Maclaurin series for cos⁑x\cos x is an alternating series: βˆ‘n=0∞(βˆ’1)nx2n(2n)!\sum_{n=0}^{\infty} \frac{(-1)^n x^{2n}}{(2n)!}.

For alternating series, the error is bounded by the first omitted term:

∣RNβˆ£β‰€βˆ£x∣2N+2(2N+2)!|R_N| \leq \frac{|x|^{2N+2}}{(2N+2)!}

With x=0.5x = 0.5, we need (0.5)2N+2(2N+2)!<10βˆ’6\frac{(0.5)^{2N+2}}{(2N+2)!} < 10^{-6}.

Checking:

  • N=2N=2: (0.5)66!=0.015625720β‰ˆ2.17Γ—10βˆ’5\frac{(0.5)^6}{6!} = \frac{0.015625}{720} \approx 2.17 \times 10^{-5} (not enough)
  • N=3N=3: (0.5)88!=0.0039062540320β‰ˆ9.69Γ—10βˆ’8\frac{(0.5)^8}{8!} = \frac{0.00390625}{40320} \approx 9.69 \times 10^{-8} βœ“

Answer: 4 terms (n=0,1,2,3n = 0, 1, 2, 3) are sufficient.

Verification:

cos⁑(0.5)β‰ˆ1βˆ’0.252+0.062524βˆ’0.015625720=0.8775826\cos(0.5) \approx 1 - \frac{0.25}{2} + \frac{0.0625}{24} - \frac{0.015625}{720} = 0.8775826

Exact: cos⁑(0.5)β‰ˆ0.8775826...\cos(0.5) \approx 0.8775826... βœ“

Problem 3: Non-Standard Expansion

πŸ“Problem: Expansion About a Non-Zero Center

Find the first four nonzero terms of the Taylor series for f(x)=exf(x) = e^x about a=1a = 1.

πŸ’‘Solution

Since f(n)(x)=exf^{(n)}(x) = e^x for all nn, we have f(n)(1)=ef^{(n)}(1) = e.

The Taylor series about a=1a = 1 is:

ex=βˆ‘n=0∞en!(xβˆ’1)n=e[1+(xβˆ’1)+(xβˆ’1)22!+(xβˆ’1)33!+⋯ ]e^x = \sum_{n=0}^{\infty} \frac{e}{n!}(x-1)^n = e\left[1 + (x-1) + \frac{(x-1)^2}{2!} + \frac{(x-1)^3}{3!} + \cdots\right]

The first four nonzero terms:

exβ‰ˆe+e(xβˆ’1)+e2(xβˆ’1)2+e6(xβˆ’1)3e^x \approx e + e(x-1) + \frac{e}{2}(x-1)^2 + \frac{e}{6}(x-1)^3

At x=2x = 2: e2β‰ˆe(1+1+1/2+1/6)=eβ‹…8/3β‰ˆ7.2417e^2 \approx e(1 + 1 + 1/2 + 1/6) = e \cdot 8/3 \approx 7.2417

Exact: e2β‰ˆ7.3891e^2 \approx 7.3891, so 4 terms give about 2% error. Adding the (xβˆ’1)4(x-1)^4 term (e/24e/24) reduces this dramatically.

Problem 4: Real-World Application

πŸ“Problem: Small Angle Approximation

A pendulum has length L=1L = 1 m. For small angles, the period is T=2Ο€L/gT = 2\pi\sqrt{L/g}. Use Taylor series to find a correction term for the period when the amplitude is ΞΈ0=30Β°\theta_0 = 30Β°.

πŸ’‘Solution

The exact period involves an elliptic integral, but we can use the Taylor expansion of sinβ‘ΞΈβ‰ˆΞΈβˆ’ΞΈ3/6+β‹―\sin\theta \approx \theta - \theta^3/6 + \cdots.

The corrected period is approximately:

Tβ‰ˆ2Ο€Lg(1+ΞΈ0216+⋯ )T \approx 2\pi\sqrt{\frac{L}{g}}\left(1 + \frac{\theta_0^2}{16} + \cdots\right)

With ΞΈ0=30Β°=Ο€/6\theta_0 = 30Β° = \pi/6 radians:

Tβ‰ˆT0(1+(Ο€/6)216)=T0(1+Ο€2576)β‰ˆT0(1+0.0171)T \approx T_0\left(1 + \frac{(\pi/6)^2}{16}\right) = T_0\left(1 + \frac{\pi^2}{576}\right) \approx T_0(1 + 0.0171)

So the period is about 1.7% longer than the small-angle prediction. For ΞΈ0=45Β°\theta_0 = 45Β°, the correction is about 3.8%, showing the approximation breaks down for large angles.

Problem 5: Series Manipulation

πŸ“Problem: Deriving New Series from Known Ones

Use known Maclaurin series to find the series for f(x)=exβˆ’eβˆ’x2f(x) = \frac{e^x - e^{-x}}{2} (which is sinh⁑x\sinh x).

πŸ’‘Solution

We know:

ex=1+x+x22!+x33!+x44!+x55!+β‹―e^x = 1 + x + \frac{x^2}{2!} + \frac{x^3}{3!} + \frac{x^4}{4!} + \frac{x^5}{5!} + \cdots
eβˆ’x=1βˆ’x+x22!βˆ’x33!+x44!βˆ’x55!+β‹―e^{-x} = 1 - x + \frac{x^2}{2!} - \frac{x^3}{3!} + \frac{x^4}{4!} - \frac{x^5}{5!} + \cdots

Subtracting:

exβˆ’eβˆ’x=2(x+x33!+x55!+⋯ )=2βˆ‘n=0∞x2n+1(2n+1)!e^x - e^{-x} = 2\left(x + \frac{x^3}{3!} + \frac{x^5}{5!} + \cdots\right) = 2\sum_{n=0}^{\infty} \frac{x^{2n+1}}{(2n+1)!}

Therefore:

sinh⁑x=exβˆ’eβˆ’x2=βˆ‘n=0∞x2n+1(2n+1)!=x+x36+x5120+β‹―\sinh x = \frac{e^x - e^{-x}}{2} = \sum_{n=0}^{\infty} \frac{x^{2n+1}}{(2n+1)!} = x + \frac{x^3}{6} + \frac{x^5}{120} + \cdots

This matches the known series for sinh⁑x\sinh x β€” note the similarity to sin⁑x\sin x but without alternating signs.


Quick Reference

ConceptFormula/Key Point
Taylor Seriesf(x)=βˆ‘n=0∞f(n)(a)n!(xβˆ’a)n\displaystyle f(x) = \sum_{n=0}^{\infty}\frac{f^{(n)}(a)}{n!}(x-a)^n
Maclaurin SeriesSame with a=0a = 0: f(x)=βˆ‘n=0∞f(n)(0)n!xn\displaystyle f(x) = \sum_{n=0}^{\infty}\frac{f^{(n)}(0)}{n!}x^n
exe^xβˆ‘n=0∞xnn!\displaystyle\sum_{n=0}^{\infty}\frac{x^n}{n!}, all xx
sin⁑x\sin xβˆ‘n=0∞(βˆ’1)nx2n+1(2n+1)!\displaystyle\sum_{n=0}^{\infty}\frac{(-1)^n x^{2n+1}}{(2n+1)!}, all xx
cos⁑x\cos xβˆ‘n=0∞(βˆ’1)nx2n(2n)!\displaystyle\sum_{n=0}^{\infty}\frac{(-1)^n x^{2n}}{(2n)!}, all xx
ln⁑(1+x)\ln(1+x)βˆ‘n=1∞(βˆ’1)n+1xnn\displaystyle\sum_{n=1}^{\infty}\frac{(-1)^{n+1} x^n}{n}, βˆ’1<x≀1-1 < x \leq 1
11βˆ’x\frac{1}{1-x}βˆ‘n=0∞xn\displaystyle\sum_{n=0}^{\infty} x^n, βˆ₯xβˆ₯<1\|x\| < 1
arctan⁑x\arctan xβˆ‘n=0∞(βˆ’1)nx2n+12n+1\displaystyle\sum_{n=0}^{\infty}\frac{(-1)^n x^{2n+1}}{2n+1}, βˆ₯xβˆ₯≀1\|x\| \leq 1
(1+x)Ξ±(1+x)^\alphaβˆ‘n=0∞(Ξ±n)xn\displaystyle\sum_{n=0}^{\infty}\binom{\alpha}{n} x^n, βˆ₯xβˆ₯<1\|x\| < 1
Lagrange Remainderβˆ₯Rn(x)βˆ₯≀M(n+1)!βˆ₯xβˆ’aβˆ₯n+1\|R_n(x)\| \leq \frac{M}{(n+1)!}\|x-a\|^{n+1}
Radius of ConvergenceR=lim⁑nβ†’βˆžβˆ£cncn+1∣\displaystyle R = \lim_{n\to\infty}\left|\frac{c_n}{c_{n+1}}\right|
Alternating Series Errorβˆ₯RNβˆ₯≀\|R_N\| \leq first omitted term
Pattern: Odd Functionssin⁑x\sin x, arctan⁑x\arctan x, sinh⁑x\sinh x have only odd powers
Pattern: Even Functionscos⁑x\cos x, cosh⁑x\cosh x have only even powers

Cross-References

  • Sequences and Series β€” foundations for understanding convergence
  • Power Series β€” the general framework for Taylor series
  • Maclaurin Series β€” the special case at a=0a = 0
  • L'HΓ΄pital's Rule β€” can be proved using Taylor expansions
  • Newton's Method β€” uses first-order Taylor approximation for root finding
  • Numerical Integration β€” Simpson's rule is based on quadratic Taylor approximation
  • Fourier Series β€” alternative decomposition using trigonometric basis
  • Differential Equations β€” power series method for solving ODEs
  • Optimization β€” second-order methods use Hessian (second Taylor term)
  • Automatic Differentiation β€” computes exact Taylor coefficients via the chain rule
  • Neural Tangent Kernel β€” linearization of neural networks via first-order Taylor expansion
Lesson Progress29 / 100