Math Applets

LimSup LimInf

Definition of limit supperior and limit inferior:

Let (an)nN(a_n)_{n \in \mathbb{N}} be a bounded sequence.

i) The limit superior of (an)nN(a_n)_{n \in \mathbb{N}} is defined by lim supnan=limk(supnkan).\limsup_{n \to \infty} a_n= \lim_{k \to \infty} \left( \sup_{n \ge k} a_n \right).

ii) The limit inferior of (an)nN(a_n)_{n \in \mathbb{N}} is defined by lim infnan=limk(infnkan).\liminf_{n \to \infty} a_n= \lim_{k \to \infty} \left( \inf_{n \ge k} a_n \right).


Characterization of the limit superior:

Let (an)nN(a_n)_{n \in \mathbb{N}} be a bounded sequence and let aRa \in \mathbb{R}.
Then lim supnan=a,\limsup_{n \to \infty} a_n = a, if and only if for every ε>0\varepsilon > 0 the following conditions are satisfied:

i) It holds that an<a+εa_n < a + \varepsilon for almost all (i.e., all except finitely many) nNn \in \mathbb{N}.

ii) It holds that an>aεa_n > a - \varepsilon for infinitely many nNn \in \mathbb{N}.

How to use the applet

  • Use the slider kk to choose the tail {an:nk}\{a_n : n\ge k\}.

  • Use the slider ε\varepsilon to change the thickness of the ε\varepsilon-neighborhoods around lim supan\limsup a_n (pink) and lim infan\liminf a_n (blue).

  • The red circle marks supnkan\sup_{n\ge k} a_n (computed over the displayed tail).

  • The blue circle marks infnkan\inf_{n\ge k} a_n (computed over the displayed tail).

  • The dashed horizontal lines are the levels lim supan\limsup a_n (pink) and lim infan\liminf a_n (blue).

  • The dashed bands show lim supan±ε\limsup a_n \pm \varepsilon (pink) and lim infan±ε\liminf a_n \pm \varepsilon (blue).

  • Points with n<kn<k are faded (they are “discarded” when looking at the tail).

  • Orange points are exceptions:

    • above lim supan+ε\limsup a_n + \varepsilon, or
    • below lim infanε\liminf a_n - \varepsilon. For a correct limit statement, you should be able to choose kk so that there are only finitely many such exceptions.
  • Pink points are “witnesses” that the sequence comes arbitrarily close from below to lim supan\limsup a_n:

an>lim supanεinfinitely often. a_n > \limsup a_n - \varepsilon \quad \text{infinitely often.}
  • Blue points are “witnesses” that the sequence comes arbitrarily close from above to lim infan\liminf a_n:
an<lim infan+εinfinitely often. a_n < \liminf a_n + \varepsilon \quad \text{infinitely often.}

Suggested exploration

  1. Fix a small ε\varepsilon (e.g. ε=1\varepsilon=1) and increase kk.
    Observe: orange points eventually disappear.
  2. Keep kk large and shrink ε\varepsilon.
    Observe: you still get infinitely many pink/blue witness points near the corresponding dashed level.



Technical Description

Link to code.

Reference: Lecture Notes Calculus 1 ( May22,2022 ) Theorem 2.16 page 28

For this example, I have selected the alternating sequence an=(1)n(10+10+60sin(0.8n)n)a_n = (-1)^n \left( 10 + \frac{10 + 60\sin(0.8n)}{n} \right)
to provide a clear distinction between lim inf\liminf and lim sup\limsup.

To clarify the first definition, the student can adjust the value of kk in supnkan\sup_{n \ge k} a_n and infnkan\inf_{n \ge k} a_n using the slider.

The current values of supnkan\sup_{n \ge k} a_n and infnkan\inf_{n \ge k} a_n are highlighted by circles with corresponding colors: red for the limsup and blue for the liminf.
In code tyheir are calculated as:

const getSupData = () => {
    const k_curr = Math.floor(kSlider.Value());
    let maxVal = -Infinity; let maxIndex = k_curr;
    for (let n = k_curr; n <= MAX_K; n++) {
        const val = values[n - 1];
        if (val >= maxVal) { maxVal = val; maxIndex = n; }
    }
    return { index: maxIndex, val: maxVal };
};

const getInfData = () => {
    const k_curr = Math.floor(kSlider.Value());
    let minVal = Infinity; let minIndex = k_curr;
    for (let n = k_curr; n <= MAX_K; n++) {
        const val = values[n - 1];
        if (val <= minVal) { minVal = val; minIndex = n; }
    }
    return { index: minIndex, val: minVal };
};

Both lim inf\liminf and lim sup\limsup are marked by dashed lines in their respective colors.

An illustration of the theorem is provided by allowing the student to move
the corresponding ϵ\epsilon-slider for each of the limits.

For instance, in the case of the lim sup\limsup, the points below a+εa+\varepsilon, are those finetely many nn to discharge and highlighted in orange, while the infinetely many points above aεa - \varepsilon share the same limit color.

for (let n = 1; n <= MAX_K; n++) {
    board.create('point', [n, values[n - 1]], {
        ...DEFAULT_POINT_ATTRIBUTES,
        name: '',
        size: 1,
        strokeColor: COLORS.black,
        strokeWidth: 1,
        fixed: true,
        fillColor: () => {
            const k = kSlider.Value();
            const val = values[n - 1];

            if (n < k) return COLORS.lightGray;

            const epsSup = getEpsSup();
            const epsInf = getEpsInf();

            // "Almost all n are < Sup + eps" -> Exception if > Sup + eps
            if (val > TRUE_SUP + epsSup) return COLORS.orange;
            // "Almost all n are > Inf - eps" -> Exception if < Inf - eps
            if (val < TRUE_INF - epsInf) return COLORS.orange;

            // "Infinitely many n > Sup - eps" -> Witness if inside Sup tube
            if (val > TRUE_SUP - epsSup) return COLORS.pink;

            // "Infinitely many n < Inf + eps" -> Witness if inside Inf tube
            if (val < TRUE_INF + epsInf) return COLORS.blue;

            return COLORS.black;
        },
        strokeOpacity: () => n < kSlider.Value() ? 0.3 : 1
    });
}