AM=(a+b)/2, GM=√(ab). Let y=m/n=AM/GM=(a+b)/(2√(ab)). Let x=a/b, so a=bx.
y=(bx+b)/(2√(b^2x))=(x+1)/(2√x).
y^2=(x^2+2x+1)/(4x), 4xy^2=x^2+2x+1, x^2+2x(1-2y^2)=-1
x^2+2x(1-2y^2)+(1-2y^2)^2=(1-2y^2)^2-1=-4y^2+4y^4
(x+1-2y^2)^2=4y^2(y^2-1)
x+1-2y^2=±2y√(y^2-1), x=2y^2-1±2y√(y^2-1)=2y^2-1±2y^2√(1-1/y^2)=2y^2(1±√(1-1/y^2))-1.
So a/b=2(m/n)^2(1±√(1-(n/m)^2))-1. Clearly m≥n. The two solutions are reciprocals of one another, as we'll see later, due to the interchangeability of a and b.
(x+1)/(2√x)≥1, x^2+2x+1≥4x, x^2-2x+1≥0 so (x-1)^2≥0, which is true for all x>0 ((x+1)/(2√x)≥1).

The vertical axis represents m/n and the horizontal axis a/b.
EXAMPLES
If m/n=5/4, a/b=1/4 or 4. This demonstrate the interchangeability of the two numbers a and b. So if a=1 and b=4, AM=2.5 and GM=2 AM/GM=2.5/2=1.25. If a=4 and b=1 the result is the same.
If a=18 and b=2, a/b=9 AM=10 and GM=6, so AM/GM=10/6=5/3. Interchange a and b, a/b=1/9. So the same m/n=5/3 applies to a/b=9 or 1/9.