Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

I need to find a function $f:\mathbb{R}\to\mathbb{R}$ which is continuous only at two points, but discontinuous everywhere else.

How on earth would I go about doing this? I can't think of any function like this.

Thanks in advance.

Edit: I've seen examples including the indicator function for rationals. Is this the only method of finding such functions?

share|improve this question
    
Please See this link : math.stackexchange.com/questions/7821/… –  usermath Jun 8 at 17:14
    
Yes, I've made an edit to make sure this question is not a duplicate. –  Mr Croutini Jun 8 at 17:15
    
Not about duplicate..The link seemed very good to me,that's why I suggeseted –  usermath Jun 8 at 17:17
1  
Sorry, I forgot to thank you for the link, it was helpful! I just wanted to ensure and stress that this wasn't a duplicate. –  Mr Croutini Jun 8 at 17:19
    
Don't be sorry.I got your point. –  usermath Jun 8 at 17:22

5 Answers 5

up vote 17 down vote accepted

Think of something like $$f(x)=\begin{cases} x^2 & \text{if } x \in \mathbb{Q}\\ x & \text{if } x \in \mathbb{R-Q}\\ \end{cases} $$ This is only continuous at two points, namely where $x^2=x$.

share|improve this answer
    
very nice! And it can be extended easily to any $n$ by using polynomials of degree $n$ (checking that there are different roots, but still!) –  Ant Jun 9 at 16:29

What about $$ f(x) = \begin{cases} x(1-x) & x \in \mathbb{Q} \\ 0 & x \notin \mathbb{Q} \\ \end{cases}? $$

share|improve this answer

The following function is a standard example of a function that is continuous at one point only: $$ f(x) = \begin{cases} x &: x \in \Bbb Q \\ 0 &: \text{ otherwise.}\end{cases} $$

Show that this is indeed the case. Can you think of a way to modify it so that it's continuous at two points? Hint:

Instead of $x$ in the first case, consider the polynomial $(x - x_0)(x - x_1)$.

This can be generalized to construct a function that is continuous at a finite set of points only.

share|improve this answer

It is possible to use something other than the rational indicator function to define these functions. Specifically, take $S$ to be a set define the function $I_S$ by

$$I_S(x) = \left\{\begin{array}{cc} 1 & x \in S\\ 0 & x \not\in S\end{array}\right.$$

This function is called the indicator function of $S$. Now, let $S$ be a dense subset of $\mathbb{R}$ such that $S^C$ is also dense in $\mathbb{R}$. (For example, we could take $S$ to be the set of all rational numbers with terminating decimal expansions.) Then, the function

$$f(x) = x^2I_S(x) + x(1-I_{S}(x))$$

is continuous at only $x=0$ and $x=1.$

share|improve this answer

General answer. If you have $a(x)$ and $c(x)$ continuous and $b(x)$ nowhere continuous, then $$a(x)\cdot b(x) + c(x)$$ is continuous at $x$, iff $a(x) = 0$.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.