TITLE: proving uniformly continuous with a given continuous function
QUESTION [0 upvotes]: Define $f:\mathbb{R} \to \mathbb{R}$ as continuous where $\lim_{p \to +\infty}f(p) = \ell_1$ and $lim_{p \to -\infty}f(p) = \ell_2$ such that $\ell_1, \ell_2 \in \mathbb{R}$, I want to show that $f$ is uniformly continuous. 
What I know:

I know that since $\lim_{p \to +\infty}f(p) = \ell_1$ then for any $\epsilon > 0$  there is some $N$ such that for all $x > N$, $|f(p) - \ell_1| < \epsilon$. 
Also as $\lim_{p \to -\infty}f(p) = \ell_2$ then for any $\epsilon > 0$  there is some $M$ such that for all $x < M$, $|f(p) - \ell_2| < \epsilon$. 

My concern is trying to tie this to uniformly continuous. I'm given that the definition of uniformly continuous is that for all $\epsilon > 0$ there exists some $\delta > 0$ such that $d(f(p),f(q)) < \epsilon$ for all $p,q$ in some metric space where $d(p,q) < \delta$ is satisfied. How can I get to a definition like this with what I am given?

REPLY [1 votes]: There are integers $n$ and $-n$ such that 
$\tag1x\ge n\Rightarrow |f(x)-l_1|<\epsilon/3$ and $\tag2x\le -n\Rightarrow |f(x)-l_2|<\epsilon/3.$ 
As $f$ is uniformly continuous on the compact set $[-n,n]$ there is a $\delta >0$ such that 
$\tag3|x-y|<\delta \Rightarrow |f(x)-f(y)|<\epsilon/3$ whenever $x,y\in [-n,n].$
Now suppose $|x-y|<\delta.\ $ We consider cases:
If $x,y\in [-n,n]$ then the result follows by $(3).$ 
If $x,y>n$ then the result follows by $(1)$ because then $|f(x)-f(y)|\le |f(x)-l_1|+|l_1-f(y)|<2\epsilon/3$
A similar calculation shows that if $x,y<-n,$ the result is true by $(2)$. 
If $x\in [-n,n]$ and $y>n$ then the distance between $x$ and $n$ is less than $\delta$ and $y\ge n$ so we have $|f(x)-f(y)|\le |f(x)-f(n)|+|f(n)-f(y)|\le |f(x)-f(n)|+|f(n)-l_1|+|f(y)-l_1|<\epsilon.$
The remaining case is handled similarly.
{"set_name": "stack_exchange", "score": 0, "question_id": 2199189}