MATH-341 · Lesson 4 of 12 · 26 min

Series of functions and the Weierstrass M-test

A series of functions \(\sum_{k=1}^{\infty} u_k(x)\) is a sequence of functions in disguise: the sequence of partial sums \(s_n(x) = \sum_{k=1}^{n} u_k(x)\). Everything in lessons 2 and 3 therefore applies, and this lesson translates it into the language of series. Its central result is the Weierstrass M-test, the most widely used test for uniform convergence, and its most famous application is a continuous function that is differentiable nowhere.

Pointwise and uniform convergence of series

Definition. The series \(\sum u_k\) converges pointwise on \(A\) to \(s\) if \(s_n(x) \to s(x)\) for every \(x \in A\), and uniformly on \(A\) if \(s_n \to s\) uniformly on \(A\). It converges absolutely at \(x\) if \(\sum |u_k(x)|\) converges.

Translating the theorems of lesson 3 gives three rules. If every \(u_k\) is continuous and \(\sum u_k\) converges uniformly on \(A\), the sum is continuous on \(A\). If every \(u_k\) is integrable on \([a, b]\) and the series converges uniformly there, then \(\int_a^b \sum u_k = \sum \int_a^b u_k\): the series can be integrated term by term. If every \(u_k\) is differentiable on \([a, b]\), \(\sum u_k^\prime\) converges uniformly and \(\sum u_k(x_0)\) converges for some \(x_0\), then \(\sum u_k\) converges uniformly and \((\sum u_k)^\prime = \sum u_k^\prime\): the series can be differentiated term by term.

Translating the uniform Cauchy criterion of lesson 2 gives the tool that proves uniform convergence of series.

Theorem 4.1 (Cauchy criterion for series). \(\sum u_k\) converges uniformly on \(A\) if and only if for every \(\varepsilon > 0\) there is an \(N\) such that \[\Big|\sum_{k=n+1}^{m} u_k(x)\Big| < \varepsilon \quad \text{for all } m > n \ge N \text{ and all } x \in A.\]

Proof. The sum on the left is \(s_m(x) - s_n(x)\), so the condition says exactly that \((s_n)\) is uniformly Cauchy, and theorem 2.2 applies. \(\square\)

Taking \(m = n + 1\) shows that a uniformly convergent series has terms tending to 0 uniformly: \(\|u_k\|_\infty \to 0\). This is the uniform version of the divergence test, and it disposes quickly of some series. For example, \(\sum x^k\) cannot converge uniformly on \((-1, 1)\), because \(\sup_{|x| < 1} |x^k| = 1\) for every \(k\).

The Weierstrass M-test

Theorem 4.2 (Weierstrass M-test). Let \(u_k\) be functions on \(A\), and suppose there are constants \(M_k\) with \(|u_k(x)| \le M_k\) for all \(x \in A\) and all \(k\), and \(\sum M_k < \infty\). Then \(\sum u_k\) converges absolutely and uniformly on \(A\). Moreover, the tail after \(n\) terms satisfies \[\Big|\sum_{k=1}^{\infty} u_k(x) - \sum_{k=1}^{n} u_k(x)\Big| \le \sum_{k=n+1}^{\infty} M_k \quad \text{for all } x \in A.\]

Proof. Let \(\varepsilon > 0\). Since \(\sum M_k\) converges, the Cauchy criterion for series of numbers gives \(N\) with \(\sum_{k=n+1}^{m} M_k < \varepsilon\) for all \(m > n \ge N\). Then for every \(x \in A\), \[\Big|\sum_{k=n+1}^{m} u_k(x)\Big| \le \sum_{k=n+1}^{m} |u_k(x)| \le \sum_{k=n+1}^{m} M_k < \varepsilon.\] By theorem 4.1 the series converges uniformly, and the middle expression shows it converges absolutely at each \(x\). For the tail estimate, fix \(x\) and \(n\) and let \(m \to \infty\) in \(|s_m(x) - s_n(x)| \le \sum_{k=n+1}^{m} M_k\). \(\square\)

The test separates the variable \(x\) from the index \(k\). Once each term is bounded by a constant independent of \(x\), uniform convergence of the series of functions follows from ordinary convergence of a series of numbers. The constant \(M_k\) is usually \(\|u_k\|_\infty\) or a convenient upper bound for it. Weierstrass used the test in his Berlin lectures, and it carries his name, although the idea of dominating a series of functions by a convergent series of constants was used by others in the same period.

Left: the functions sin(kx) over k squared for k equal to 1, 2 and 3, each lying between the horizontal lines at plus and minus 1 over k squared. Right: a bar chart of the bounds M sub k equal to 1 over k squared, with the bars after the fifth shaded to show the tail sum bounding the error of the fifth partial sum.
The M-test: each term is trapped between ±M_k, and the tail of ΣM_k bounds the error everywhere at once

