every open set can be expressed as a countable union of compact sets I'm studying Sard's theorem and I want to know why is true that every open set can be expressed as a countable union of compact sets.
Thank you!
 A: Let $\Omega$ be an open set and $\partial \Omega$ denote its boundary. Set
$K_{n} = \{x \in \Omega: \text{dist}(x, \partial \Omega) \geq \frac{1}{n}\} \cap \overline{B(0,n)}$, where dist is the distance of the point $x$ from the boundary. Each $K_{n}$ is closed and bounded and therefore compact and clearly $\cup_{n = 1}^{\infty} K_{n} = \Omega$. 
A: Let $A$ be an open subce of $\mathbb{R}^n$. For each $m\in\mathbb N$, let$$K_m=\left\{x\in A\,\middle|\,d\left(x,A^\complement\right)\geqslant\frac1m\wedge\|x\|\leqslant m\right\}.$$Then each $K_m$ is compact and$$A=\bigcup_{m=1}^\infty K_m.$$
A: @harmonicuser has a nice explicit construction for $\mathbb{R}^n$. But as you use the tag general topology:
In fact the statement holds in all hereditarily Lindelöf locally compact Hausdorff spaces $X$ (of which the Euclidean spaces are a prominent example): if $O\subseteq X$ is open, by local compactness plus Hausdorffness we find for each $x \in O$ an open subset $U_x$ with $\overline{U_x}$ compact and $\overline{U_x} \subseteq O$. As $O$ is Lindelöf we reduce the open cover $\{U_x: x \in O\}$of $O$  to a countable subcover $\{U_x: x \in N\}$ of $O$ (where $N \subseteq O$ is countable). Then $O = \cup_{x \in N} \overline{U_x}$ shows that $O$ is $\sigma$-compact.
If $X$ is a space then every $O$ being $\sigma$-compact implies that $X$ is hereditarily Lindelöf (so that condition is necessary) but not necessarly that $X$ is locally compact (as witnessed by $\mathbb{Q}$).
