---
title: Functions as power series
heading: New series from old ones
eyebrow: A6 · Lesson 35 · Functions as power series
xp: 40
---

::: hook
You know one power series by heart: $\frac{1}{1 - x} = 1 + x + x^2 + \cdots$. From that single series, with nothing but substitution, differentiation and integration, you can build series for $\ln(1 + x)$, $\tan^{-1}x$, $\frac{1}{(1 - x)^2}$ and many more, without computing a single derivative from scratch. Inside its radius of convergence, a power series can be treated just like a polynomial: differentiated and integrated term by term.
:::

::: play
- The blue curve is $\ln(1 + x)$. The other is its series, $x - \frac{x^2}{2} + \frac{x^3}{3} - \cdots$, cut off at degree $N$.
- Raise $N$. Inside $-1 < x \le 1$ the polynomials close in. Beyond $x = 1$ they swing further away with each term.
- The readout compares the two at $x_0$.
:::
:::

```sim plot
view: graph
x: x = -1..2
y: y = -3..1.5
slider: N = 1..8 step 1 = 3
slider: x0 = -0.9..1.9 step 0.1 = 0.5
plot: ln(1 + x) | label: ln(1 + x) | samples: 800
plot: x - step(N - 1.5)*x^2/2 + step(N - 2.5)*x^3/3 - step(N - 3.5)*x^4/4 + step(N - 4.5)*x^5/5 - step(N - 5.5)*x^6/6 + step(N - 6.5)*x^7/7 - step(N - 7.5)*x^8/8 | label: series to degree N | color: ch2 | samples: 800
marker: x = x0 | label: x₀
readout: ln(1 + x0) = ln(1 + x0) | digits: 5
readout: series at x0 = x0 - step(N - 1.5)*x0^2/2 + step(N - 2.5)*x0^3/3 - step(N - 3.5)*x0^4/4 + step(N - 4.5)*x0^5/5 - step(N - 5.5)*x0^6/6 + step(N - 6.5)*x0^7/7 - step(N - 7.5)*x0^8/8 | digits: 5
```

::: predict
## You know $\frac{1}{1 + t} = 1 - t + t^2 - t^3 + \cdots$. What do you get by integrating both sides from 0 to $x$?

- [ ] $e^x$
- [x] $\ln(1 + x) = x - \frac{x^2}{2} + \frac{x^3}{3} - \cdots$
- [ ] $\frac{1}{(1 + x)^2}$
- [ ] $\tan^{-1}x$

::: reveal
$\ln(1 + x)$. The left side integrates to $\ln(1 + x)$, and each term $t^n$ integrates to $\frac{x^{n+1}}{n + 1}$. One integration, and you have the series for a logarithm, valid for $-1 < x \le 1$.
:::
:::

::: nameit
## Term by term

If $f(x) = \sum c_nx^n$ with radius of convergence $R > 0$, then for $|x| < R$

$$f'(x) = \sum_{n=1}^\infty nc_nx^{n-1} \qquad \int_0^x f(t)\,dt = \sum_{n=0}^\infty\frac{c_n}{n + 1}x^{n+1}$$

and both new series have the **same radius** $R$. (The endpoints can change: integrating can make an endpoint converge.)

## The toolkit, built from $\frac{1}{1 - x}$

| Operation | Result | Radius |
|---|---|---|
| Replace $x$ by $-x$ | $\frac{1}{1 + x} = \sum(-1)^nx^n$ | 1 |
| Integrate that | $\ln(1 + x) = \sum_{n=1}^\infty\frac{(-1)^{n+1}x^n}{n}$ | 1 |
| Replace $x$ by $-x^2$ | $\frac{1}{1 + x^2} = \sum(-1)^nx^{2n}$ | 1 |
| Integrate that | $\tan^{-1}x = \sum\frac{(-1)^nx^{2n+1}}{2n + 1}$ | 1 |
| Differentiate $\frac{1}{1 - x}$ | $\frac{1}{(1 - x)^2} = \sum_{n=0}^\infty(n + 1)x^n$ | 1 |
| Replace $x$ by $kx$ | $\frac{1}{1 - kx} = \sum k^nx^n$ | $1/\lvert k\rvert$ |

Multiplying a series by $x^k$ shifts every power up by $k$, which is how $\sum nx^n = \frac{x}{(1 - x)^2}$ comes from the derivative.

## Why this matters

These series turn functions with no simple antiderivative into ones you can integrate term by term (lesson 44), and they're how libraries compute $\ln$ and $\tan^{-1}$, after first shrinking the argument so the series converges fast.
:::

::: example
## Estimate $\ln 1.1$ with three terms of its series.

