On Wed, 7 Jul 2004, Bill & Rosemary Cordwell wrote:
Is there an easy way to tell when a + b*sqrt(k) is a perfect square in the extension field Q(sqrt(k))? For example, 3 + 2*sqrt(2) is the square of 1 + sqrt(2). I'm particularly interested in when a, b, k are integers, but a and b rationals would be OK, too.
Here's a quick way. If the square root is c + dx (x = sqrt(k), you evaluate the square roots of a+bx and a-bx as complex numbers, and up to sign they'll be c + dx and c-dx, so their semisum and semidifference will be 2c and 2dx in some order. You look at these to see which looks like an ordinary integer and which like an integer multiple of x. You can still do this if you're asking about a rational answer, provided you expect the denominators to be fairly small, and it's probably the quickest way, in practice. If you do need to do it exactly and theoretically, though, that's also fairly easy. You just solve the equations (c +- dx)^2 = a +- bx algebrically, which leads to a quartic equation for c, with rational coefficients. Make these integers, say A,B,C,D,E - then the numerator of c divides E and its denominator divides A, so it can be found. John Conway