Supose that for any natural number $n$, $A_n$ is a finite set of numbers from $[0,1]$, and that $A_m$ and $A_n$ have no common elements if $m \neq n$, ie

$$m \neq n \Rightarrow A_n\cap A_m=\emptyset$$

Let $f$

$$f(x)= \begin{cases} 1/n & \text{for } x \in A_n \cr 0 & \text{for } x \notin A_n \text{ for any }n \end{cases}$$

I guess the definition is clear: If $x$ is in some of the $A_n$ then we map it to $1/n$, and if $x$ is in no $A_n$ the function is zero. It's like a modified characteristic function.

$$f(x) =\sum_{n \in \Bbb N} \frac 1 n \chi_{A_n}$$

(Thanks Asaf)

I have to prove that $$\lim_{x \to a }f(x)=0$$ for all $a$ in $[0,1]$

This is my inutuitive interpretation of the problem.

Since all the $A_n$ are finite sets, the union $S= \bigcup_{n \in \Bbb N}A_n$ of the sets is countably infinite. (Maybe this has to be proven before, but I think it is true.)

This means that $f(x)\neq 0$ for countable infinite many $x$. But then the set of $x$ such that $f(x)=0$ is uncountable, since $[0,1]$ is uncountable so $f$ is $0$ almost everywhere in $[0,1]$.

Although this is not homework, I'd like you to help me find the way to the "solving argument", maybe show how it can be done for $a=1/2$. This is from Spivak's Calculus, so all the set theoretic things I wrote don't really apply, it should probably be proven by some basic set arguments and the definition of the limit.

Attempt of proof:

DEFINITION: $$\lim_{x \to a}f(x)=L$$ if $\forall \epsilon >0 \exists \delta >0 : 0<|x-a|<\delta \Rightarrow |f(x)-L|<\epsilon$. This is Spivak's definition. Note that

$0<|x-a|$ means the limit excludes the point $a$. Suggested by t.b. is the notation

$$\lim_{\substack{x \to a \\ x \neq a}} f(x)$$

T Let $f : [0,1] \to \mathbb Q$ such that $$f(x) = \sum_{n \in \Bbb N} \frac{\chi_{A_n}(x)}{n}$$

then $$a \in [0,1] \Rightarrow \lim_{x \to a} f(x) = 0$$

