Show that a compact set of real numbers contains its greatest lower bound and its least upper bound. Show that a compact set of real numbers contains its greatest lower bound and its least upper bound. Can this occur for a set of real numbers that is not compact?
My attempt:
By Hein-borel theorem, compact set is closed and bounded, hence glb and lub exists in the set.
Am I correct?
Is  it true for non compact subset?

You are right to conclude from Heine-Borel that a compact set is closed and bounded. Since the set is bounded it has a greatest lower bound and a least upper bound. But you need to prove why they are contained in the compact set. You need that the set is closed, but it isn't sufficient to say "because the set is closed".
Here I improved the argument:
Let be $K$ a compact subset of $\mathbb R$. Heine-Borel yields that $K$ is bounded hence it has a greatest lower bound $R$ and a least upper bound $r$.
Since $R$ is the least upper bound, there exists a sequence $(x_n)_n\subset K$ such that $x_n\to R$. Since $K$ is closed by Heine-Borel we conclude $R\in K$. Analogous we get $r\in K$.
