# Perfect squares and cubes in quadratic number fields

Suppose we are given a quadratic number field $$\mathbb{Q}(\sqrt{d})$$, for some integer $$d$$ which is not a perfect square. I wish to study when is an element $$\alpha \in \mathbb{Q}(\sqrt{d})$$ a perfect square, i.e. $$\alpha = \beta^2$$ for some $$\beta \in \mathbb{Q}(\sqrt{d})$$. Similarly, how to test whether an element $$\alpha \in \mathbb{Q}(\sqrt{d})$$ is a perfect cube, i.e. $$\alpha = \beta^3$$ for some $$\beta \in \mathbb{Q}(\sqrt{d})$$. I know the above questions reduce to solving appropriate quadratic/cubic equations over rationals but I am looking for a direct test similar to quadratic/cubic residuacity tests that we have for finite fields.

I have little to zero knowledge of algebraic number theory but I am willing to do the hard work. I am looking for books or resources (preferably beginner friendly) which deal with these two questions in detail. My gratitude in advance if anyone can point me in the right direction.

• Do you mean squares or quadratic residues? Jun 24, 2021 at 12:03
• @franzlemmermeyer I guess square will be the appropriate term. Jun 24, 2021 at 17:53
• @franzlemmermeyer I realized just now that I had looked up your website in fen.bilkent.edu.tr/~franz/rl2/rlb12.pdf before asking this question. Based on the little knowledge that I have, I am aware that quadratic and cubic reciprocity laws do go into $\mathbb{Z}[\iota]$ and $\mathbb{Z}[\omega]$ but I am not sure whether the quadratic reciprocity in number fields in the link above actually has any connection to my query above, as you correctly pointed out that I am looking for perfect squares and cubes, and not residues in number fields. Could you please clarify that, if possible. Jun 25, 2021 at 11:09

Since every algebraic number is the quotient of an algebraic integer and an ordinary integer, we can write every element as a quotient of an algebraic integer and a square number. This reduced the problem to elements of $${\mathbb Z}[\sqrt{m}]$$.

A necessary condition for $$\alpha$$ to be a square is that its norm is a square; assume therefore that $$N\alpha = \alpha \alpha' = m^2$$ for an integer $$n$$.

Now we recall the ancient Babylonians' idea that you can compute two unknowns from their sum and their difference: \begin{align*} (\sqrt{\alpha} + \sqrt{\alpha'}\,)^2 & = \alpha + \alpha' + 2n, \\ (\sqrt{\alpha} - \sqrt{\alpha'}\,)^2 & = \alpha + \alpha' - 2n, \end{align*} Thus with $$r = \sqrt{\alpha + \alpha' + 2n}$$ and $$s = \sqrt{\frac{\alpha + \alpha' - 2n}m}$$ (if $$s$$ is not an integer, $$\alpha$$ is not a square) we have $$\sqrt{\alpha} = \frac{r + s \sqrt{m}}2.$$

Example: Compute $$\sqrt{\alpha}$$ for $$\alpha = 37 + 20 \sqrt{3}$$. Here $$N\alpha = 169 = 13^2$$, and we find $$r = \sqrt{74 + 2 \cdot 13} = 10$$, $$s = \sqrt{\frac{74 - 2\cdot 13}3} = 4$$, hence $$\sqrt{\alpha} = 5 + 2 \sqrt{3}$$.

Of course you can test whether elements are squares by testing whether they are squares modulo suitably chosen ideals; if you choose to do so, this is best done without using any reciprocity law.

A necessary condition for $$\alpha = r + s \sqrt{m}$$ to be a cube is that its norm $$\alpha \alpha' = n^3$$ is the cube of an integer. In this case $$(\sqrt[3]{\alpha} + \sqrt[3]{\alpha'})^3 = \alpha + \alpha' + 3n (\sqrt[3]{\alpha} + \sqrt[3]{\alpha'}).$$ For $$\alpha$$ to be a cube, this equation must have an integral root $$2r$$, which can be easily checked in a finite number of steps.