Applications

Worked problem

A continuous Fourier series

Show that \(f(x) = \sum_{k=1}^{\infty} \frac{\sin(kx)}{k^2}\) is continuous on \(\mathbb{R}\), and compute \(\int_0^\pi f\).

Show solution
  1. For all \(x\), \(\big|\frac{\sin(kx)}{k^2}\big| \le \frac{1}{k^2} = M_k\), and \(\sum \frac{1}{k^2}\) converges. By the M-test the series converges uniformly on \(\mathbb{R}\).
  2. Each term is continuous, so the sum is continuous by the uniform limit theorem.
  3. Uniform convergence on \([0, \pi]\) allows term-by-term integration: \(\int_0^\pi \frac{\sin(kx)}{k^2}\,dx = \frac{1 - \cos(k\pi)}{k^3}\), which is \(\frac{2}{k^3}\) for odd \(k\) and 0 for even \(k\).
  4. So \(\int_0^\pi f = 2\sum_{k \text{ odd}} \frac{1}{k^3} = 2(1 + \frac{1}{27} + \frac{1}{125} + \dots) \approx 2.1036\).

Answer: \(f\) is continuous on \(\mathbb{R}\), and \(\int_0^\pi f = 2\sum_{j \ge 0} \frac{1}{(2j + 1)^3} \approx 2.1036\).

Worked problem

The zeta function is differentiable

Let \(\zeta(x) = \sum_{k=1}^{\infty} k^{-x}\) for \(x > 1\). Show that \(\zeta\) is continuous and differentiable on \((1, \infty)\) with \(\zeta^\prime(x) = -\sum_{k \ge 1} \frac{\ln k}{k^x}\).

Show solution
  1. Fix \(a > 1\). On \([a, \infty)\), \(0 < k^{-x} \le k^{-a}\), and \(\sum k^{-a}\) converges. By the M-test the series converges uniformly on \([a, \infty)\), so \(\zeta\) is continuous there.
  2. The derivative of \(k^{-x} = e^{-x\ln k}\) is \(-\frac{\ln k}{k^x}\). On \([a, \infty)\) its absolute value is at most \(\frac{\ln k}{k^a}\). Choose \(b\) with \(1 < b < a\); since \(\ln k \le C k^{a - b}\) for some constant \(C\), we get \(\frac{\ln k}{k^a} \le \frac{C}{k^b}\), and \(\sum k^{-b}\) converges.
  3. So the series of derivatives converges uniformly on \([a, \infty)\) by the M-test, and the original series converges at every point. By the differentiation theorem, applied on each \([a, c]\), \(\zeta\) is differentiable on \([a, \infty)\) with the stated derivative.
  4. Every \(x > 1\) lies in some \([a, \infty)\) with \(a > 1\), so the conclusions hold on all of \((1, \infty)\).

Answer: \(\zeta\) is continuously differentiable on \((1, \infty)\). The convergence is locally uniform but not uniform on \((1, \infty)\), since \(\zeta(x) \to \infty\) as \(x \to 1^+\).

The second example illustrates a standard technique. The M-test often fails on the whole domain but works on every closed subinterval staying away from a bad point. Since continuity and differentiability are local properties, locally uniform convergence is enough to conclude them on the whole domain.

How good is the tail bound?

The tail estimate in the M-test is a guarantee: after \(n\) terms the error is at most \(\sum_{k > n} M_k\), at every point. For \(M_k = \frac{1}{k^2}\) the integral test gives \(\sum_{k > n} \frac{1}{k^2} \le \int_n^\infty \frac{dt}{t^2} = \frac{1}{n}\). The code compares this guarantee with the actual worst error of the partial sums of \(\sum \frac{\sin kx}{k^2}\) on a grid, using a partial sum with many terms as a stand-in for the true sum.

The M-test tail bound is a guarantee at every point; the actual worst error is smaller
import math

K = 4000                       # stand-in for the infinite sum
xs = [2 * math.pi * i / 2000 for i in range(2001)]

def partial(n, x):
    return sum(math.sin(k * x) / k ** 2 for k in range(1, n + 1))

# precompute the long sums once
full = [partial(K, x) for x in xs]
tail_from = lambda n: sum(1 / k ** 2 for k in range(n + 1, K + 1))

print("  n   M-test bound  1/n bound   actual max error on grid")
for n in [1, 5, 10, 50, 100]:
    err = max(abs(full[i] - partial(n, x)) for i, x in enumerate(xs))
    print(f"{n:3d}   {tail_from(n):10.5f}  {1 / n:9.5f}   {err:12.5f}")
Output
  n   M-test bound  1/n bound   actual max error on grid
  1      0.64468    1.00000        0.37799
  5      0.18107    0.20000        0.10496
 10      0.09492    0.10000        0.05503
 50      0.01955    0.02000        0.01144