::: solution
1. **Add three terms.**
   $$\begin{aligned} \ln 1.1 &\approx 0.1 - \frac{0.01}{2} + \frac{0.001}{3} \\ &= 0.1 - 0.005 + 0.000333 \\ &= 0.095333 \end{aligned}$$
2. **Bound the error.** The series alternates, so the error is less than the next term:
   $$\frac{0.1^4}{4} = 0.000025$$
3. **Compare.** The true value is 0.095310, so the actual error, 0.000023, is inside the bound.

**Answer:** $\ln 1.1 \approx 0.095333$, with an error under 0.000025; the true value is 0.095310.
:::
:::

::: example
## Find the power series of $\dfrac{1}{1 + 4x^2}$ and its radius of convergence.

::: solution
1. **Substitute into the geometric series.** Replace $x$ in $\frac{1}{1 - x}$ by $-4x^2$:
   $$\begin{aligned} \frac{1}{1 + 4x^2} &= \sum(-4x^2)^n \\ &= 1 - 4x^2 + 16x^4 \\ &\quad - 64x^6 + \cdots \end{aligned}$$
2. **Find the radius.** It converges when $|4x^2| < 1$, that is, $|x| < \frac{1}{2}$, so $R = \frac{1}{2}$.

**Answer:** $\frac{1}{1 + 4x^2} = 1 - 4x^2 + 16x^4 - 64x^6 + \cdots$, with $R = \frac{1}{2}$.
:::
:::

::: example
## Find the power series for $\dfrac{1}{(1 - x)^2}$ and use it at $x = 0.1$.

::: solution
1. **Differentiate the geometric series term by term.**
   $$\begin{aligned} \frac{d}{dx}\frac{1}{1 - x} &= \frac{1}{(1 - x)^2} \\ &= 1 + 2x + 3x^2 + \cdots \\ &= \sum(n + 1)x^n \end{aligned}$$
   for $|x| < 1$.
2. **Use it at $x = 0.1$.**
   $$\begin{aligned} &1 + 0.2 + 0.03 + 0.004 + \cdots \\ &= 1.2346 \end{aligned}$$
   matching $1/0.81$.

**Answer:** $\frac{1}{(1 - x)^2} = \sum(n + 1)x^n$ for $|x| < 1$, and at $x = 0.1$ it gives 1.2346.
:::
:::

::: check
given: k = 2 | 3; n = 3 | 5
answer: (-k)^n

## What is the coefficient of $x^{\given{n}}$ in the series for $\dfrac{1}{1 + \given{k}x}$?

::: right
Right. $\frac{1}{1 - (-kx)} = \sum(-k)^nx^n$, so the coefficient is $(-k)^n$ = {answer}.
:::

::: misses
- [k^n] Check the sign: the ratio is $-kx$, and {n} is odd.
- [-1] Each power of $x$ also brings a factor of {k}.
- [any] Not yet. Substitute $-kx$ into the geometric series.
:::
:::

::: check
given: x = 0.1 | 0.2 | 0.05
answer: x - x^2/2 + x^3/3
tolerance: 0.001%

## Estimate $\ln(1 + \given{x})$ with three terms of its series.

::: right
Right. $x - \frac{x^2}{2} + \frac{x^3}{3}$ = {answer}.
:::

::: misses
- [x + x^2/2 + x^3/3] The signs alternate.
- [x - x^2/2] That's two terms.
- [any] Not yet. $x - \frac{x^2}{2} + \frac{x^3}{3}$.
:::
:::

::: check
given: x = 0.1 | 0.2 | 0.3
answer: x - x^3/3
tolerance: 0.001%

## Estimate $\tan^{-1}\given{x}$ with two terms of its series.

::: right
Right. $x - \frac{x^3}{3}$ = {answer}.
:::

::: misses
- [x - x^2/2] That's $\ln(1 + x)$. The arctangent has only odd powers.
- [x - x^3/6] That's $\sin x$. Here it's $\frac{x^3}{3}$.
- [any] Not yet. Integrate $1 - t^2 + t^4 - \cdots$.
:::
:::

::: check
given: n = 3 | 5 | 8
answer: n + 1

## What is the coefficient of $x^{\given{n}}$ in the series for $\dfrac{1}{(1 - x)^2}$?

::: right
Right. Differentiating $\sum x^m$ gives $\sum mx^{m-1}$; the $x^{\given{n}}$ term comes from $m = \given{n} + 1$: coefficient {answer}.
:::

::: misses
- [n] Differentiating lowers each power by one, so the coefficient of $x^n$ comes from $x^{n+1}$.
- [1] That's $\frac{1}{1 - x}$. Squaring the denominator changes the coefficients.
- [any] Not yet. Differentiate $1 + x + x^2 + \cdots$.
:::
:::

