TITLE: 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)$
QUESTION [9 upvotes]: 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!

REPLY [7 votes]: 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\ .$$