Condition for Denesting of Square Root

Theorem
Let $a,b \in \Q_{\ge 0}$

Then:
 * $\exists p,q \in \Q: \sqrt {a + \sqrt b} = \sqrt p + \sqrt q$

if and only if:
 * $\exists n \in \N: a^2 - b = n^2$.

Proof
The proof is split into the necessary condition:

If
 * $\exists p,q \in \Q: \sqrt {a + \sqrt b} = \sqrt p + \sqrt q$,

then
 * $\exists n \in \N: a^2 - b = n^2$

and the sufficient condition:

If
 * $\exists n \in \N: a^2 - b = n^2$,

then
 * $\exists p,q \in \Q: \sqrt {a + \sqrt b} = \sqrt p + \sqrt q$

Sufficient condition
Let $n^2 = a^2 - b$.

As $a^2 = b + n^2$ it follows that $a \ge \sqrt b$

By Rational Addition is Closed and Rational Subtraction is Closed,
 * $\dfrac a 2 + \dfrac n 2$ and $\dfrac a 2 - \dfrac n 2$

are rational.