# Real Analysis: Prove this function must change sign around some point

I am trying to prove the following question:

Suppose $$f : \mathbb{R} → \mathbb{R}$$ satisfies $$\lim_{x \to \infty} f(x) = \infty$$ and $$\lim_{x \to -\infty} f(x) = -\infty$$. Prove that there exists a number $$\beta$$ such that for all $$\epsilon > 0$$ there exists an $$r \in (0, \epsilon)$$ such that $$f(\beta − r) \leq 0 ≤ f(β + r)$$.

What I have right now:

If the function $$f$$ is continuous, then it is easy by using IVT. If $$f$$ is not continuous, I was thinking about setting $$\beta = \sup\{x: f(x) \leq 0\}.$$

But this does not seem to work since if $$f(x) = x, \ x \in (-\infty, 1) \cup (1, \infty)$$ and $$f(1) = -1,$$ then $$\beta = 1$$ and there is a neighborhood of $$\beta$$ where the required condition is not satisfied.

Can anybody think of another route? Thanks a lot!

Let $$X = \{x : \exists b > a > x: \forall y \in (a; b): f(x) \leqslant 0\}$$ - points that have an entire interval of non-positive values of $$f$$ in right of them. Let $$\beta = \sup X$$. Note that $$\beta \notin X$$ (otherwise we would also have $$\frac{\beta + a}{2} \in X$$ with corresponding $$a$$).
Let us take some $$\varepsilon$$. Take $$x \in (\beta - \varepsilon; \beta) \cap X$$ and then $$b > a > x$$ such that $$f$$ is non-positive on $$(a; b)$$. We have $$b < \beta$$, otherwise $$\frac{\beta + b}{2}$$ would be in $$X$$.
Now, as $$\beta \notin X$$, there is some $$y \in (2\beta - b; 2\beta - a)$$ [segment symmetric to $$(a; b)$$ with $$\beta$$ as center of symmetry] such that $$f(y) > 0$$. Then take $$r = y - \beta$$, and we have $$\beta - r \in (a, b)$$, $$\beta + r = y$$, so $$f(\beta - r) \leqslant 0$$ and $$f(\beta + r) > 0$$.