# Math Help - continuous functions

1. ## continuous functions

These two problems appear in my textbook:

Give a function f: R to R continuous only at x = 0 and x = 1.

For this, let f(x) = x^2 if x is rational and x if x is irrational.
Then it is continuous only at x^2 = x which implies x equals 0,1.

Give a function f: R to R continous only at x1, x2,....,xn.
This one I'm not really sure what to do. Can you do something similar to the first one?
Any help would be appreciated.

2. Consider the polynomial,
$f(x)=(x-1)...(x - n)$ is you multiply it out you get some negative terms and some positive terms. So we can write $f(x) = p(x) - n(x)$ (and now $n(x)$ has only positive terms).

Example: Say $f(x) = (x-1)(x-2) = x^2 - 3x + 2$ then $p(x) = x^2 + 2$ and $n(x) = 3x$.

Now define $g(x)$ to be $p(x)$ at rational points and $n(x)$ at irrational points.

Example: As above define $g(x)$ to be $x^2 + 2$ at the rational points and $3x$ at the irrational points.

Then it is continous precisely when $p(x) = n(x) \implies p(x) - n(x) = 0$ so $f(x) = 0$ so $(x-1)...(x-n) = 0$ so $1,2,...,n$. This mean it is continous at exactly these $n$ points.

Note: It is not really necessary to do what I did there are many ways to construct such functions but I did it because it looks more pleasing.

3. I'm not 100% sure what you're doing.

What would the function look like?

Could it be:
f(x) = (x - x1)(x - x2)....(x - xn) if x is rational and 0 if x is irrational?

4. Originally Posted by MKLyon
I'm not 100% sure what you're doing.
Here is a slight variation of TPH’s function (it is the same idea really).
$f(x) = \left\{ {\begin{array}{rr}
{\left| {\left( {x - x_1 } \right)\left( {x - x_2 } \right) \cdots \left( {x - x_n } \right)} \right|} & {x \in Q} \\
{ - \left| {\left( {x - x_1 } \right)\left( {x - x_2 } \right) \cdots \left( {x - x_n } \right)} \right|} & {x \in \Re \backslash Q} \\
\end{array}} \right.$
.

Do you see that it is continuous on $\left\{ {x_1 ,x_2 , \cdots ,x_n } \right\}$.