Math Applets

Alternating series (Leibniz criterion)

Leibniz criterion / alternating series test (Theorem 3.5):

Let (an)nN(a_n)_{n\in\mathbb{N}} be a monotonically decreasing null sequence (i.e. an+1ana_{n+1}\le a_n and an0a_n\to 0). Then the alternating series

k=0(1)kak \sum_{k=0}^{\infty} (-1)^k a_k

converges.


How to use the applet

  • an=1(n+1)pa_n=\frac{1}{(n+1)^p}, sn=k=0n(1)kak. s_n=\sum_{k=0}^{n}(-1)^k a_k.
  • Move NN to show terms and partial sums up to index NN.
  • Move pp to change how fast ana_n decreases.
  • Green: the terms ana_n.
  • Red: the even partial sums s2ms_{2m}.
  • Blue: the odd partial sums s2m+1s_{2m+1}.
  • The dashed horizontal red/blue lines indicate the current bounds s2m+1ss2m.s_{2m+1}\le s \le s_{2m}.
  • The vertical gray segment visualizes the “gap” s2ms2m+1=a2m+1, s_{2m}-s_{2m+1}=a_{2m+1}, which tends to 00 as mm\to\infty.
  • s2ms_{2m} (red) moves downward, s2m+1s_{2m+1} (blue) moves upward, and the gap shrinks; hence both subsequences converge to the same limit, so (sn)(s_n) converges.
  • The alternating series (1)kak\sum (-1)^k a_k converges for every p>0p>0 (Leibniz).
  • The corresponding positive series ak=1(k+1)p\sum a_k=\sum \frac{1}{(k+1)^p} converges only if p>1p>1 (and diverges for 0<p10<p\le 1).

Loading graph…
  • Hold Shift + scroll to zoom
  • Hold Shift + drag to move
  • Points shaped like <> act as sliders

Description

Link to code.

Reference: Lecture Notes Calculus 1 ( May22,2022 ) Theorem3.5 page 36

This applet aims to justify Leibniz criterion.

Move the slider N and watch the partial sums sn=k=0n(1)kaks_n=\sum_{k=0}^n (-1)^k a_k.

The even partial sums s2ms_{2m} (red) form a decreasing sequence, while the odd partial sums s2m+1s_{2m+1} (blue) form an increasing sequence. The dashed horizontal lines visualize the bounds

s2m+1ss2m. s_{2m+1} \le s \le s_{2m}.

The vertical “gap” segment shows

s2ms2m+1=a2m+10, s_{2m}-s_{2m+1}=a_{2m+1}\to 0,

so the two bounding subsequences squeeze together and must converge to the same limit. Therefore (sn)(s_n) converges and the series converges.

In this applet we use an=1(n+1)pa_n=\frac{1}{(n+1)^p} with p>0p>0, which is decreasing and satisfies an0a_n\to 0.

In the code all the sequnce points are computed in advance for performance reasons in computeArrays.

The in the update function each sequence point is set to visible depending on the current N

    aPts[n].setAttribute({ visible: vis });
    sPts[n].setAttribute({ visible: vis });