Quadratic equation system $A^2 + B^2 = 5$ and $AB = 2$ Given a system of equations

$A^2 + B^2 = 5$
$AB = 2$

what is the correct way to solve it?
I see immediately that the answers are

*

*$A=1, B=2$

*$A=2, B=1$

*$A=-1, B=-2$

*$A=-2, B=-1$
but I don't understand the correct way of getting there. I have tried to isolate one of the variables and put the resulting expression into one of the equations, but this didn't get me anywhere. What is the correct way of solving this problem?
 A: You have $$A^2+B^2=5 \tag 1$$ $$AB=2 \tag 2$$ So, from $(2)$, $B=\frac 2 A$. Plug in $(1)$ to get $$A^2+\frac 4{A^2}=5 \tag 3$$ So, $$A^4-5A^2+4=0 \tag 4$$ which is a quadratic in $A^2$.
A: $A^2 + B^2=5$ and $ AB=2$
Subtracting the first equation with twice of the second equation leads to $A-B= \pm 1$.
Adding the first equation with twice the second equation gives $A+B= \pm 3$.
Solve the four possible sets of equations to get the answers above.
A: This comes down to the classical problem of finding two numbers, given their sum $S$ and their product $P$: they're the roots, if any, of the quadratic equation:
$$x^2-Sx+P=0.$$
Here, you have $P=2$ and
$$(A+B)^2=A^2+B^2+2AB=9, \enspace\text{whence}\quad S=\pm3.$$
Thus $A$ and $B$ are the roots of one of the equations:
$$x^2-3x+2=0,\qquad x^2+3x+2=0.$$
In the present case, there remains to apply the Rational roots theorem.
A: From $AB=2$ we know $A$ and $B$ have the same sign.
Moreover, if we find a solution for some values $A=A_1$ and $B=B_1$,
then $A=-A_1$ and $B=-B_1$ also is a solution.
So we can assume initially that $A$ and $B$ are both positive,
find all such solutions, and then simply change signs to produce all the remaining solutions (the ones in which $A$ and $B$ are both negative).
Similarly, we can assume initially that $A\geq B$, because all the solutions
in which $B \geq A$ can then be produced just by swapping the values of
the two variables.
So we now have (with these assumptions) $A \geq B > 0,$ 
$A^2 + B^2 = 5,$ and $AB = 2.$ Then
\begin{align}
(A + B)^2 &= A^2 + 2AB + B^2 = 5 + 2(2) = 9, \\
(A - B)^2 &= A^2 - 2AB + B^2 = 5 - 2(2) = 1. \\
\end{align}
In each of these equations, the positive square roots of both sides 
must be equal, and since $A+B>0$ and $A-B\geq0$ this tells us that
\begin{align}
A + B &= 3, \\
A - B &= 1. \\
\end{align}
Therefore (adding the two equations) $2A = 4,$ so $A = 2,$ so $B = 1.$
That is, the unique solution (under the assumption $A\geq B>0$)
is $(A,B) = (2,1).$
We can now remove the assumptions that $A\geq B$ and that $B>0,$
then use the facts mentioned earlier to derive the remaining solutions:
$(A,B) = (1,2)$ (swapping values), $(A,B) = (-2,-1)$
or $(A,B) = (-1,-2)$ (changing signs).
A: More or less the same as other answers, but not quite: Put $x=A^2$, $y=B^2$, then we have
\begin{align}
x+y=5\\
xy=4
\end{align}
and thus by Viete's formulas we have that $x$, $y$ are the two roots of the quadratic polynomial
$$z^2-5z+4=(z-4)(z-1).$$
This gives you four possibilities for $(A,B)$, so as @Hurkyl pointed out in comments, your solutions are all.
A: My favorite way:
Multiply the first equation by $A^2$ ($\ne0$):
$$A^4+A^2B^2=5A^2.$$
As $A^2B^2=4$, you get a biquadratic equation:
$$A^4-5A^2+4=0.^*$$
Then
$$A^2=\frac{5\pm3}{2}=1\text{ and }4,$$ giving the four solutions
$$A=-2,-1,1,2$$
and corresponding $B=2/A$:
$$B=-1,-2,2,1.$$

