You need to use the definition of limit: the limit of f(x) as x approaches a is equal to L if for every , there is a such that whenever , . Hint: there are only finitely many points where .
Suppose f is a function such that: f(x)=0 if x is irrational and 0<x<1; f(x)=1/q if 0<x<1 is rational and in reduced form p/q, i.e. p and q have no common factor. How do I show that for any number a with 0<a<1, f approaches 0 at a?
Since the "neighborhood" of 0 we need to consider (our "delta") can be VERY small, we can insist that it be less than 1/2. Now how many values does f have in (0,1) that are larger than or equal to 1/2? Just one: at 1/2.
Similarly, we can always make delta smaller than 1/3. Now we have 3 values that are "exceptions": 1/3, 1/2 and 2/3.
Now once we CHOOSE an epsilon, it will be smaller than SOME 1/N, for some integer N. And we will have less than 1+2+3+...+N-1 "exceptions" (some fractions will be "counted twice" we only get two exceptions for the fourths, since we already counted 2/4 as 1/2), which is a finite number. so if delta is smaller than this smallest exception, f will never be more than epsilon away from 0 (although it will still BE non-zero for infinitely many points).
Note that our delta will be dependent upon the epsilon we chose. This is normal. If you look closely, I've already given you a big hint as to which delta to use.
This argument shows that f approaches 0 at 0 (not surprising). Can you see how to modify it for any point in (0,1)? Hint: given the interval (a-ε,a+ε) there is still only a finite number of exceptions, since the number of exceptions in the entire open interval (0,1) that equal or exceed 1/N is finite. How small does delta need to be to ensure we do not have any rational number of the form k/N in it?