$$ \lim_{x \to \infty} \dfrac{\cos x}{x} $$
Apparently this is $0$ by the squeeze theorem, because $-\dfrac{1}{x} \leq \dfrac{\cos x}{x} \leq \dfrac{1}{x}$ for all $x>0$
I understand the squeeze theorem intuitively, but I don't understand where these 2 functions come from. How do you know that the above inequality holds? Are you supposed to figure that out by yourself?
Similarly, for $ \lim_{x \to 0} x\sin(\dfrac{1}{x}) $ is $0$ by the squeeze theorem because $ -|x| \leq x\sin(\dfrac{1}{x}) \leq |x| $ for all $x \neq 0$. Where do these functions come from? Is there any systematic way to choose them?