Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Please help me think of an example of two discontinuous functions on $\mathbb R$ whose composition gives a continuous function on $\mathbb R$.

share|cite|improve this question
let $f(X)=\frac{1}{x}$ and $g(X)=\frac{1}{1-x} $ then fog is continuous – Maisam Hedyelloo Jan 19 '13 at 16:25
up vote 3 down vote accepted

Hints for a general process of producing such functions:

  1. The identity function $\mathrm{id}:\mathbb{R}\to\mathbb{R}$, defined by $\mathrm{id}(x)=x$, is continuous.

  2. Think of two non-trivial functions on $\mathbb{R}$ that, when composed, give the identity.

  3. Define $f$ and $g$ to be those functions, except only applied to some subset $S\subset\mathbb{R}$ (for example, the irrationals), defining them to be the identity on $\mathbb{R}\setminus S$.

As long as the functions in step 2 map $S$ to itself, this (usually) produces discontinuous functions with the desired properties.

Some examples:

  • Choose the function "multiply by $-1$", apply it to any subset $S$ of $\mathbb{R}$ symmetric about the origin other than $\mathbb{R}$ itself.

  • Choose the function "take reciprocals", apply it to any subset $S$ of $\mathbb{R}\setminus\{0\}$ which is closed under taking reciprocals.

share|cite|improve this answer
Thank you very much! – Ryan Jan 19 '13 at 16:36

$f(x)=\frac{1}{x}=g(x)$. You have $f(g(x))=\frac{1}{g(x)}=\frac{1}{\frac{1}{x}}=x$.

share|cite|improve this answer
That's technically not a function on $\mathbb{R}$, since it's not defined at 0. Of course, for the purposes of the question, you can just define $f(0)=0$ and it's okay. – Zev Chonoles Jan 19 '13 at 16:25
define it piecewise to be 0 at x=0 for both f and g – mathemagician Jan 19 '13 at 16:26
Great example, gracias. – Ryan Jan 19 '13 at 16:37

Your Answer


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.