100      0.00970    0.01000        0.00574

The actual worst error is close to 0.58 times the bound for every n shown, because the terms \(\sin(kx)\) partly cancel. The M-test ignores cancellation, which is why it is easy to apply and why it sometimes fails when a subtler test succeeds.

Worked problem

Finding the best constants by calculus

Show that \(\sum_{k=1}^{\infty} \frac{x}{k(1 + kx^2)}\) converges uniformly on \(\mathbb{R}\).

Show solution
  1. A crude bound fails: \(\big|\frac{x}{k(1 + kx^2)}\big| \le \frac{|x|}{k}\), and this depends on \(x\) and has divergent sum. We need \(\|u_k\|_\infty\) itself.
  2. Let \(u_k(x) = \frac{x}{k(1 + kx^2)}\). Then \(u_k^\prime(x) = \frac{1 - kx^2}{k(1 + kx^2)^2}\), which vanishes at \(x = \pm\frac{1}{\sqrt{k}}\). Since \(u_k\) is odd and tends to 0 at \(\pm\infty\), \(\|u_k\|_\infty = u_k(\frac{1}{\sqrt{k}}) = \frac{1/\sqrt{k}}{2k} = \frac{1}{2k^{3/2}}\).
  3. Take \(M_k = \frac{1}{2k^{3/2}}\). Since \(\sum k^{-3/2}\) converges, the M-test gives uniform convergence on all of \(\mathbb{R}\), and the sum is continuous.

Answer: The series converges uniformly on \(\mathbb{R}\), with tail after \(n\) terms at most \(\sum_{k > n} \frac{1}{2k^{3/2}} \le \frac{1}{\sqrt{n}}\).

The example shows the usual procedure: compute or estimate \(\|u_k\|_\infty\), often by finding where \(|u_k|\) is largest, and check that these numbers have a convergent sum. When \(\sum \|u_k\|_\infty\) diverges the M-test is of no use on that set, though it may still work on a smaller one, as for \(\sum x^k\) on \([-r, r]\).

Absolute convergence, which the M-test provides as a bonus, has a practical benefit. By a theorem of Real Analysis I, an absolutely convergent series of numbers can be rearranged without changing its sum. So when the M-test applies, the terms of \(\sum u_k(x)\) may be grouped or reordered freely at every \(x\), and the reordered series still converges uniformly, with the same tail bounds, since the tail of a rearrangement is dominated by the tail of \(\sum M_k\) taken over the indices not yet used. The conditionally convergent series of the next section have no such protection.

When the M-test fails

The M-test proves absolute and uniform convergence at once, so it cannot apply to a series that converges uniformly but not absolutely. Consider \(\sum_{k=1}^{\infty} \frac{(-1)^{k+1} x^k}{k}\) on \([0, 1]\). At \(x = 1\) it is the alternating harmonic series, which converges but not absolutely, and \(\|u_k\|_\infty = \frac{1}{k}\), whose sum diverges. Yet the series converges uniformly on \([0, 1]\).

Proof. For fixed \(x \in [0, 1]\) the terms \(\frac{x^k}{k}\) decrease to 0 in \(k\), so by the alternating series estimate from MATH-241 the error after \(n\) terms is at most the first omitted term: \(|s(x) - s_n(x)| \le \frac{x^{n+1}}{n + 1} \le \frac{1}{n + 1}\). The bound is independent of \(x\), so the convergence is uniform. \(\square\)

By the uniform limit theorem the sum, which equals \(\ln(1 + x)\) for \(0 \le x < 1\) by the Taylor series of lesson 5, is continuous on \([0, 1]\), so its value at 1 is \(\lim_{x \to 1^-} \ln(1 + x) = \ln 2\). This proves \(1 - \frac{1}{2} + \frac{1}{3} - \dots = \ln 2\), a result we will meet again as an instance of Abel's theorem.

A more general tool, Dirichlet's test for uniform convergence, handles series \(\sum a_k(x)b_k(x)\) where the partial sums of \(\sum b_k\) are uniformly bounded and \(a_k(x)\) decreases to 0 uniformly. It shows, for example, that \(\sum \frac{\sin kx}{k}\) converges uniformly on \([\delta, 2\pi - \delta]\) for each \(\delta > 0\), although not near 0, where Abel's series of lesson 1 already showed that a jump occurs.

A continuous nowhere differentiable function

In 1872 Weierstrass presented to the Berlin Academy the function \[W(x) = \sum_{k=0}^{\infty} a^k\cos(b^k\pi x),\] with \(0 < a < 1\), \(b\) an odd integer and \(ab > 1 + \frac{3\pi}{2}\). The M-test with \(M_k = a^k\) shows at once that the series converges uniformly on \(\mathbb{R}\), so \(W\) is continuous. Weierstrass proved that \(W\) has no finite derivative at any point. G. H. Hardy showed in 1916 that \(ab \ge 1\) suffices.

