Ok. This question may sound very easy, but actually i am in great need of it. I have been facing trouble in constructing functions, which are only continuous at some particular sets.

For e.g, the standard example of a function which is only continuous at one point, is the function, $f(x) = x, \ x \in \mathbb{Q}$ and $f(x) = -x, x \in \mathbb{R} \setminus \mathbb{Q}$. Similarly, i would like to know as to how to construct a function which is

  • Continuous at exactly $2,3,4$ points.

  • Continuous exactly at integers

  • Continuous exactly at Natural numbers

  • Continuous exactly at Rationals.

I would like to see many examples (with proof!), so that i can don't struggle when somebody asks me to construct such functions.

link|improve this question
The variety of questions you ask (and the little work you show in them) makes me think you are a whole group of people hiding behind a name, à la Bourbaki... – Mariano Suárez-Alvarez Oct 25 '10 at 16:49
@Mariano: Well, not really. I am the only one! – anonymous Oct 25 '10 at 16:54
1  
see also: math.stackexchange.com/questions/740/… – Isaac Oct 25 '10 at 16:56
7  
@Mariano: This reminds me of a joke I read somewhere: "Why did Bourbaki stop writing books? They discovered that Serge Lang was a single person." – Hans Lundmark Oct 25 '10 at 17:26
1  
@Hans: You made my day, thanks for the joke! :) @Chandru: showing people what you've tried in solving your problems would certainly dispel any doubts. – J. M. Oct 25 '10 at 23:51
show 6 more comments
feedback

2 Answers