::: check
given: c = 4 | 9 | 2
answer: 1/sqrt(c)
tolerance: 0.5%

## What is the radius of convergence of the series for $\dfrac{1}{1 + \given{c}x^2}$?

::: right
Right. It needs $|cx^2| < 1$, so $|x| < \frac{1}{\sqrt c}$ = {answer}.
:::

::: misses
- [1/c] The condition is on $cx^2$, so take a square root.
- [sqrt(c)] Upside down.
- [any] Not yet. Substitute $-cx^2$ into the geometric series.
:::
:::

::: check
kind: choice

## Which is the series for $\tan^{-1}x$?

- [ ] $x - \frac{x^2}{2} + \frac{x^3}{3} - \cdots$
- [x] $x - \frac{x^3}{3} + \frac{x^5}{5} - \cdots$
- [ ] $x - \frac{x^3}{3!} + \frac{x^5}{5!} - \cdots$
- [ ] $1 - x^2 + x^4 - \cdots$

::: right
Right. Integrate $\frac{1}{1 + t^2} = 1 - t^2 + t^4 - \cdots$ from 0 to $x$.
:::

::: misses
- [1] That's $\ln(1 + x)$.
- [3] That's $\sin x$: factorials, not plain odd numbers.
- [4] That's $\frac{1}{1 + x^2}$, the derivative of the arctangent.
- [any] Integrate the series for $\frac{1}{1 + x^2}$.
:::
:::

::: check
kind: parts
given: x = 0.1 | 0.2 | 0.5; k = 2 | 3

## Build series from the geometric series.

::: part
answer: 1/(1 - x)^2
tolerance: 0.5%

### What does $\sum_{n=0}^\infty(n + 1)\given{x}^n$ sum to?

::: misses
- [1/(1 - x)] That's the plain geometric series. Differentiating it gives $(n + 1)x^n$.
- [any] $\frac{d}{dx}\frac{1}{1 - x}$.
:::
:::

::: part
answer: 1/(1 + k*x^2)
tolerance: 0.5%

### What does $\sum_{n=0}^\infty(-\given{k}x^2)^n$ sum to at $x$ = {x}?

::: misses
- [any] Geometric with ratio $-kx^2$.
:::
:::
:::

::: check
kind: derivation
vars: x = -0.5..0.5

## Get the series for $\tan^{-1}x$ from a geometric series.

::: step
answer: 1/(1 + x^2)

### What is the derivative of $\tan^{-1}x$?
:::

::: step
answer: 1 - x^2 + x^4

### Expand it as a geometric series in $-x^2$. Write the first three terms.
:::

::: step
answer: x - x^3/3 + x^5/5

### Integrate term by term from 0.
:::

::: right
Right. $\tan^{-1}x = x - \frac{x^3}{3} + \frac{x^5}{5} - \cdots$, from one geometric series and one integration.
:::
:::

::: explain
## How does integrating the series for $\frac{1}{1 + x^2}$ give the series for $\tan^{-1}x$?

::: model
The derivative of $\tan^{-1}x$ is $\frac{1}{1 + x^2}$, so $\tan^{-1}x = \int_0^x\frac{dt}{1 + t^2}$. Putting $-t^2$ into the geometric series gives $\frac{1}{1 + t^2} = 1 - t^2 + t^4 - \cdots$ for $|t| < 1$. Inside the radius of convergence you can integrate a power series one term at a time, and $t^{2n}$ integrates to $\frac{x^{2n+1}}{2n + 1}$. So $\tan^{-1}x = x - \frac{x^3}{3} + \frac{x^5}{5} - \cdots$.
:::
:::

::: practice

::: check
given: n = 2 | 3 | 4
answer: -1/n
tolerance: 0.5%

## What is the coefficient of $x^{\given{n}}$ in the series for $\ln(1 - x)$?

::: misses
- [1/n] Every term of $\ln(1 - x)$ is negative.
- [any] Replace $x$ by $-x$ in the series for $\ln(1 + x)$.
:::
:::

::: check
given: k = 2..9 int
answer: k^2
tolerance: 0.5%

## What is the coefficient of $x^2$ in the series for $\dfrac{1}{1 - \given{k}x}$?

::: misses
- [k] The $x^2$ term is $(kx)^2$.
- [any] $\sum(kx)^n$.
:::
:::

::: check
given: x = 0.1 | 0.2 | 0.25 | 0.4 | 0.5 | 0.6 | 0.75
answer: -ln(1 - x)
tolerance: 0.5%

## What is $\displaystyle\sum_{n=1}^\infty\frac{(\given{x})^n}{n}$?

::: misses
- [ln(1 + x)] The terms are all positive, so it's $-\ln(1 - x)$.
- [any] Compare with the series for $\ln(1 - x)$.
:::
:::
:::
