# Function continuous at irrationas and integers

1. Nov 16, 2004

### zolit

I have to either give an example or show that no such function exists:

A real valued function f(x) continuous at all irrationals and at all the
integers, but discontinuous everywhere else.

I think such function exists and I would define it as follows:

f(x) = 0 if x is an irrational or an integer
1/q if x is rational (p/q) but not an integer.

This way the proof is similar to the case for continuous for irrationas, discontinuous everywhere else. Each rational can be viewed as a limit of a sequence of irrationals, right? So those rationals that have the same value as that sequence (integers in my case) will be continuous, those that don't won't be.
Does this sound right?

2. Nov 16, 2004

### arildno

Your argument seems very right to me.

3. Nov 16, 2004

### Integral

Staff Emeritus
It is not clear to me that your function as defined is continuous anywhere,

I am having troubles with your function on the rationals, it is not clear that it is even a function.

$$f ( \frac 1 2 ) <> f( \frac 2 4 )$$

Seems like you would need to throw in a requirement that P and q must be relatively prime. But then, I think you will be able to find a rational (y) in every neighborhood of an irrational (x) such that f(y) is not in the corresponding neighborhood of f(x). so your function on the irrationals is not continuous.

I know that I have not expressed this precisely, but since I do not know what definition of continuity you are working with, I have tried to make it general. Do a bit of analysis along the lines I am describing, see if it holds. I have not done a detailed analysis and may be wrong, that is your job!

4. Nov 16, 2004

### philosophking

Also think about it like this. Any delta neighborhood is going to include both rationals and irrationals. Therefore for any x_0, you can find an x such that |f(x) - f(x_0)| (is not less than) epsilon.

I really think there is a way to do this though, just think about how you can satisfy your definitions.

5. Nov 17, 2004

### Hurkyl

Staff Emeritus
zolit does, in fact, have the right function. (once he adds the condition that p and q are relatively prime)

6. Nov 17, 2004

### zolit

Yeah, that's what I forgot to specify: all rational non-integers p/q expressed in the lowest order. this takes cares of 2/4, etc.
Thanks for all input.