I came across this exercise Exercise 1.75 Manifolds and Differential Geometry by Jeffrey M. Lee which states:
Let M be a smooth manifold. Let K be a closed subset of M and O an open subset containing K. Show that there exists a smooth function $\beta$ on M that is identically equal to 1 on K, takes values in the interval [0,1], and has compact support in O.
How can this be true? Set $M = \mathbb{R}$ and $K = \mathbb{Z}$ and let O be the union of small balls, one around each integer and none overlapping. How can the support of $\beta$ be compact then? It cant possibly be bounded since it contains $\mathbb{Z}$.