$\lim_{x \to \infty} f(x)=1$ and $\lim_{x \to -\infty}f(x)=-1$ and the function is not uniformly continuous &quot; Does there exist a continuous function $f: \mathbb{R} \to \mathbb{R}$  so that  $\lim_{x \to \infty} f(x)=1$ and $\lim_{x \to -\infty}f(x)=-1$ and the function is not uniformly continuous on $\mathbb{R}$?&quot;
I wanted to prove that this is impossible because it implies that the function has a horizontal asymptote.
I tried to prove:
Take $\epsilon$&gt;0 randomly.
Because $\lim_{x \to \infty} f(x)=1$ there exist an $N\in \mathbb{R}$ so that $|f(x)-1|&lt;\epsilon/2$ for $x&gt;N$.
Because $\lim_{x \to -\infty} f(x)=-1$ there exist an $M\in \mathbb{R}$ so that $|f(x)+1|&lt;\epsilon/2$ for $x&lt;M$.
Because $f$ is continous in $\mathbb{R}$ we take $a \in \mathbb{R}$. There exist a $\delta&gt;0$ so that for $x \in \mathbb{R}$ , $|f(x)-f(a)|&lt;\epsilon$ for $|x-a|&lt;\delta$.
And this is were it gets hard. I thougt you can define a $\delta_{2}=\max\{N,M\}$.
Take $x,y$ random in $\mathbb{R}$ so that $|x-y|&lt;\delta_{2}$. Then $|f(x)-f(y)|=|f(x)-1+1-f(y)|=|f(x)-1|+|1-f(y)|&lt;\epsilon$
I don't know if I defined my $\delta_{2}$ correctly.
Can someone help me how to prove this correctly?
The function $\displaystyle\frac{x^{1/3}}{1+|x^{1/3}|}$ which has a vertical tangent line at the origin.

Ok, this one does not deserve credit, it is wrong, but will edit this to make it right... if possible
So let me make it right. There is no such function.
Proof. Take any $\varepsilon&gt;0.$ Take $M&gt;0$ such that
$|f(x)+1|&lt;\frac\varepsilon3$ if $x\le-M$, and such that
$|f(x)-1|&lt;\frac\varepsilon3$ if $x\ge M$.
Since $[-M,M]$ is compact (i.e., closed and bounded interval in this context), $f$ is uniformly continuous on this interval, and there is $\delta&gt;0$ such that for
$x,x'\in[-M,M]$ if $|x-x'|&lt;\delta$ then we have $|f(x)-f(x')|&lt;\frac\varepsilon3$.
Then for any $x,x'\in(-\infty,\infty)$ if $|x-x'|&lt;\delta$ we have
$|f(x)-f(x')|&lt;\varepsilon$, that is, $f$ must be uniformly continuous on $(-\infty,\infty)$.
The inequality $|f(x)-f(x')|&lt;\varepsilon$ is easy to verify considering cases... will not list them all, but one of the interesting ones (though they all are easy) is say $x\le M \le x'$ (and we may also assume that $\delta&lt;M$ for convenience and without loss of generality).
So assume $x\le M \le x'$ and $|x-x'|&lt;\delta$ (and hence $0&lt;x$).
Then $|f(x)-f(x')|\le$
$\le|f(x)-f(M)|+|f(M)-f(x')|\le$
$\le|f(x)-f(M)|+|f(M)-1|+|f(x')-1|&lt;$
$&lt;\frac\varepsilon3+\frac\varepsilon3+\frac\varepsilon3=\varepsilon$.
Thus $|f(x)-f(x')|&lt;\varepsilon$.
Now that I posted my answer and read more of the comments, I see that what @questmath put in a comment, starting with
&quot;$f$ is uniformly continuous on $[M,N]$...&quot;
already provides (a clear enough hint for) the answer. I realize I only provided the details of a similar answer (with my notation being a bit different than what OP was asking, but I will keep it this way).
For that matter I also missed the very first comment, by @Surb (just read it, and understood what it says), already voted up three times because it is right and has what is needed...
The function $\displaystyle\frac{x^{1/3}}{1+|x^{1/3}|}$ which has a vertical tangent line at the origin.

Ok, this one does not deserve credit, it is wrong, but will edit this to make it right... if possible
So let me make it right. There is no such function.
Proof. Take any $\varepsilon&gt;0.$ Take $M&gt;0$ such that
$|f(x)+1|&lt;\frac\varepsilon3$ if $x\le-M$, and such that
$|f(x)-1|&lt;\frac\varepsilon3$ if $x\ge M$.
Since $[-M,M]$ is compact (i.e., closed and bounded interval in this context), $f$ is uniformly continuous on this interval, and there is $\delta&gt;0$ such that for
$x,x'\in[-M,M]$ if $|x-x'|&lt;\delta$ then we have $|f(x)-f(x')|&lt;\frac\varepsilon3$.
Then for any $x,x'\in(-\infty,\infty)$ if $|x-x'|&lt;\delta$ we have
$|f(x)-f(x')|&lt;\varepsilon$, that is, $f$ must be uniformly continuous on $(-\infty,\infty)$.
The inequality $|f(x)-f(x')|&lt;\varepsilon$ is easy to verify considering cases... will not list them all, but one of the interesting ones (though they all are easy) is say $x\le M \le x'$ (and we may also assume that $\delta&lt;M$ for convenience and without loss of generality).
So assume $x\le M \le x'$ and $|x-x'|&lt;\delta$ (and hence $0&lt;x$).
Then $|f(x)-f(x')|\le$
$\le|f(x)-f(M)|+|f(M)-f(x')|\le$
$\le|f(x)-f(M)|+|f(M)-1|+|f(x')-1|&lt;$
$&lt;\frac\varepsilon3+\frac\varepsilon3+\frac\varepsilon3=\varepsilon$.
Thus $|f(x)-f(x')|&lt;\varepsilon$.
Now that I posted my answer and read more of the comments, I see that what @questmath put in a comment, starting with
&quot;$f$ is uniformly continuous on $[M,N]$...&quot;
already provides (a clear enough hint for) the answer. I realize I only provided the details of a similar answer (with my notation being a bit different than what OP was asking, but I will keep it this way).
For that matter I also missed the very first comment, by @Surb (just read it, and understood what it says), already voted up three times because it is right and has what is needed...