$^*$Following @Hurkyl's argument, you can stop there, because a biquadratic equation cannot have more than four roots, and by $AB=2$, there is a single $B$ for a given $A$.
A: Obviously $A\neq 0$, then $B=\frac{2}{A}$. Subtitute into the first equation:
$A^2+\frac{4}{A^2}=5 \implies 0=A^4-5A^2+4=(A^2-1)(A^2-4)$
Here we can deduce 4 values of $A$ like your solutions, find $B=\frac{2}{A}$ and it's done
A: Hint: $$A^2+B^2+2AB=(A+B)^2=5+2\cdot2=9=3^2$$
Then $A+B=\pm3$
Thus

$A+B=\pm3$
$AB=2$

Case 1)
$A+B=3$
$AB=2$
Case 2)
$A+B=-3$
$AB=2$
A: If
$a^2+b^2 = c$
and
$ab = d$
then
$(a+b)^2
=a^2+2ab+b^2
= c+2d
$
and
$(a-b)^2
=a^2-2ab+b^2
= c-2d
$.
Therefore
$a+b = \sqrt{c+2d}$
and
$a-b = \sqrt{c-2d}$
so
$a = \frac12(\sqrt{c+2d}+\sqrt{c-2d})
$
and
$b = \frac12(\sqrt{c+2d}-\sqrt{c-2d})
$.
If $c=5, d=2$,
then
$\sqrt{c+2d} = 3$
and
$\sqrt{c-2d} = 1$
so
$a= 2$
and
$b = 1$. 
If you want to get
all the solutions,
you can write
$a = \frac12(\pm\sqrt{c+2d}\pm\sqrt{c-2d})
$
and
$b = \frac12(\pm\sqrt{c+2d}\mp\sqrt{c-2d})
$
for all possible signs.
A: $\newcommand{\bbx}[1]{\,\bbox[8px,border:1px groove navy]{\displaystyle{#1}}\,}
 \newcommand{\braces}[1]{\left\lbrace\,{#1}\,\right\rbrace}
 \newcommand{\bracks}[1]{\left\lbrack\,{#1}\,\right\rbrack}
 \newcommand{\dd}{\mathrm{d}}
 \newcommand{\ds}[1]{\displaystyle{#1}}
 \newcommand{\expo}[1]{\,\mathrm{e}^{#1}\,}
 \newcommand{\ic}{\mathrm{i}}
 \newcommand{\mc}[1]{\mathcal{#1}}
 \newcommand{\mrm}[1]{\mathrm{#1}}
 \newcommand{\pars}[1]{\left(\,{#1}\,\right)}
 \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}}
 \newcommand{\root}[2][]{\,\sqrt[#1]{\,{#2}\,}\,}
 \newcommand{\totald}[3][]{\frac{\mathrm{d}^{#1} #2}{\mathrm{d} #3^{#1}}}
 \newcommand{\verts}[1]{\left\vert\,{#1}\,\right\vert}$
\begin{align}
A & = \root{5}\cos\pars{\theta}\,,\quad
B = \root{5}\sin\pars{\theta} \implies
\bracks{\root{5}\cos\pars{\theta}}\bracks{\root{5}\sin\pars{\theta}} = 2
\\[5mm]
\implies & \sin\pars{2\theta} = {4 \over 5}
\end{align}
Moreover,
$$
\left\{\begin{array}{rcl}
\ds{A} & \ds{=} & \ds{\root{5}\root{1 + \cos\pars{2\theta} \over 2} =
\root{{5 \over 2}\bracks{1 + \root{1 - \sin^{2}\pars{2\theta}}}}} = \bbx{\ds{2}}
\\[2mm]
\ds{B} & \ds{=} & \ds{2 \over A} = \bbx{\ds{1}}
\end{array}\right.
$$

Of course $\ds{\pars{A,B} = \pars{-2,-1}}$ is a solution too !!!.
  And $\ds{\pars{A,B} = \pars{-1,-2}}$. 

