Contraction mapping does not hold in metric space Let $X=\mathbb{Q}\cap [1,2]$, i.e $X$ is the set of rational number between 1 and 2 inclusive.
We can consider $X$ to be a metric space by endowing it with the usual distance function, i.e for $x,y \in X$ we put $d(x,y)=|x-y|$. Now we define $f:X\rightarrow X$ by $f(x)=x-\dfrac{x^2-2}{2x}$.
Ones should check that if$x\in X$ , then $f(x)\in X$ as well. This means checking that if $x$ is rational and in $[1,2]$ then $f(x)$ is also rational and in $[1,2]$.
Prove that $f$ is a contraction mapping but $f$ does not has a fixed point. 
This is my homework exercise, but I am not good at mathematics, so please feel freely helping me. Thank you very much !
 A: Ok, first you can transform $f(x)$ into $f(x) = \frac{x^2+2}{2x}$ (by taking $x$ to the fraction and subtracting from $2x^2$ the value $x^2-2$). Then you can notice, that in the numerator and the denominator there are rational numbers, since you multiply and add rational numbers. So the whole fraction is rational.

Now: is it in $[1,2]$?
Assuming that $x \gt 0$ we have:
$\frac{x^2+2}{2x} \ge 1$ iff $x^2+2 \ge 2x$ iff $x^2 - 2x + 2 \ge 0$ iff $(x - 1)^2 + 1 \ge 0$ which is true for any $x$. 
Is it smaller than 2?
$\frac{x^2+2}{2x} \le 2$ iff $x^2 + 2 \le 4x$ 
Hint for that: analyse the maximum and minimum values of appropriate sides of the inequality.

Now you want to show that it is a contraction. It means that you want it to be Lipschitz, and the Lipschitz constant should be smaller than one. In these situations the easiest way is to use the Lagrange theorem. The derivative is a simple monotonous function (wolfram says: $1/2 - \frac{1}{x^2}$), so you can easily notice that its supremum (actually supremum of its modulus) is smaller than 1.
And finally a less calculus-like part of the task: Why is there no constant point?

If you look at f as a function from $[1,2]$ (without intersecting with rational numbers), then all the above calculations are still true. Let it be called $F$. $[1,2]$ is a complete metric space, so a contraction must have a constant point and it is unique. You can easily calculate that $F(x)=x$ holds for $x=\heartsuit$, so the only constant point of $F$ is $\heartsuit$. Since $\heartsuit$ is not a rational number we know that $f$ has no constant points.
A: Somewhere between a comment and an answer: the map $f$ is nothing else than the "amelioration function" $T(x) = x - \frac{f(x)}{f'(x)}$ one studies when applying Newton's method to search for roots of a differentiable function $f$: here the function is $f(x) = x^2-2$.
Aside from providing general orientation, this observation is directly helpful in at least one part of the problem: a glance at the above formula for $T$ shows that a real number $c$ is a fixed point for $T$ iff it is a root of $f$: $T(c) = c \iff f(c) = 0$.  Thus the fixed points of $T$ on all of $\mathbb{R}$ are $\pm \sqrt{2}$.  Since these are not rational numbers, we see that the given function (which I am calling $T$) has no fixed points on $\mathbb{Q} \cap [1,2]$.
I recently covered Newton's method in my "Spivak calculus" course: some notes on it are available here.  One point that I found interesting was that in the analysis of the convergence of Newton's method one uses contraction mappings but not the Contraction Mapping Principle.  This comes down to the point made above: in general, $T$ has a fixed point iff $f$ has a root.  Now of course just starting with a differentiable function $f$ it need not have any roots (e.g. if $f(x) = e^x$, $T(x) = x-1$).  But one can show that if $f$ has a simple root $c$, then there is an interval $[c-\delta,c+\delta]$ which is $T$-invariant and on which $T$ is a contraction mapping.  Then the rate of convergence to the known fixed point comes in handy, and for this we do not need completeness!