Next consider $$\omega = \frac{\sqrt[3]{\alpha} - \sqrt[3]{\alpha'}}{\sqrt{m}}$$; here $$\omega^3 = \frac{\alpha - \alpha'}{m \sqrt{m}} + \frac{3n}{m} \omega,$$ and if $$\alpha$$ is a cube, this cubic must have an integral root $$2s$$.

Example: Let $$\alpha = 100 + 51 \sqrt{3}$$. Then $$N\alpha = \alpha \alpha' = 13^3$$, and $$2r$$ must be an integral root of $$X^3 - 39X -200 = 0.$$ Since $$X = 8$$ is the only real root, we must have $$2r = 8$$, hence $$r = 4$$. Similarly, $$2s$$ is a root of $$X^3 + 13X - 34 = 0,$$ and since $$X = 2$$ is the only real root we conclude that $$s = 1$$. In fact, $$\sqrt[3]{100 + 51\sqrt{3}} = 4 + \sqrt{3}$$.

• Is there a necessary condition for $\alpha$ to be a cube in $\mathbb{Z}[\sqrt{m}]$? I mean do we have something similar to test perfect cubes also? Jun 28, 2021 at 4:39
• @Pranav The quadratic denesting formula has a simple memorable form that I describe here. Dec 8, 2021 at 15:59

The answer depends on the kind of "test" you would hope to have. Given $$\alpha\in\mathbb{Q}(\sqrt{d})$$, then $$\alpha=a+b\sqrt{d}$$ for some $$a,b\in\mathbb{Q}$$. What you are asking for is: on what conditions $$\sqrt{\alpha}$$ is again an element of $$\mathbb{Q}(\sqrt{d})$$? i.e. we must find $$\lambda,\mu\in\mathbb{Q}$$ such that $$\sqrt{\alpha}=\lambda+\mu\sqrt{d}$$. By last equality, if you square both sides you get:

$$\alpha=\lambda^2+\mu^2d+2\lambda\mu\sqrt{d}$$. But also $$\alpha=a+b\sqrt{d}$$ as initially stated. Since $$\{1,\sqrt{d}\}$$ is a base, by: $$\lambda^2+\mu^2d+2\lambda\mu\sqrt{d}=a+b\sqrt{d}$$ it follows: $$a=\lambda^2+\mu^2d$$ and $$b=2\lambda\mu$$ The most interesting is the first one, it basically tell you when the square root of $$\alpha$$ does live in $$\mathbb{Q}(\sqrt{d})$$: indeed we wrote $$a=\lambda^2+\mu^2d$$, which doesn't have solutions when $$a$$ is negative and $$d$$ positive. On the other hand, suppose $$d>0$$ and $$a>0$$. By that system you reach the equation: $$4d\mu^4-4a\mu^2+b^2=0$$ and $$\frac{\Delta}{2}=4a^2-4db^2$$ must be $$0$$ in order to have a "unique solution" ($$2$$ instead of $$4$$). Thus $$a^{2}=db^2$$, but now we have a problem: it follows that $$\sqrt{d}=\frac{a}{b}$$ which is impossible unless $$d$$ is a perfect square. Just to trying and keep going, assume then $$\frac{\Delta}{2}>0$$, it would lead you to: $$\mu^2=\frac{a\pm\sqrt{a^2-db^2}}{2d}$$

Now, remember we want $$\mu\in\mathbb{Q}$$ and all these last passages brings us to say: $$\mu=\pm\sqrt{\frac{a\pm\sqrt{a^2-db^2}}{2d}}$$ Basically, as test you may have $$a^2-db^2>0$$ and $$\frac{a\pm\sqrt{a^2-db^2}}{2d}$$ being a perfect square.

A cubic root I suspect would require you much more computations and details.

• If you multiply second equation by $a$ and subtract it from first equation multiplied by $b$, you will arrive at the condition that $4a^2-4db^2$ is a perfect square $> 0$. I borrowed this idea from math.stackexchange.com/questions/550121/… which works for cubics. Unfortunately, in my research the original problem I started with was testing solvability of a cubic equation over rationals, which one can show reduces to testing whether an element in number field is a cube. Ofcourse one can directly solve it using LLL but I want easier test Jun 25, 2021 at 10:55

In the case that $$d<0$$, there is even another method which is quite simple and straightforward in my mind. However: It only works for $$d<0$$.

So, assume $$d<0$$ and write $$K=\mathbb{Q}(\sqrt{d})$$ and $$R=\mathbb{Z}[\sqrt{d}]$$. As explained in franz lemmermeyer's answer, we reduce the problem to $$R$$. So, we assume $$\alpha \in R$$ and we want to check whether it is a square in $$R$$. Compute its norm: $$N(\alpha)=m$$ where $$m \in \mathbb{Z}$$. Now, every $$\beta \in R$$ with $$\beta^2=\alpha$$ must satisfy $$N(\beta)^2=m.$$ Write $$\beta=x+\sqrt{d}y$$ with $$x,y \in \mathbb{Z}$$. Plugging this into the above equation gives $$(x^2+|d|y^2)^2=m.$$ This equation has only finitely many solutions $$x,y \in \mathbb{Z}$$ since each solution must satify $$|x| \leq \sqrt{m}$$ and $$|y|\leq \sqrt{m/|d|}$$ and there are only finitely many integers with this property. (The bounds $$\sqrt{m}$$ and $$\sqrt{m/|d|}$$ can even be improved.) To check whether $$\alpha$$ is a square you have to complete the following two steps:

Step 1: Compute all integer solutions of $$(x^2+|d|y^2)^2=m$$. (Just use trial and error for all integers $$x,y$$ less than the bounds mentioned above.)

Step 2: For all solutions $$x,y$$ from step 1, check whether $$(x+\sqrt{d}y)^2=\alpha$$.

If step 2 was successful, $$\alpha$$ is a square. If not, $$\alpha$$ is not a square.

The question whether $$\alpha$$ is a cube is the same except that you have to deal with an equation of the form $$N(\beta)^3=m$$ or, more precisely, $$(x^2+|d|y^2)^3=m.$$ In fact, this method works for any power (as long as $$d<0$$).