Baby Rudin Problem 2.16 Regard $Q$, the set of all rational numbers, as a metric space, with $d(p,q) = |p-q|$. Let $E$ be the set of all $p\in Q $ such that $2<p^2<3$. Show that $E$ is closed and bounded in $Q$, but $E$ is not compact. Is $E$ open in $Q$?
To show $E$ is closed I thought I would should that $E^c$ is open.
We will look at three regions. 
1) Let $A$ be the set of all $p\in Q $ such that $p<-\sqrt{3}$
2) Let $B$ be the set of all $p\in Q $ such that $-\sqrt{2}<p<\sqrt{2}$
3) Let $C$ be the set of all $p\in Q $ such that $p>\sqrt{3}$
Let $a \in A$, pick a neighborhood $N_r(a)$ such that $r<|a+\sqrt{3}|$ then surely
$N_r(a)\subset A$, hence A is open. A similar argument follows for (2) and (3)
and by the theorem, the union of open sets is open, $E^c$ is open. Hence $E$ is closed.
Clearly $E$ is bounded do to the strict inequalities.
To show $E$ is not compact I will provide one infinite open cover of $E$.
Let $G_a$ be an open cover of $E$. Place each rational number in a segment with irrational endpoints less than the surrounding rational numbers. Because the rational numbers obey the archimedean axiom this will go on forever and hence a infinite open cover exists. 
Using the same argument to show $E^c$ is open we can show $E$ is open.
I know my argument is not very rigorous, I'm still learning how to write a solid proof, but am I on the right track?     
 A: Define $f: \mathbb{Q} \to \mathbb{R}$ by $f(x) = x^2$. Since $E = \{p : 2 < p^2 < 3 \} = f^{-1}[2,3]$ and $f$ is continuous, it follows that $E$ is closed. Also since $E = f^{-1}(2,3)$, it is also open. The infinite open cover $f^{-1}\left(2+\frac{1}{n}, 3-\frac{1}{n}\right)$, $n = 1, 2,\ldots $ does not have a finite subcover and it follows that $E$ is not compact.
A: You are on the right track.  Since you are still learning how to write proofs, I'll give you a little criticism:
(1)  While the method to show that $B$ is open will be similar to that you sued to show $A$ is open, you will have to pay a little more attention to which endpoint is nearer, so you may want to do that case separately.
(2)  When you go to show that $E$ is not compact, don't say "Let $G_a$ be an open cover of $E$". You need to construct the open cover with no finite subcover. So start by defining a bunch of open sets $U_\alpha$, show that $G=\{U_\alpha\}$ is an open cover for $E$, and show that no finite subset of $G$ covers $E$. 
(3)  When you go to show that $E$ is open, show some work.  Don't just say that using the same argument works.  
Lastly, while you are still learning how to write proofs, you will want to write them as rigorously as possible.  Only once you know that you can fill in the gaps, can you leave gaps to be filled.  