up vote 3 down vote accepted
  1. One simple way of constructing a function which is continuous only at a finite number of points, $x=a_1,\ldots,a_n$, is to do a slight modification to the function you give: take a polynomial $p(x)$ that has roots exactly at $x=a_1,\ldots,a_n$ (e.g., $p(x) = (x-a_1)\cdots(x-a_n)$) , and then define $$ g(x) = \left\{\begin{array}{ll} p(x) & \text{if $x\in\mathbb{Q}$;}\\ 0 & \text{if $x\notin\mathbb{Q}$.} \end{array}\right.$$ The function is continuous at $a_1,\ldots,a_n$, and since $p(x)\neq 0$ for any $x\notin\{a_1,\ldots,a_n\}$ then $g(x)$ is not continuous at any point other than $a_1,\ldots,a_n$. Other possibilities should suggest themselves easily enough.

  2. A function that is continuous exactly at the integers: a similar idea will work: find a function that has zeros exactly at the integers, for example $f(x)=\sin(\pi x)$, and then take $$g(x) = \left\{\begin{array}{ll} \sin(\pi x) & \text{if $x\in\mathbb{Q}$;}\\ 0 & \text{if $x\notin\mathbb{Q}$.} \end{array}\right.$$

  3. A function continuous exactly in the natural numbers: take a function that is continuous at the integers, and redefine it as the characteristic function of the rationals in appropriate places(what happens at $0$ depends on whether you believe $0$ is in the natural numbers or not). Assuming that $0\in\mathbb{N}$, one possibility is: $$g(x) = \left\{\begin{array}{ll} \sin(\pi x)&\text{if $x\in\mathbb{Q}$ and $x\geq 0$;}\\ x & \text{if $x\in\mathbb{Q}$ and $-\frac{1}{2}\lt x\leq 0$;}\\ 1 & \text{if $x\in\mathbb{Q}$ and $x\leq -\frac{1}{2}$;}\\ 0 & \text{if $x\notin\mathbb{Q}$.} \end{array}\right.$$

  4. A function continuous exactly on the rationals. This one is a bit trickier. There is no such function. This follows because the set of discontinuities of a real valued function must be a countable union of closed sets.

    Perhaps then, we might anticipate the next question:

  5. A function that is continuous exactly on the irrationals. An example is the following: let $s\colon\mathbb{N}\to\mathbb{Q}$ be an enumeration of the rationals (that is, a bijection from $\mathbb{N}$ to $\mathbb{Q}$. Define $f(x)$ as follows: $$f(x) = \sum_{\stackrel{n\in\mathbb{N}}{s_n\leq x}} \frac{1}{2^n}.$$ The function has a jump at every rational, so it is not continuous at any rational. However, if $x$ is irrational, let $\epsilon\gt 0$. Then there exists $N$ such that $\sum_{k\geq N}\frac{1}{2^k}\lt \epsilon$. Find a neighborhood of $x$ which excludes every $q_m$ with $m\leq N$, and conclude that the difference between the value of $f$ at $x$ and at any point in the neighborhood is at most $\sum_{k\geq N}\frac{1}{2^k}$.

    Edit: As I was reminded in the comments by jake, in fact the "standard example" of a function that is continuous at every rational and discontinuous at every rational is Thomae's function. The example I give is a monotone function, and although it is discontinuous at every rational, it is continuous from the right at every number.

link|improve this answer
@Arturo Magidin: Super Work! Really appreciate it, although the function which is continuous exactly at irrationals appears intricate! – anonymous Oct 25 '10 at 17:11
Isn't expecting a function which is continuous only at irrational numbers not to be intricate slightly weird? :) – Mariano Suárez-Alvarez Oct 25 '10 at 17:14
2  
@Chandru1: Speaking of irrelevant comments... Mariano is not the only one who has wondered in the past about your question-asking habits... e.g., meta.math.stackexchange.com/questions/548/… So it seems hardly fair to start picking on him for something a lot of us wonder about. – Arturo Magidin Oct 25 '10 at 17:19
1  
@Arturo Magidin: In my analysis class, we were given Thomae's function as the classic example of a function continuous exactly at all irrationals. See en.wikipedia.org/wiki/Thomae's_function . Is there a reason you didn't use that one? It seems much simpler. Unless it's somehow the same thing... – jake Oct 25 '10 at 20:06
1  
@Jake: Ah; mine is the classic example of a monotonoe function that is continuous exactly at all rationals. Slightly different "class"... I did know Thomae's function, but the one I always remember is this one. – Arturo Magidin Oct 25 '10 at 20:20
show 9 more comments
feedback

Continuous at 2, 3, 4: $f(x)=(x-2)(x-3)(x-4)$ if $x$ is rational, $f(x)=0$ if $x$ is irrational.

Continuous at the integers: $f(x)=\sin(\pi x)$ if $x$ is rational, 0 if $x$ is irrational.

Continuous at the natural numbers: $f(x)=\sin(\pi x)$ if $x$ is rational and not a nonpositive integer, 0 if $x$ is irrational, 1 if $x$ is a nonpositive integer.

Continuous exactly at the rationals: Impossible, because the set of rational numbers is not a $G_\delta$.

link|improve this answer
@Jonas: Thanks a lot Jonas: By the way can you prove the continuity of $\sin{\pi x}$ at integers! – anonymous Oct 25 '10 at 17:07
@Jonas: I think we can have a function which is discontinuous only at rationals! – anonymous Oct 25 '10 at 17:07
@Jonas. Heh; great minds and all that... – Arturo Magidin Oct 25 '10 at 17:08
1  
@Chandru: if $x$ is not an integer, then $\sin(\pi x)\neq 0$; take $\epsilon \lt \frac{1}{2}|\sin(\pi x)|$ and in any $\delta$ nbd of $x$ you have irrationals where the value of $f$ is more than $\epsilon$ away from $f(x)$; exactly the same as in the first case of the polynomial example for the first question. – Arturo Magidin Oct 25 '10 at 17:09
@Chandru1: The limit along the irrationals is always zero, so the function is continuous precisely where the (continuous) function $\sin(\pi x)$ is zero. You can fill in the details. – Jonas Meyer Oct 25 '10 at 17:10
show 5 more comments
feedback

Your Answer

 
or
required, but never shown