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?

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$.
