# Horizontal asymptotes of function defined as an inequation

I was given as a homework:

Suppose $f$ is a function of $x$ and, $\forall x\in \mathbb{R}$, it holds $$\left| f(x)-\frac{1}{x}\right| \le \frac{2x^2+x|x|+2}{x^2+1}$$ Find the horizontal asymptotes of $f(x)$.

I tried to use the Squeeze Theorem, rewritting the expression as: $$-\frac{2x^2+x|x|+2}{x^2+1} \le f(x)-\frac{1}{x} \le \frac{2x^2+x|x|+2}{x^2+1}$$ Which, rearranging, gives $$\frac{-2x^3-x^2|x|-2x+x^2+1}{x^3+x} \le f(x) \le \frac{2x^3+x^2|x|+2x+x^2+1}{x^3+x}\\ g(x) \le f(x) \le h(x)$$

The limits, however, are not equal: $$\lim_{x\rightarrow\infty}g(x)=-3\\ \lim_{x\rightarrow\infty}h(x)=3\\ \lim_{x\rightarrow-\infty}g(x)=-1\\ \lim_{x\rightarrow-\infty}h(x)=1\\$$

And I can't use the Squeeze Theorem to find the horizontal asymptotes. Any hints on how to solve it?

There will be no hints on how to solve it because the condition you gave is not enough to completely determine horizontal asymptotes. For $x < 0$, the bounding expression becomes $$\frac{2x^2+x|x|+2}{x^2+1} = \frac {x^2 + 2}{x^2+1} = 1 + \frac 1{x^2+1}$$ which converges to $1$ as $x \to -\infty$, while for $x > 0$, it becomes $$\frac{2x^2+x|x|+2}{x^2+1} = \frac {3x^2 + 2}{x^2+1} = 3 - \frac 1{x^2+1}$$ which converges to $3$ as $x \to \infty$. Thus choosing $f(x) = \frac1x + a$ will satisfy the inequality for sufficiently large values of $|x|$ for any $a$ with $|a| \le 1$.
Thus we can find functions $f(x)$ satisfying the condition and having any horizontal asymptote between $-1$ and $1$. Further, there is no reason a function cannot have different horizontal asymptotes to the left and to the right. For example, $\tan^{-1}x$ has a left asymptote of $-\frac \pi 2$ and a right asymptote of $\frac \pi 2$. Your condition requires the left asymptote $f(x)$ to be between $-1$ and $1$, but the right asymptote can be anywhere between $-3$ and $3$.
But that is assuming that the asymptotes exist at all. Your condition is not sufficient to require even that: $f(x) = \frac 1x + a\sin x$ satisfies the inequality for large $x$, but has no horizontal asymptotes.
(I haven't bothered to determine if these functions satisfy the inequality everywhere because it doesn't matter - if it doesn't, we can replace $a$ with a function having $a$ as horizontal asymptote, and dropping to $0$ anywhere necessary to satisfy the inequality.)