Math Applets

LimSup LimInf

Definition of limit supperior and limit inferior:

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

i) The limit superior of (an)n∈N(a_n)_{n \in \mathbb{N}} is defined by lim sup⁡n→∞an=lim⁡k→∞(sup⁡n≥kan).\limsup_{n \to \infty} a_n= \lim_{k \to \infty} \left( \sup_{n \ge k} a_n \right).

ii) The limit inferior of (an)n∈N(a_n)_{n \in \mathbb{N}} is defined by lim inf⁡n→∞an=lim⁡k→∞(inf⁡n≥kan).\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)n∈N(a_n)_{n \in \mathbb{N}} be a bounded sequence and let a∈Ra \in \mathbb{R}.
Then lim sup⁡n→∞an=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) n∈Nn \in \mathbb{N}.

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

How to use the applet

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

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

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

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

  • The dashed horizontal lines are the levels lim sup⁡an\limsup a_n (pink) and lim inf⁡an\liminf a_n (blue).

  • The dashed bands show lim sup⁡an±ε\limsup a_n \pm \varepsilon (pink) and lim inf⁡an±ε\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 sup⁡an+ε\limsup a_n + \varepsilon, or
    • below lim inf⁡an−ε\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 sup⁡an\limsup a_n:

an>lim sup⁡an−ε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 inf⁡an\liminf a_n:
an<lim inf⁡an+ε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 sup⁡n≥kan\sup_{n \ge k} a_n and inf⁡n≥kan\inf_{n \ge k} a_n using the slider.

The current values of sup⁡n≥kan\sup_{n \ge k} a_n and inf⁡n≥kan\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
    });
}