Problem on functions I have this question:

Suppose the function $f : \mathbb R \to \mathbb R$ satisfies $$ |f(x) - f(y)| = \frac {|x-y|}{2}.$$ Prove that $f$ has an unique fixed point i.e. there exists a unique $x_0$ such that $f(x_0)=x_0$.

I found out the following: 
1. $f$ is continuous at every point. Because for any $y_0$, given any $\epsilon \gt 0$ choosing $\delta = 2\epsilon$, we have $|y-y_0| \lt \delta \implies \frac {|y-y_0|}{2}=|f(y)-f(y_0)|\lt \epsilon$.
2. $|\frac {f(x+h)-f(x)}{h}| = \frac {1}{2}$ for $h \neq 0$. Now, if $f$ is increasing or decreasing, then we conclude that $f^{(1)}(x)$ exists and is equal to $\frac {1}{2}$ and $-\frac {1}{2}$ according as $f$ is increasing or decreasing. So, $f(x)=\frac {x}{2} + c$ or $-\frac {x}{2} +c$ for some constant $c$. Therefore we have $f(2c) = 2c$ and $f(2c/3)=2c/3$ according as $f$ is increasing or decreasing, and these are unique.
 
Now I'm stuck up in solving the more general case when $f$ is neither increasing or decreasing. Any hint would be appreciated.
 A: Your function is $|f(x) - f(y)| =\frac{|x-y|}{2}$, the contracting mapping theorem says that if you have a complete metric space $(X,d)$ and a function $f:X\to X$ such that $d(f(x),f(y)) \le c d(x,y)$ where $0\le c<1$ then there exists a $unique$ fixed point $(i.e.$ a unique $z\in X$ such that $f(z)=z)$. Note: $c\neq 1%$ gives us uniqueness.
In your case,
$$d(f(x),f(y)) = |f(x) - f(y)| =\frac{|x-y|}{2} = \frac{1}{2}d(x,y)$$
So the inequality is equality in this case, with $c=\frac{1}{2}$, for a proof of the contracting mapping theorem see books on "Applicable Analysis" or this http://www.math.uconn.edu/~kconrad/blurbs/analysis/contraction.pdf or this http://en.wikipedia.org/wiki/Banach_fixed_point_theorem (it is also called Banach fixed point theorem).
Simple example (the idea), take $f(x)=x$, then in this case $|f(x)-f(y)| = |x-y|$, and clearly everything is a fixed point!  Now apply this idea with a different $c$ which in this case happens to be the slope.  If $f(x) = \frac{1}{2}x$ then $|f(x) - f(y)| = |\frac{1}{2} x - \frac{1}{2} y| = \frac{1}{2}|x-y|$ (as your question requested -- now this isn't the only such function that will do the trick, its just what came to mind).  Clearly the only fixed point is $x=0$ (a moments thought will tell you this).  
By the way, if you read "Banach's Original Proof" under wikipedia, it may take you a little while, but its readable for anyone who has taken elementary analysis.  Having visited your profile and seeing you are doing maths for fun (it seems this isn't for a class), I highly recommend you study the wikipedia proof, you will gain much from it.  Just need to know that a metric is a way to measure distance $d(x,y):=|x-y|$ in our case, and 'complete' metric space means that a sequence converges in your space (if that doesn't make sense.... just know it means, it does everything you would expect if you didn't think hard about it).
A: Hint: Consider $f(0)$ and $f(1)$, and then consider $f(x)$ as it relates to $f(0)$ and $f(1)$ for arbitrary $x$, and argue you have $f(x) = x/2 + c$ or $f(x) = -x/2 + c$ for some constant $c$. Then the unique fixed point will follow.
A: Tell me if I'm missing something here, but all that seems to be necessary is the following:
Uniqueness is established by proving that
$$
\forall x,y\in \mathbb{R} \left((f(x)=x \land f(y)=y) \implies x=y\right)
$$
So, suppose that $f(x)=x$ and $f(y)=y$ for some $x,y\in\mathbb{R}$, then
$$
|f(x)-f(y)|=|x-y|
$$
Now, substituting into the given identity gives
$$
|x-y| = \frac{|x-y|}{2} \implies |x-y|=0 \implies x=y\ \square
$$
