Understanding the idea that borel sigma algebra of subsets of $R$ is contained in the sigms algebra generated by all compact sets. The answer is given here in this link is the smallest $\sigma$-algebra containing all compact sets the Borel $\sigma$-algebra but I do not understand it, could anyone explain it for me please?
 A: If $C$ is closed than $K_n=\{x\in C: |x| \leq n\}$ is a closed subset of the compact set $\{x: |x| \leq n\}$. Hence it is compact and it belongs to the sigma algebra generated by compact sets. Taking union over all $n$ we see that $C$ belongs to the sigma algebra generated by compact sets.  Taking complements we see that every open set belongs to this sigma algebra. Finally  any sigma algebra which contains all open sets contains the Borel sigma algebra. 
A: Since closed sets are the complements of open sets and vice versa the Borel $\sigma$-algebra can also be defined as the $\sigma$-algebra generated by all closed sets. 
In your context (real-analysis) compact sets are closed so the $\sigma$-algebra generated by all compact sets is contained in the Borel $\sigma$-algebra.
Also in your context every closed sets can be written as a countable union of compact sets so the Borel $\sigma$-algebra is contained in the $\sigma$-algebra generated by all compact sets.

For completeness:
Observe that for any set $F\subseteq\mathbb R^n$ we have: $$F=\bigcup_{n=1}^{\infty}\left(F\cap K_n\right)$$ where $K_n:=\{x\in\mathbb R^n\mid||x||\leq n\}$ and $F\cap K_n$ is a bounded closed set if $F$ is a closed set. 
Bounded closed subsets of $\mathbb R^n$ are compact.
