Why is this statement about uniform convergence to $\cos x$ false?

There is a sequence of polynomials $$P_n(x)$$ which converge uniformly to $$f(x)=\cos x$$ on $$\mathbb{R}$$.

Given $$\cos x\in C[a,\ b]$$ and $$\epsilon>0$$, by the Weierstrass Approximation theorem, there is a polynomial $$p$$ such that $$\|\cos x-p\|_\infty<\epsilon$$. So, there is a sequence of polynomials $$P_n(x)$$ which converge uniformly to $$f(x)=\cos x$$ on $$[a,\ b]$$. I don't know why $$[a,\ b]$$ cannot be enlarged into $$\mathbb{R}$$.

• Below provide a lengthier explanation. However, the gist is that any polynomial that is nonconstant is not bounded and $\cos$ cannot be approximated by constant polynomials. – Will M. Nov 24 '18 at 19:16

It can't be extended to all of $$\mathbb R$$ because $$\cos(x)$$ is bounded whereas nonconstant polynomials are never bounded. As you increase the size of the interval, the same polynomials will no longer work for the larger interval because eventually the difference will exceed $$\epsilon$$.