Is the union of a closed interval and half closed interval compact? Is the subset
$$[0, 1]\cup (4, 5] $$
compact in $$(\mathbb{R},d)$$
 A: If your definition of compactness is "closed and bounded", and your definition of "closed" is that a set contains all its boundary points, than you can look at your example and examine the boundary points and ask yourself if they are in the set.
If your definition of "closed" is the complement of an open set, then take the complement of your set and see if it's open (i.e. by examining boundary points).
If your definition of compactness is "every open cover of the set can be made into a finite subcover", then consider the open cover:
$$(-0.5, 1.5) \cup \left(4+\frac 1k, 5.5\right) \text{ for } k=1,2,3,\ldots$$
Does any finite subfamily of this open cover manage to cover your set?
Note: For more information regarding these different definitions of compactness, google the Heine-Borel theorem.
A: The Heine–Borel theorem states: 
For a subset $S$ of the Euclidean space $\mathbb R^n$, the following two statements are equivalent:


*

*$S$ is closed and bounded.

*$S$ is compact, that is, every open cover of $S$ has a finite subcover.


For two distinct real numbers $a<b$, the interval $(a,b]$ is neither open nor closed in $\mathbb R$. The problem point for openness is $b$ since there's no open disc around $b$ which lies entirely in $(a,b]$. The problem point for closedness is $a$ since $a$ is a limit point of $(a,b]$, but is not an element of $(a,b]$.
Therefore, the set $S=[0, 1]\cup (4, 5] $ isn't closed. By Heine–Borel, $S$ is not compact.
A: The set $$[0, 1]\cup (4, 5]$$ is not compact simply bescause it is not closed.
A compact set in $(\mathbb{R},d)$ is closed and bounded.
You can find an open covering for the set which does not have any finite subcovering. For example consider $$ U_n = (-1/n,1+1/n)\cup (4+1/n,5+1/n), n\ge1$$ which cover the set but does not have any ffinite subcovering for the set.  
