Prove that $\forall d > 0$ there exists $x_1, x_2 \in \mathbb{R}$ such that $x_1 - x_2 = d$ and $f(x_1) = f(x_2)$ Let $f : \mathbb{R} \rightarrow \mathbb{R}$ be a continuous function with the property that $\lim_{x \rightarrow \infty} f(x)$ and $\lim_{x \rightarrow -\infty} f(x)$ exist and are equal. Prove that $\forall d > 0$ there exists $x_1, x_2 \in \mathbb{R}$ such that $x_1 - x_2 = d$ and $f(x_1) = f(x_2)$.
I applied Rolle's theorem on $\mathbb{R}$ since $\lim_{x \rightarrow \infty} f(x)= \lim_{x \rightarrow -\infty} f(x)$. So, there exists $c \in \mathbb{R}$ such that $f'(c) = 0$. This means that our function has a minimum or a maximum. Now, since the limits at $\infty$ and $-\infty$ are equal we can conclude that $\forall d > 0$ there exists $x_1, x_2 \in \mathbb{R}$ such that $x_1 - x_2 = d$ and $f(x_1) = f(x_2)$.
Is this a correct solution? If not, please help me find a good one.
Thank you!
 A: Since $f$ is not assumed differentiable you cannot use Rolle's theorem; but the IVT is available, and does the job.
After substracting a suitable constant from $f$ (which is irrelevant for the problem at hand) we may assume that $\lim_{x\to-\infty}f(x)= \lim_{x\to\infty}f(x)=0$, and that there is an $a\in{\mathbb R}$ with $f(a)>0$. Using a standard argument we then can infer that there is a $\xi\in{\mathbb R}$ with $$f(x)\leq f(\xi)\qquad(-\infty<x<\infty)\ .$$
Given a $d>0$ put $g(x):=f(x)-f(x+d)$. Then
$$g(\xi-d)=f(\xi-d)-f(\xi)\leq0,\qquad g(\xi)=f(\xi)-f(\xi+d)\geq0\ .$$
As $g$ is continuous it follows that there is a point $x_1\in[\xi-d,\xi]$ with $g(x_1)=0$. Put $x_1+d=:x_2$; then $|x_2-x_1|=d$ and
$$f(x_1)-f(x_2)=f(x_1)-f(x_1+d)=g(x_1)=0\ .$$
A: Fix $d>0$ and put $g(x) = f(x+d)-f(x)$. If for all $x \in \Bbb R$, $g(x) \neq 0$, then $g(\Bbb R) \subset (-\infty,0)\cup(0,\infty)$. 
Let $A=g^{-1}((-\infty,0))$ and $B=g^{-1}((0,\infty))$. Assume that neither is empty. Note that $A\cup B = \Bbb R$, and $A$ and $B$ are both open (by continuity of $g$) and that they are disjoint. This contradicts the connectedness of $\Bbb R$. Therefore $A=\emptyset$ or $B = \emptyset$, i.e. $g(x) < 0$ for all $x\in \Bbb R$ or $g(x) > 0$ for all $x\in \Bbb R$.
Now assume $g(x)>0$ for all $x$, then $f(x+d)>f(x)>f(x-d)$ for all $x$. Then, for any fixed $x$,


*

*$f(x)>f(x-d)>f((x-d)-d) = f(x-2d)>\cdots > f(x-nd)$, for all $n \in \Bbb N$


and


*

*$f(x)<f(x+d)<f((x+d)+d) = f(x+2d) < \cdots < f(x+nd)$ for all $n \in \Bbb N$


i.e. $f(x+nd)>f(x)>f(x-nd)$ for all $n \in\Bbb N$. Taking $n\to \infty$, we get by continuity that $f(x) = L$. Since $x$ was arbitrary, we get $f(x) = L$ for all $x$. So $g(x) = 0$ for all $x$, contradiction. 
Similarly, if $g(x)<0$ for all $x$, we get a contradiction. 
We conclude that there exists $x_0$ such that $g(x_0)=0$, i.e. $f(x_0+d) = f(x_0)$, as desired.
Added later on
Looking at it now, there is no need for all of that juggling to prove that $g(x) > 0$ for all $x$ or $g(x) < 0$ for all $x$. Just argue that if at some two points $g(x_1)\le 0$ and $g(x_2)\ge 0$, then by IVT $g(x_0)=0$ somewhere.
A: Since you can't use Rolle's theorem because your function is not continuous, maybe we can try something else. The idea is this: you take a point $x_0$ and calculate $x_0+d$. Now you are certain that the two points are at the right distance from each other. 
Then calculate $f(x_0)$ and $f(x_0+d)$. Then define $g(x)=f(x)-f(x+d)$. If this function is zero, we are done. We have found our points $x_1$ and $x_2$.
So, start out with one point $x_0$ and calculate $g(x_0)$. It will either be positive or negative, say without loss of generality that it's positive. We have 
\begin{equation}
0<g(x_0)=f(x_0)-f(x_0+d).
\end{equation}
Now, we know that at some other point we must have
\begin{equation}
0>g(x_{3})=f(x_{3})-f(x_{3}+d),
\end{equation}
otherwise we would have a monotonically decreasing sequence and then the limits at infinity can not be the same.
You know that g(x) is a continuous function, so you can apply the Intermediate Value Theorem, which is true for all continuous functions on a bounded interval.
The IVT gives you a point $x_1$ at which $g(x_1)=f(x_1)-f(x_1+d)=0$. This gives you your $x_1$ and $x_2$. 
