A function $d: \mathbb{R}\times\mathbb{R}\to\mathbb{R}$ is a metric on $\mathbb{R}$ iff all of the following holds:
$d(x,y)\geq0 \;\forall x,y $
$d(x,y)=0 \iff x=y$
$d(x,y)=d(y,x)$
Triangle inequaliy
The exercise asks us to give one example of function that satisfies all of the conditions above but one (for each condition).
I was successfull on 2.: $d(x,y)=\vert x-y\vert +1$ do satisfies 1,3,4 but not 2., right?
On the others I got stuck, I tried floor and ceil things, sums, multiplications... nothing did work.
Could you help me? (I'm sorry if it is duplicated, I couldn't find something like this)
Edit: I could do 4. too, but it isn't a "beautiful" example I think: $d(x,y)=\begin{cases}\vert x-y\vert-5, \mbox{ if }\vert x-y\vert >5 \\\vert x-y\vert, \mbox{ otherwise}\end{cases}$, then we have $d(1,15)>d(1,7)+d(7,15)$ for example.
After all the comments here, which I thank all you for, I can summarize an answer for my question.
First case: After all, properties 2,3,4 implies 1. In fact,: $0 = d(x,x)\leq d(x,y)+d(y,x)=2d(x,y)$ hence $d(x,y)\geq 0 \; \forall x,y$. Thus it is impossible to give na example of function that satisfy 2-4 but not 1.
Second case: $d(x,y)=1 \; \forall x,y$ will do.
Third case: $ d(x,y)=\begin{cases}x-y, \mbox{ if x}\geq y\\1, \mbox{ otherwise } \end{cases}$ is enough.
Fourth case: $d(x,y)=\vert x-y\vert ^2$