Confusion on Baby Rudin problem 2.16 I am having a difficult time proving problem 2.16 (specifically that $E$ is closed) in Rudin's Principles of Mathematical Analysis.
I realize that this question has been asked before here, but I believe my question is different enough to warrant a new question.
The problem asks:
Regard $\mathbb{Q}$, the set of all rational numbers, as a metric space with $d(p,q) = \vert{p-q}\vert$.  Let $E$ be the set of all $p \in \mathbb{Q}$ such that $2<p^2<3$.  Show that $E$ is closed and bounded in $\mathbb{Q}$, but that $E$ is not compact.  Is $E$ open?
My attempt:
By definition $E$ is closed if every limit point of $E$ is an element of $E$.
Thus, we want to show that if a point $p$ is a limit point of $E$, $p \in E$, that is $2<p^2<3$.
To do this, let $p$ be a limit point of $E$.   
We then know that
$$\forall r> 0, \exists q :d(p,q) < r$$
In other words
$$ \forall r> 0, \exists q : q-r < p < q + r$$
Now squaring the inequality gives
$$ q^2-2qr + r^2 < p^2 < q^2 + 2qr + r^2 $$
Thus I would like to find an $r$ such that $2<p^2<3$ as desired.  Unfortunately I am having a hard time constructing such an $r$.  Can anyone point me in the right direction?
Moreover, I've seen similar problem to this one, in which the set $E$ is proven to be closed by showing that the complement of $E$ is open.  Is this usually the easier route to take?  In this case it would seem to require more work.  
I just have a hard time understanding where solvers obtain their $r$ values from, they seem to come out of thin air...
 A: Let's show that $E$ is closed. To achieve this result, I'll show that $E^C=\left\{q\in\Bbb Q | q^2\lt2 \lor q^2\gt3 \right\}=\left\{q\in\Bbb Q | -\sqrt2\lt q\lt\sqrt2\lor q\lt -\sqrt3\lor q\gt\sqrt3\right\}$ is open.


*

*If $q\lt-\sqrt3$, then, once defined $r:=\frac {|q+\sqrt3|}2$, we have that $\forall y\in B_r(q)\implies y\lt-\sqrt3$ because $d(y,q)\lt\frac{|q+\sqrt3|}2\lt |q+\sqrt3|=d(q,-\sqrt3)$, i.e. $B_r(q)\subset (-\infty,-\sqrt3)$.

*If $-\sqrt2\lt q\lt\sqrt2$, then, once defined $r:=\min\left\{d(q,-\sqrt2),d(q,\sqrt2)\right\}$, we have that $\forall y\in B_r(q)\implies y\in(-\sqrt2,\sqrt2)$ because $d(y,q)\lt \min\left\{d(q,-\sqrt2),d(q,\sqrt2)\right\}\le d(q,-\sqrt2),d(q,\sqrt2)$, i.e. $B_r(q)\subset(-\sqrt2,\sqrt2)$.

*If $q\gt\sqrt3$ we have the same argument as the first case.


So $E^C$ is open, thus $E$ is closed.
Let's show that $E$ is bounded. This comes trivially from the definition of $E$. Otherwise suppose that $E$ is not bounded. Then there must me a sequence $\left\{p_n\right\}_{n\in\Bbb N}\subset E$ such that $\lim_{n\to\infty}p_n=\infty$. But $\forall n\in\Bbb N$ we have $1\lt\sqrt2\lt |p_n|\lt\sqrt3\lt\infty$ because $p_n\in E$, thus $E$ is bounded.
Let's show that $E$ is not compact. To do this I'll find an infinite open cover of $E$ which doesn't have a finite subcover.
In fact, if we define $A_n := \left(-\sqrt3+\frac1n,-\sqrt2-\frac1n\right)\cup\left(\sqrt2+\frac1n,\sqrt3-\frac1n\right)$ for $n\in\Bbb N$ we can see that $A:=\bigcup_{n=1}^{\infty}A_n\supset E$, but any finite subcover  $\overline A$ of $A$ is such that $\overline A \not\supset E$.
Thus $E$ is not compact.
$E$ is open, the demonstration is similar to the one that shows $E^C$ is open, I'll leave it to you.
A: This is a nice exercise and should be solved by remaining within $\mathbb{Q}$. Any use of irrational / real numbers is an overkill and totally unnecessary.
First I show that if $p\in E$ then $p$ is an accumulation point of $E$ and then I show that if $p\notin E$ then $p$ is not an accumulation point of $E$. This will establish that $E$ is closed in $\mathbb{Q} $. In what follows we assume $p>0$. The argument for $p<0$ is similar and left for the reader.
Let $q=(3p+4)/(2p+3)$ then we can see that $$p-q=\frac{2(p^2-2)}{2p+3}>0$$ so that $q<p$ and further $$q^2-2=\frac{p^2-2}{(2p+3)^2}>0$$ so that $2<q^2$ and clearly since $q<p$ we have $q^2<p^2<3$. Thus $q\in E$. If $I$ is any neighborhood of $p$ then we just have to choose any number $r\in I$ such that $q<r<p$ and then $r\in E$. This proves that $p$ is an accumulation point of $E$.
Further if $p\notin E$ then either $p^2<2$ or $p^2>3$. Again we deal with $p^2<2$ and leave the case $p^2>3$ for the reader. Let $q=(3p+4)/(2p+3)$ and then we have $q>p$ and $q^2<2$. And thus any rational number $r$ with $p<r<q$ has the property that $r^2<2$ so that $r\notin E$. And if $0<r<p$ then also $r^2<2 $ so that $r\notin E$. Thus $p$ is not an accumulation point of $E$.
It follows from the arguments in last two paragraphs that $E$ is closed in $\mathbb{Q} $. That $E$ is bounded is obvious.
Using similar arguments we can show that $E$ is open.
To show that $E$ is not compact requires a bit more effort. We need to choose an open cover for $E$ using point $q=(3p+4)/(2p+3)$ as boundary point for the interval which contains $p$. Let this interval be called $I_p$. If any finite subcover consisting of intervals $I_{p_1},I_{p_2},\dots, I_{p_n} $ is taken and $s$ be the least of numbers $q_i=(3p_i+4)/(2p_i+3)$ then there are rational numbers $r\in E$ with $r<s$ which are not included in any of the choosen intervals $I_{p_i}$. Thus $E$ is not compact. 
A: We know that:


*

*a) $\mathrm{Closed}(A), \mathrm{LimitPoint}(p, A) \implies p \in A$: If a set is closed and $p$ is a limit point of it, then $p$ is contained in it.

*b) $(\mathrm{LimitPoint}(p, A) \implies p \in A) \implies \mathrm{Closed}(A)$: Same as in a), if it is so that if $p$ is a limit point of $A$ then $p$ is in $A$ then $A$ is closed.

*c) $p \in \mathbb{Q}$: Any point is a rational number.

*d) $a, b,c \in \mathbb{R}, a < b \implies \exists c: a < a + c < b$: A real number can always be sandwhiched between two real numbers $a < b$. 


So you can show closedness in the following way:


*

*$\mathrm{LimitPoint}(p, E)$: Assume $p$ is a limit point.

*$p \notin E$: Assume $p$ is not in $E$.

*$p \notin E \implies p^2 \leq 2 \lor p^2 \geq 3$

*$p \in \mathbb{Q}, p^2 \leq 2 \lor p^2 \geq 3 \implies p^2 < 2 \lor p^2 > 3$ 

*$p^2 < 2 \lor p^2 > 3 \implies p < \sqrt{2} \lor p > \sqrt{3}$

*$p < \sqrt{2}$: The RHS of the $\lor$ can be dealt with similarily.

*$p < \sqrt{2} \implies \exists r: p + r < \sqrt{2}$

*$\exists r: p + r < \sqrt{2} \implies \neg\mathrm{LimitPoint}(p, E)$

*$\bot 1,8 \implies p \in E$: Line 1 and 8 contradict each other, so we can conclude the opposite of line 2, that $p$ is contained in $E$.

*$\mathrm{LimitPoint}(p, E) \implies p \in E$: Summary of argument on lines 1-9.


We have shown $\mathrm{LimitPoint}(p, E) \implies p \in E$, so we can just apply the rule in b) and conclude that $E$ is closed.
A: If $c,d\in \Bbb Q$ with $c<d $ then   $\Bbb Q\cap (c,d)$ is the open $d$-ball in $\Bbb Q,$ centered at $(c+d)/2\in \Bbb Q,$ of radius $(d-c)/2.$
Since none of $\pm \sqrt 2\;,\pm\sqrt 3\;$ are rational we have $E=\bigcup (S\cup T)$ $$\text {where }\quad S=\{\Bbb Q\cap (c,d): c,d\in \Bbb Q\land -\sqrt 3\;<c<d<-\sqrt 2\;\}$$ $$\text {and where} \quad T= \{\Bbb Q\cap (c,d):c,d\in \Bbb Q\land \sqrt 2\;<c<d<\sqrt 3\;\}.$$ So $E$  is a union of $d$-open balls in $\Bbb Q.$ So $E$ is open in $\Bbb Q.$
And $\Bbb Q\setminus E=\bigcup (F\cup G\cup H)$ $$\text {where }\quad  F=\{\Bbb Q\cap (c,d):c,d\in \Bbb Q\land d<c<-\sqrt 3\;\}$$  $$\text {and where } \quad   G=\{\Bbb Q \cap (c,d):\sqrt 3<c<d\}$$  $$ \text {and where } \quad  H=\{\Bbb Q\cap (c,d):c,d\in \Bbb Q \land -\sqrt 2\;<c<d<\sqrt 2\;\}.$$ So $\Bbb Q\setminus E$ is a union of $d$-open balls in $\Bbb Q$. So $\Bbb Q\setminus E$ is open in $\Bbb Q.$
$E$ is bounded because $E$ is a subset of the open $d$-ball centered at $0\in \Bbb Q,$ of radius $10^{10}.$
