The points belong to the indicated subset for every positive integer . They form an unbounded sequence, so this metric space is not bounded. Therefore it is not compact. Shrinking the vertical width does not bound its horizontal extent.
By the Heine-Borel theorem, a noncompact subset is either unbounded or not closed. If is unbounded, the restriction is a continuous function with unbounded range.
Otherwise is bounded and not closed. Choose , and define
Its denominator is nonzero on , so it is continuous. Since is in the closure, for every there is with . Hence , proving that this continuous function is unbounded. These two cases establish unbounded continuous witnesses to noncompactness of a real subspace.
We can arrange that neither the supremum nor the infimum is attained. By part (d), choose a continuous function on with unbounded range, and put . Choose so that increases strictly to infinity. Construct a continuous function with
keep it constant up to and interpolate linearly on each . Since , the joining points have no finite accumulation, so this defines a continuous function everywhere on its domain.
Now set
By function composition, is continuous, and for every . Along the even and odd chosen points,
Thus and , and neither is a value of . This proves the bounded continuous witness with neither extremum attained construction, including for subsets that are bounded but not closed.
If is not compact, there is an unbounded continuous function . By the Heine-Borel theorem, either is unbounded, when works, or it is not closed. In the latter case choose ; the continuous function is unbounded because points of approach the missing limit point . This proof uses the specific compactness characterization of real subspaces; boundedness of a general metric space does not imply compactness.