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.

This was a bonus question on a test I just took:

Write a function with a domain of all real numbers and a range of only $2$ numbers.

The closest I got to an answer was $f(x)=\frac{x}{|x|}$, which has a range of $\{-1,1\}$, but it fails the part about the domain, because 0 has to be excluded.

Any ideas for the solution to this? Is a solution even possible?

share|improve this question
    
Do you mean "write with a simple formula"? Otherwise, you don't you define $f(x)=0$ for $x\geq 0$ and $f(x)=1$ for $x<0$? –  Luiz Cordeiro Feb 15 at 3:21
    
I think it has to be a simple formula. Both of these are correct solutions, but I think the answer was supposed to be in the form of f(x)=_______. –  Annie Feb 15 at 3:52
add comment

3 Answers

up vote 5 down vote accepted

The Intermediate Value Theorem asserts that if $f$ is continuous and $a,b \in \mathrm{range}(f)$ then $[a,b] \subseteq \mathrm{range}(f)$. Hence, the function must be discontinuous.

This means we are forced to construct a function piecewise (although it might be disguised). An example is $$f(x)=\begin{cases} 0 & \text{if } x<0 \\ 1 & \text{if } x \geq 0. \end{cases}$$

In fact, every such function will have this form: $$f(x)=\begin{cases} a & \text{if } x \in I \\ b & \text{otherwise} \end{cases}$$ for some $I \subsetneq \mathbb{R}$ and $a,b \in \mathbb{R}$ with $a \neq b$.

We could disguise the piecewise structure, e.g., by taking $$f(x)=(-1)^{\lfloor x \rfloor}.$$

share|improve this answer
add comment

$f(x):=0^{|x|}$ is another solution.

share|improve this answer
    
Provided you agree with the convention that $0^0=1$ (which I do). –  egreg Feb 15 at 12:16
    
@egreg Who dares to disagree? Atomic power plants would explode, the binomial theorem would not hold, Taylor approximations would be invalid, in total the world would be a worse place. The consequences of ‘$0^0$ was not $1$’ are much more dramatic than the conclusions which J. Hendrix draw in his famous song “If Six was Nine”. –  Michael Hoppe Feb 15 at 20:51
    
Look in the site; there's plenty of people maintaining that $0^0$ should be undefined. With usually very poor arguments related to limits. See math.stackexchange.com/questions/11150/… –  egreg Feb 15 at 20:53
1  
I particularly dislike the most upvoted answer, which basically says “$0^0$ is undefined, but defining it by $0^0=1$ would not give any contradiction”. –  egreg Feb 15 at 20:59
    
@egreg Of course I know about that annoying stuff. Let those people correct a plethora of mathematical libraries in which $0^0$ is defined in the canonical way. –  Michael Hoppe Feb 15 at 21:01
show 1 more comment

Another nice example: $$ f(x)=\lim_{k\to\infty}\Bigl(\lim_{n\to\infty}\bigl(\cos(k!\,\pi x)\bigr)^{2n}\Bigr) $$ (sources: Nowhere continuous functions, on Wikipedia and Dirichlet function, on Wolfram MathWorld).

This can be written also $$ f(x)=\begin{cases} 1 & \text{if $x$ is rational},\\ 0 & \text{if $x$ is not rational}. \end{cases} $$

share|improve this answer
add comment

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.