When its possible to write a number $a+b\sqrt{c}$ as the square of a sum? I was teaching my high school students how to find the roots of 2nd degree equations like the following:
$\frac{x^2}{2}+\sqrt{3}x-\sqrt{2}=0$
In this case, using the formula we get:
$x=-\sqrt{3}\pm\sqrt{3-2\sqrt{2}}$
To simplify I writted $3-2\sqrt{2}$ as $(\sqrt{2}-1)^2$, so I get:
$x=-\sqrt{3}\pm(\sqrt{2}-1)$
In this case was simple to write $3-2\sqrt{2}$ as $(\sqrt{2}-1)^2$, there are some harder cases to find this factorization.
My question is when it's possible to write $a+b\sqrt{c}$ as $(m+n)^2$,
and how to find these numbers $m$ and $n$?
 A: Suppose $a+b\sqrt{c} = (m+n\sqrt{c})^2$, where $a$, $b$, $c$, $m$, and $n$ are integers and further that $c > 0$ (otherwise we are not talking about the real-valued square root or we are talking about $a+0 = a$).  Then \begin{align*}
a+b\sqrt{c} &= (m+n\sqrt{c})^2  \\
&= m^2 + cn^2 + 2 m n \sqrt{c}  \\
\end{align*}
This forces $b$ even.  So, not possible if $b$ is odd.  Then for each (partial) factorization $b = 2 x y$, where $x$ and $y$ are integers, can be $\pm 1$, and need not be prime, we have a solution if $x^2 + cy^2 = a$ or $y^2 + cx^2 = a$.  In the former case, take $m = x$ and $n = y$.  In the latter, take $m = y$ and $n = x$.
Applied to your example...  We attempt to simplify $\sqrt{3+2\sqrt{2}}$, so $a = 3$, $b = c = 2$.  Since the $2$ coefficient of the radical is even, there may be a solution.  The (partial) factorizations of $2$ of the suitable form are $2 \cdot 1 \cdot 1$ and $2 \cdot -1 \cdot -1$.  In the first case, $1^2 + 1^2 \cdot c = 3 = a$, as desired and we obtain $3 + 2\sqrt{2} = (1+1\sqrt{2})^2$.  (The latter (partial) factorization gives $3+2\sqrt{2} = (-1-\sqrt{2})^2$, which is also true.)
A: This is not as hard as it seems.
[I will slightly alter your notation, and instead of $(m+n)^2$ I will use $(m + n\sqrt{c})^2$.]
$$ (m + n\sqrt{c})^2 = a + b \sqrt{c} $$
Expanding and collecting everything on the left-hand side gives us:
$$ n^2 c + (2mn - b) \sqrt{c} + (m^2 - a) = 0$$
We are given $a, b, c \in \mathbb{Z}$, and likewise we want $m, n \in \mathbb{Z}$.
Well, the first and third terms are integers, and the second one isn't (unless $c$ is a perfect square -- otherwise we could have used simpler methods). This means that the coefficient of $\sqrt{c}$ must be equal to $0$. This gives us the new equation $mn = \frac{b}{2}$. So, $b$ must be even for this to work.
The two remaining terms also need to sum to 0. This means $n^2 c + m^2 = a$.
So, let's sum up what we have so far:

*

*$b$ must be even.

*$mn = \frac{b}{2}$

*$n^2 c + m^2 = a$
Unless $b = 0$, in which case we have a much simpler problem, we have that $n \neq 0$. This means that we can safely divide by $n$ , and get:

*

*$m = \frac{b}{2n}$
We can substitute that into our last equation, which gives us:

*

*$n^2 c + \frac{b^2}{4n^2} = a$
If we let $N = n^2$, we can multiply by $N$ and rewrite all this as:

*$N^2 c + \frac{b^2}{4} = a$
So, we get: $N^2 = \frac{a}{c} - \frac{b^2}{4c}$.
This means:
$$N^2 = \frac{4a - b^2}{4c}$$
The right-hand side must be positive (so $4a > b^2$) and it must be a perfect square.
So, the constraint you were looking for are:

*$b$ is even.

*$4a > b^2$

*$\frac{4a - b^2}{4c}$ is a perfect square.
[The first constraint is not strictly necessary, if you don't mind working with fractions instead of integers.]

For your example, we get $$\frac{4\times 3 - 2^2}{4 \times 2} = \frac{8}{8} = 1 = 1^2$$
So, we know $n = \pm \sqrt{N}$, and $m = \pm \frac{b}{2\sqrt{N}}$. We can safely choose one sign for $n$ and take the corresponding sign for $m$ (the other option would just give us $(-m -n\sqrt{c})$).
