# Proving that a function can't take exactly same value twice

## Homework Statement

Prove that there does not exist a continuous function f, defined on R which takes on every value exactly twice.

## Homework Equations

It uses this property:
1... If f is continuous on [a,b], then there exists some y in [a,b], such that f(y)≥f(x), for all x in [a,b]

## The Attempt at a Solution

This problem was taken from Spivak-calculus.
He did give a hint in the problem: He asks us to consider f(a) for some 'a' in R. By definition, the function takes the same value at some b in R. So, f(b)=f(a).
I am considering the case when x is in [a,b] and f(x)≥f(a). For all other x excluding this interval, f(x)<f(a)
f is continuous on R, which means that it must be continuous on [a,b]. By using the above property,,there exists some y in [a,b], such that f(y)≥f(x), for all x in [a,b]. But by definition of f, there is a y1 in [a,b] such that f(y)=f(y1). Here y1<y or y1>y.....let us denote set D=[y,y1] or [y1,y] depending on which is greater(either y or y1). Here, let D=[y,y1]
Let us consider D. f, is continuous on D. so, there exists an k in D such that f(k)≤f(m) for all m in D.
There exists no h in D such that f(h)=f(y). Orelse, the function takes three values....a clear contradiction.
But k is in [a,b], so this means that f(k)≥f(a). But clearly f(k) is not equal to f(a).
So, f(k)>f(a) but less than f(y).
since f(y)>f(k)>f(a) and f is continuous on [a,y], there exists some p in [a,y] such that f(p)=f(k)'
Also in [y1,b], we have f(y1)>f(k)>f(b) and f is continuous. so there exists z in [y1,b] such that f(z)=f(k1)
We have three points(z,p,k) where the value of the function is same, a contradiction to the assumption of our f. Hence, there exists no f which takes the same value twice in R. Hence proof. Is my proof right?

stevendaryl
Staff Emeritus

## Homework Statement

Prove that there does not exist a continuous function f, defined on R which takes on every value exactly twice.

## Homework Equations

It uses this property:
1... If f is continuous on [a,b], then there exists some y in [a,b], such that f(y)≥f(x), for all x in [a,b]

## The Attempt at a Solution

This problem was taken from Spivak-calculus.
He did give a hint in the problem: He asks us to consider f(a) for some 'a' in R. By definition, the function takes the same value at some b in R. So, f(b)=f(a).
I am considering the case when x is in [a,b] and f(x)≥f(a). For all other x excluding this interval, f(x)<f(a)
f is continuous on R, which means that it must be continuous on [a,b]. By using the above property,,there exists some y in [a,b], such that f(y)≥f(x), for all x in [a,b]. But by definition of f, there is a y1 in [a,b] such that f(y)=f(y1).

That doesn't seem right. You have that $f(a) = f(b)$. So somewhere between $a$ and $b$, the function has its maximum value for that interval. So you're assuming that that is at the point $y$. So $a \leq x \leq b \Rightarrow f(x) \leq f(y)$. Now, you say:

"...by definition of $f$, there is a $y_1$ in $[a,b]$ such that $f(y) = f(y_1)$"

That's not right. All you know is that there is some $y_1$ such that $f(y) = f(y_1)$. You don't know that $y_1$ is in the interval $[a,b]$

• Alpharup
That's not right. All you know is that there is some $y_1$ such that $f(y) = f(y_1)$. You don't know that $y_1$ is in the interval $[a,b]$
We have taken f such that
f <f(a), for all x<a and x >b.
So, y1 should lie this interval, if my assumption is not wrong.

stevendaryl
Staff Emeritus
We have taken f such that
f <f(a), for all x<a and x >b.
So, y1 should lie this interval, if my assumption is not wrong.

Oh. I thought the only thing you were assuming was that $f(a) = f(b)$. How do you know you can assume that $f(x) < f(a)$ for $x < a$?

Let f(x)≥f(a) for x<a and x>b,
Consider the case when x<a. There is a point j present such that j<a,
The function f is contiunous at [j,a].
Here f(x)≥f(a), for all x in [j,a]
Thus the minimum value of f in this interval is f(a).
By definition of f, again there is f(b)=f(a) for some b.
for the interval [a,b], again f has some x in [a.b] such that f(x)≥f(a).
Considering the case x<b, we can easily prove that f takes 4 values for some points x in R. Hence a contradiction.

stevendaryl
Staff Emeritus
Let f(x)≥f(a) for x<a and x>b

But why can you assume that?

I'm not saying you're wrong, only that you're missing a step in the reasoning.

Here's the step that you're missing (or it seems that way to me): If you look at a graph of $f(x)$ versus $x$, and draw a horizontal line through the point $x=a, y=f(a)$, you know that the graph can only cross that line twice, at $x=a$ and $x=b$. That means that the graph never crosses the line in the region $x < a$. So that means either
1. $f(x) > f(a)$ throughout the whole region, or
2. $f(x) < f(a)$ throughout the whole region.
(You can reason similarly for the region $x > b$).

So you can do a case split between the two possibilities for $x < a$.

• Alpharup
Yeah, this broader intuition is more comprehendable.

Is the proof right?

stevendaryl
Staff Emeritus
Is the proof right?

I think that under your assumption that $f(x) < f(a)$ in the regions $x < a$ and $x > b$, your proof is correct, but you need to prove it without making that assumption.

So, is there any way of proving it?

stevendaryl
Staff Emeritus
So, is there any way of proving it?

You sort of have the right idea. But first you have to consider the possibilities outside the range $[a,b]$.

You can show that
1. either $f(x) < f(a)$, for all $x < a$, or $f(x) > f(a)$, for all $x < a$
2. either $f(x) < f(a)$, for all $x > b$, or $f(x) > f(a)$, for all $x > b$.
So there are 4 cases:
1. $f(x) < f(a)$ for all $x < a$, and $f(x) < f(a)$ for all $x > b$
2. $f(x) < f(a)$ for all $x < a$, and $f(x) > f(a)$ for all $x > b$
3. $f(x) > f(a)$ for all $x < a$, and $f(x) < f(a)$ for all $x > b$
4. $f(x) > f(a)$ for all $x < a$, and $f(x) > f(a)$ for all $x > b$
So you have to show that each of these leads to a contradiction. You have a proof of case 1, but you have 3 other cases.

• Alpharup
Now I get it. You want me to consider all the possible cases. Thank you.

PeroK
• 