Weierstrass Approximation Theorem for continuous functions on open interval

I am studying for my introductory real analysis final exam, and here is a problem I am somewhat stuck on. It is Question 2, in page 3 of the following past exam (no answer key unfortunately!):

http://www.math.ubc.ca/Ugrad/pastExams/Math_321_April_2006.pdf

Give an example of each of the following, together with a brief
explanation of your example. If an example does not exist, explain why
not.

(c) A continuous function $f : (−1,1) → \mathbb{R}$ that cannot be uniformly approximated by a polynomial.

By Weierstrass Approximation Theorem, every continuous real-valued function on closed interval can be uniformly approximated by a sequence of polynomials. Since in this question the domain of the function is an open interval $(-1, 1)$, I have a feeling that such example must exist.

My attempts: The proof of Weierstrass approximation theory uses the fact that a continuous function a compact set (a closed interval by Heine-Borel Theorem) achieves a maximum, so we can guess that the example we are looking after will not achieve a maximum on $(-1, 1)$. Such example of continuous function is
$$ f(x)=\frac{1}{x+1} $$
So now my question: is it true $f$ cannot be uniformly approximated by a sequence of polynomials? And if so, how do proceed to prove such a statement?

Thanks!

Solutions Collecting From Web of "Weierstrass Approximation Theorem for continuous functions on open interval"

Your feeling seems to be right. 😀 Hint: each polynomial should be bounded on $(0,1)$.

Based on Alex Ravsky’s hint, I have found the solution. I will type it up for the sake of reference.

We claim that the function
$$ f(x)=\frac{1}{x+1} $$
is a continuous function on $(-1, 1)$ that cannot be approximated by a polynomial. Assume not. Then, for $\epsilon=1$ in the definition of uniform convergence, there exists a polynomial $p(x)$ such that
$$
|f(x)-p(x)|\le 1
$$
for $all$ $x\in (-1, 1)$. Since the polynomial $p(x)$ is bounded on $(-1, 1)$, it follows that, there exists a constant $M$ such that $|p(x)|\le M$ for all $x\in (-1, 1)$. But then,
$$
|f(x)|\le |p(x)| + |f(x)-p(x)| \le M+1
$$
for all $x\in (-1,1)$ which contradicts the fact that $f(x)$ is unbounded on $(-1, 1)$.