P (Based on Zhang's idea).

Since $A_1$ is finite, there exists a $\delta_1 >0$ such that no $x \in A_1$ is in $(a-\delta_1,a)\cup (a,a+\delta_1)$. Thus, $|f(x)|< \dfrac 1 2$ for $0<|x-a|<\delta_1$. Similarily, $\exists \delta_2 >0 : x\in A_2 \wedge x \notin (a-\delta_2,a)\cup (a,a+\delta_2) $ so $|f(x)|< \dfrac 1 3 $ for $0<|x-a|<\delta_2$. Analogously,

$$\exists \delta_n >0 : x\in A_n \wedge x \notin (a-\delta_n,a)\cup (a,a+\delta_n) $$, so $$|f(x)|< \dfrac 1 n \text{ for } 0<|x-a|<\delta_n$$


Let $\epsilon>0$ be given. Let $N\in \mathbb N$ such that $1/N < \epsilon$. Let $n \geq N$, and $$\delta = \min \{ \delta_1,\cdots,\delta_n\}$$ Then

$$0<|x-a|<\delta \Rightarrow |f(x)|<\epsilon$$ ∎.

Today I was discussing this problem with a professor and at first glance he thought it was the case that

$$S= \bigcup_{n \in \Bbb N}A_n= [0,1]$$

I provided the following explanation.

By Cantor's proof, $[0,1]$ is uncountable. I'll use $\sim$ to say there is a bijection between two sets $A$ and $B$. Since all the $A_n$ are finite, their cardinality is a natural number, so

$$A_1 \sim \left \{ 1,2,\cdots, |A_1| \right \}$$

$$A_2 \sim \{ |A_1|+1,\cdots, |A_1|+|A_2| \}$$

$$\cdots$$ $$A_n \sim \left\{ \sum_{k <n}|A_k|+1,\cdots, \sum_{k \leq n} |A_k|\right\}$$

Then, taking the union produces $$\bigcup_{n \in \Bbb N}A_n\sim \Bbb N$$

so the set $S$ is countable and thus can't be $[0,1]$.

So far, I have these satisfactory ideas, but I want to write an acceptable proof.

anon: If $g$ and $f$ differ at only a finite number of points then $\lim f = \lim g$. We define a useful $g_m$ such that it differs with $f$ at only a finite amount of points, and we show $0 \leq g_m \leq 1/m$.

I got this one and hope I can devise a proof.

Levon/Glouglou/Zhang Show that for any sequence $x_n$ s.t. $x_n \to a$, there exists an $n_0$ such that $$\{ x_k \}_{k \geq n_0}\cap A_n=\emptyset$$ for all $n \in \Bbb N$.

This means that for a suitable $\delta$, the set $M=\{ x : x \in [a-\delta,a+\delta]\}$ contains no $x \in A_n$, so $f(x) < \epsilon$ (actually it is strictly $0$) in that neighborhood of $a$.

  • 2
    $\begingroup$ Actually: $$f(x)=\sum_{n\in\mathbb N}\frac1n\chi_{A_n}(x)$$ This is well defined since the $A_n$ are disjoint so only one of them is non-zero. $\endgroup$
    – Asaf Karagila
    May 19, 2012 at 23:00
  • 1
    $\begingroup$ Why is this downvoted? $\endgroup$
    – 000
    May 19, 2012 at 23:59
  • $\begingroup$ @Limitless I don't know. People are strange. $\endgroup$
    – Pedro
    May 20, 2012 at 23:25

5 Answers 5


Your interpretation is not quite correct. For example the function $$f(x) = \left\{ \begin {array} {ll} 1 & x \text { is rational} \\ 0 & x \text { is irrational} \end {array} \right.$$ also has the property that it is nonzero only on countably many points. However, at no point the limit of this function exists. (Because you can approximate each number by rationals and by irrationals).

As a hint I would suggest the following. If $a, \varepsilon$ and $n$ are given, then you can peak $\delta$ so small that the $\delta$ neighbourhood of $a$ does not contain numbers from $A_1, ..., A_n$.

  • 1
    $\begingroup$ Note that $A_n$ is finite for all $n$. $\endgroup$
    – Asaf Karagila
    May 19, 2012 at 22:59

Here's my thought process for a derivation. Let $g$ and $h$ be $\Bbb R\to\Bbb R$ functions.

  • Prove that if $g(x)$ and $h(x)$ differ at only one value $x\in\Bbb R$, then for all $a\in\Bbb R$ the limits $$\lim_{x\to a}\,g(x)=\lim_{x\to a}\,h(x)$$ are still the same. (Split into two cases: $a$ is "that one value," and otherwise.)
  • Invoke induction to conclude that all of the limits for $g,h$ are still always equal whenever $g$ and $h$ differ at only a finite number of $x$ values (not necessarily just one value).
  • Define the functions $$f_m(x)=\sum_{n\ge m}\frac{\chi_{A_n}(x)}{n}=\begin{cases}\frac{1}{n} & \text{if } x\in A_n\text{ and }n\ge m \\[8pt] 0 & \text{otherwise}.\end{cases}$$ Observe that
    • $f=f_1$,
    • $f_m$ and $f_{m+1}$ differ only for $x\in A_m$ (which is finite), and
    • $\forall x\in\Bbb R:~~ 0\le f_m(x)\le \frac{1}{m}$.

Added: The claim is actually only true under a certain definition of the limit. For example, if $u\in A_k$ then $f(u)=1/k$, so every neighborhood of $u$ will contain a point $x_0$ such that $f(x_0)=1/k$ (in particular, $x_0=u$ itself), hence there is no neighborhood $I$ of $u$ in which $|f(x)-0|<\delta=1/k$ for all $x\in I$, hence the limit under this definition cannot be $0$. Instead we need a definition of the limit that ignores the point $u$. The easiest version is to say that if the left and right limits exist and are equal, we set this value to be "the" limit, and otherwise say the limit does not exist. We'll use this.

Suppose $f,g$ are equal except at the point $u$. If $a\ne u$ then we can choose a neighborhood of $a$ that does not include $u$ in which $f$ and $g$ are everywhere equal, hence the limits of $f,g$ at $a$ must be equal. If $a=u$ then we see that the right limits of $f,g$ must be equal because they are the same function on $(u,\infty)$, and the same for the left limits and $(-\infty,u)$, hence if "the" limits for $f,g$ exist they must be equal.

  • $\begingroup$ This might me it. I can't see right now, at first glance, how to prove the first assertion, but it the result seems somehow striaghtforward. I'm interested is finding the $\delta$ that works. Is it too complicated to do so? I will add something in the edit to show my work on this $\endgroup$
    – Pedro
    May 21, 2012 at 17:28
  • $\begingroup$ @PeterTamaroff I added some more explanation. $\endgroup$
    – anon
    May 21, 2012 at 18:14
  • $\begingroup$ anon, thanks for the add. I was also thaught that the limit is considered in the neighborhood of a not containing $a$. $\endgroup$
    – Pedro
    May 21, 2012 at 19:39
  • $\begingroup$ i.e $0<|x-a|<\delta$ $\endgroup$
    – Pedro
    May 21, 2012 at 21:53

The key is that $A_n$ are all finite. Can you see that if an ant approaches $a$ without touching $a$, for any $n$, eventually it will leave $A_1, A_2, \cdots, A_n$? If you see that then you are one step to the answer.

  • $\begingroup$ Write this more formally and I will upvote. You are saying that given any $a \in [0,1]$ eventually the sequence approaching $a$ will consist solely of $x \notin A_n$ right? I can see this, so maybe you can put it in a proof, caould you? $\endgroup$
    – Pedro
    May 20, 2012 at 18:13
  • $\begingroup$ @PeterTamaroff Once you get the intuition, you should challenge it and if it is correct, tightening it up into a proof is a good exercise. It can't be that in any $(a-\epsilon, a)\cup(a, a+\epsilon)$, there are always points in $A_1$, for otherwise you get a infinite sequence of distinct values in $A_1$ approaching $a$ but $A_1$ is finite. So you know in this neighbourhood $f\le 1/2$. Then do the same thing for $A_2$ and you bound the function value by 1/3, and so on. $\endgroup$
    – Spook
    May 21, 2012 at 0:17
  • $\begingroup$ Yes, that is what I thought too. It just the ant that put me off, =). $\endgroup$
    – Pedro
    May 21, 2012 at 0:30
  • $\begingroup$ Are you suggesting an inductive proof? $\endgroup$
    – Pedro
    May 21, 2012 at 21:26
  • $\begingroup$ Not really, that is not induction--there isn't a base case or induction step. And remember, induction proves something true for all n, I am only saying you can find a neighbourhood where my claim holds for all but finitely many. $\endgroup$
    – Spook
    May 22, 2012 at 9:09


For any $\varepsilon > 0$, the set $\{ x\ |\ f(x) > \varepsilon \}$ is finite.

  • $\begingroup$ Could you expand? $\endgroup$
    – Pedro
    May 21, 2012 at 0:32
  • $\begingroup$ @PeterTamaroff 1. The hint is true since there are finitely many $n < \frac{1}{\varepsilon}$ and every $A_n$ is finite too. 2. Take any sequence $x_n \to a$ and show that for any $\varepsilon > 0$ there exists $N$ such that $f(x_n) < \varepsilon$ for all $n > N$ (as the set in the hint is finite, the supply of bad elements will end in finite number of steps). $\endgroup$
    – dtldarek
    May 21, 2012 at 2:39
  • $\begingroup$ I understood the hint. Can sequences be avoided? i.e. can we find the $\delta$ that makes $f < \epsilon$? $\endgroup$
    – Pedro
    May 21, 2012 at 17:30
  • $\begingroup$ Sure, just set $\delta = \frac{1}{2} \min\{x\ |\ f(x) > \varepsilon \}$ :-P $\endgroup$
    – dtldarek
    May 21, 2012 at 18:41
  • $\begingroup$ Wait, should I take that seriously? $\endgroup$
    – Pedro
    May 21, 2012 at 19:40

Hint : consider an arbitrary sequence $x_n$ converging to $a$ (the value of $a$ is of no consequence here). You have to show that $\lim_{n \rightarrow \infty} f(x_n)=0$. What can be said about the set of integers $n$ such that $f(x_n)$ is greater than, say, $1/N$ ?


You seem to want a complete solution now. Here it is.

It is known that $\lim_{x \rightarrow a} f(x)=0$ iff for any sequence $x_n \rightarrow a$, $\lim_{n \rightarrow \infty} f(x_n)=0$. Let $(x_n)$ be such a sequence, $\epsilon >0$, and $N$ an integer so that for every $n \geq N$, $\frac{1}{n} \leq \epsilon$. The union $\cup_{n \leq N} A_n$ being finite, there is a $n_0$ such that for any $n \geq n_0$, $n \notin \cup_{m \leq N} A_m$. Therefore, for every $n$ greater than $n_0$, $|f(x_n)| \leq \epsilon$ since $f(x_n)$ is equal to $\frac{1}{k}$ with $k \geq N$ if $x_k$ belongs to a $A_k$, and 0 otherwise.

So we have proven that for arbitrary $\epsilon$, there is a $n_0$ such that for any $n \geq n_0$, $|f(x_n) \leq \epsilon$, which is exactly what we wanted.

  • $\begingroup$ Why a sequence? I also thought of what you are suggesting, but there is no use of sequences in the chapter. I can't put it formally, but there will be some $x_n$ such that $f(x_n)=0$ and if else $f(x_n)\leq \frac{1}{n}$ right? $\endgroup$
    – Pedro
    May 19, 2012 at 23:00
  • $\begingroup$ well I guess you don't really need sequences, I just find it simpler. the thing about the set I mentionned is, it's finite (why?) and so, for arbitrary $N$, for $n$ large enough $f(x_n)$ will be less than $1/N$. Levon hinted at a way to write it without sequences. $\endgroup$
    – Albert
    May 19, 2012 at 23:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .