Locally compactness

I want to show that subspace of $$\mathbb R$$ is locally compact.

Let $$W$$ be subspace of $$\mathbb R$$. Let $$x\in W$$ and $$y\in \mathbb R \setminus W$$. Since $$\mathbb R$$ is Hausdorff space, there exists disjoint open sets $$U$$ and $$V$$ such that $$x\in U$$ and $$y\in V$$ for $$x\in W$$, $$y\in \mathbb R \setminus W$$. Then, $$U\subseteq X \setminus V$$ and $$X\setminus V$$ is closed in $$\mathbb R$$, so the closure of $$U$$ is contained in $$X \setminus V$$. Since the closure of $$U$$ is bounded and closed in $$\mathbb R$$, the closure is compact. Hence, there exists open set containing $$x$$ such that compact subset is contained in the open set. That means $$W$$ is locally compact.

Please let me know whether it's right or not.

• You have to produce a neighborhood of $x$ in the subspace topology of $W$ whose closure in $W$ is compact. Your argument does not involve the relative topology on $W$ so it is not correct. – Kabo Murphy Dec 3 '18 at 8:13

It is well known (and not hard to prove) that $$\mathbb Q$$ is not locally compact. See my comment about the mistakes in your argument.