The intuition is visible in the terms. The \(k\)-th term has amplitude \(a^k\), which shrinks, but slope of order \((ab)^k\pi\), which grows. Each new term adds wiggles that are smaller but steeper than all the previous ones, so difference quotients over shorter and shorter intervals never settle down. The series of derivatives \(\sum -a^kb^k\pi\sin(b^k\pi x)\) diverges, so the differentiation theorem cannot be applied, and in this case its conclusion is genuinely false. A simpler example, due to Takagi in 1903 and based on the distance to the nearest integer, appears in the practice problems.

Common mistakes

  • MistakeApplying the M-test with bounds \(M_k\) that depend on \(x\).

    Instead\(M_k\) must be a constant valid for every \(x\) in the set.

  • MistakeConcluding that a series fails to converge uniformly because the M-test fails.

    InsteadThe M-test is sufficient, not necessary: \(\sum \frac{(-1)^{k+1}x^k}{k}\) converges uniformly on \([0, 1]\).

  • MistakeDifferentiating a series term by term after checking only the original series.

    InsteadIt is the series of derivatives that must converge uniformly.

  • MistakeClaiming uniform convergence on \((1, \infty)\) for \(\sum k^{-x}\).

    InsteadThe sum is unbounded near 1; the convergence is uniform only on each \([a, \infty)\) with \(a > 1\).

Summary and key terms

  • A series of functions converges uniformly when its partial sums do; continuity, integration and differentiation results transfer to series.
  • Cauchy criterion: uniform convergence if and only if the blocks of terms are uniformly small.
  • Weierstrass M-test: \(|u_k| \le M_k\) on \(A\) with \(\sum M_k < \infty\) gives absolute and uniform convergence, with tail bound \(\sum_{k > n} M_k\).
  • Uniform convergence on closed subintervals is enough to prove continuity and differentiability on an open set.
  • The M-test misses conditionally convergent series, which need finer tests such as the alternating series estimate.
  • Weierstrass's 1872 function is continuous by the M-test and differentiable nowhere.
Partial sum
\(s_n(x) = \sum_{k=1}^{n} u_k(x)\).
Weierstrass M-test
Uniform convergence from \(|u_k(x)| \le M_k\) and \(\sum M_k < \infty\).
Term-by-term integration
\(\int \sum u_k = \sum \int u_k\), valid under uniform convergence on a bounded interval.
Weierstrass function
\(\sum a^k \cos(b^k \pi x)\), continuous and nowhere differentiable.

Practice problems

Work each problem on paper first, then reveal the answer to check.

  1. Show that \(\sum_{k=1}^{\infty} \frac{x^k}{k^2}\) converges uniformly on \([-1, 1]\).

    Show answer

    \(\big|\frac{x^k}{k^2}\big| \le \frac{1}{k^2}\) there, and \(\sum \frac{1}{k^2}\) converges.

  2. Does \(\sum_{k=1}^{\infty} \frac{1}{k^2 + x^2}\) define a continuous function on \(\mathbb{R}\)?

    Show answer

    Yes: \(\frac{1}{k^2 + x^2} \le \frac{1}{k^2}\), so the M-test gives uniform convergence of continuous terms.

  3. Show that \(\sum_{k=1}^{\infty} x^k\) converges uniformly on \([-r, r]\) for each \(r < 1\) but not on \((-1, 1)\).

    Show answer

    On \([-r, r]\), \(|x^k| \le r^k\) and \(\sum r^k\) converges. On \((-1, 1)\), \(\sup |x^k| = 1\), so the terms do not tend to 0 uniformly.

  4. Let \(f(x) = \sum_{k=1}^{\infty} \frac{\cos(kx)}{k^3}\). Show \(f\) is differentiable with \(f^\prime(x) = -\sum \frac{\sin(kx)}{k^2}\).

    Show answer

    The series of derivatives is dominated by \(\sum \frac{1}{k^2}\), so it converges uniformly; the original series converges at 0. The differentiation theorem applies on every bounded interval.

  5. Let \(\phi(x)\) be the distance from \(x\) to the nearest integer. Show that \(T(x) = \sum_{k=0}^{\infty} 2^{-k}\phi(2^k x)\) is continuous on \(\mathbb{R}\).

    Show answer

    \(\phi\) is continuous with \(0 \le \phi \le \frac{1}{2}\), so each term is continuous and bounded by \(2^{-k-1}\). The M-test gives uniform convergence. This is the Takagi function, which is also nowhere differentiable.

Lesson quiz · 5 questions

Score 60% or more to complete this lesson.

Take the quiz