How to deduce the following equation from the other? How, from the equation $(1)$
$(1) a^{2x} + 2a^xb^y + b^{2y} = m - 2a^x - 2b^y$
can we deduce the equation $ (2) a^x + b^y = \sqrt{m + 1} - 1$
I know that the right hand side of $(1)$ is the perfect square  $(a^x + b^y)^2 $, but this doesn't help me to deduce $(2)$. 
Also I noticed that, by transposition of terms, $(1)$ can be expressed as $(a^x + b^y)(a^x + b^y + 2) = m$. 
How to deduce $(2)$ from $(1)$?

Write $a^x+b^y=s$, then the rearranged form of $(1)$ you have provided is $s(s+2)=m$ or $s^2+2s-m=0$. It remains to solve the quadratic equation for $s$, yielding
$$s=\frac{-2\pm\sqrt{4+4m}}2=-1\pm\sqrt{m+1}$$
Taking the $+$ in the $\pm$ gives $(2)$: $s=a^x+b^y=\sqrt{m+1}-1$.
