# What would $ab$ be when $f(x)$ has a limit at $+\infty$

Reviewing Calculus, I am facing the problem:

if

$$f(x)= \begin{cases} \sqrt{x^2-8x^3}+ax+b,& \text{if } x\in\mathbb Q\\\\x\sin\big(\frac{1}{x}\big),& x\in \mathbb R-\mathbb Q \end{cases}$$ has a limit at $+\infty$, what would $ab$ be?

I doubted if I could treat this function as other piecewise function with some known domains (like $-7<x \leq 3$) or not? When I referred to the answer, it gave me another approach which admitted my guess and is my question.

Let the functions $f_1(x)$ and $f_2(x)$ have limits on $\mathbb R$ when $x\to +\infty$ so the function:

$$f(x)= \begin{cases} f_1(x),& x\in\mathbb Q\\\\f_2(x),& x\in \mathbb R-\mathbb Q \end{cases}$$ has limit at $+\infty$ if $\lim_{x\to +\infty}f_1(x)=\lim_{x\to +\infty}f_2(x)$

May I ask someone explain this hint? Thanks.

$$\lim_{x\to\infty} x\sin \frac 1x = \lim_{x\to\infty} \frac{\sin \frac1x}{\frac 1x} = \lim_{t\to 0^+} \frac{\sin t}t = 1. \tag{1}$$
So for $\lim_{x\to \infty} f(x)$ to exist we must have that
$$\lim_{x\to\infty} \sqrt{-8x^3+x^2} + ax + b = 1. \tag{2}$$
You'll see that you'll have to pick $a$ such that the limit in $(2)$ even exists and $b$ such that it has the right value. Think about what happens if the limit in $(2)$ exists but doesn't equal $1$. Can you see why $\lim_{x\to\infty}f(x)$ doesn't exist then?