Definition of number field (K):

(1) $0,1 \in K$

(2) $\alpha, \beta \in K \Longrightarrow \alpha \pm \beta \ and\ \alpha \beta \in K$

(3) $\alpha, \beta \in K$, and $\beta \neq 0 \Longrightarrow \frac{\alpha}{\beta} \in K$

Now I want to prove the following list of algebraic numbers with the same symbolic expression is a number field by MMA.

$list=\{a+b \sqrt{2} \mid a, b \in \mathbf{Q}\}$ (EDIT: Q is Rational number field)

AlgebraicNumber[Sqrt[2], {a, b}]

The proof process in the textbook is as follows.

$0=0+0 \sqrt{2} \in list$

$1=1+0 \sqrt{2} \in list$

$Assuming\ \alpha=a+b \sqrt{2}\ and\ \beta=c+d \sqrt{2} \in list$

$Then\ \alpha \pm \beta=(a+b \sqrt{2}) \pm(c+d \sqrt{2})=(a \pm c)+(b \pm d) \sqrt{2} \in list$

$\alpha \beta=(a+b \sqrt{2})(c+d \sqrt{2})=(a c+2 b d)+(a d+b c) \sqrt{2} \in list$

$\begin{aligned} \frac{\alpha}{\beta} &=\frac{a+b \sqrt{2}}{c+d \sqrt{2}}=\frac{(a+b \sqrt{2})(c-d \sqrt{2})}{(c+d \sqrt{2})(c-d \sqrt{2})} \\ &=\frac{(a c-2 b d)+(b c-a d) \sqrt{2}}{c^{2}-2 d^{2}} \\ &=\frac{a c-2 b d}{c^{2}-2 d^{2}}+\frac{b c-a d}{c^{2}-2 d^{2}} \sqrt{2} \in list \end{aligned}$

I would like to know if there is an automatic MMA command for the above proof process? Or can we repeat the proof process with MMA code?


Can we use functions such as MemberQ or FreeQ to prove that

$0,1 \in list$

$\alpha \pm \beta \ and\ \alpha \beta \in list$

$\frac{\alpha}{\beta} \in list$

  • $\begingroup$ The problem with using structural operations such as MemberQ/FreeQ is that membership in Q[sqrt(2)] is an algebraic question. So it is not obvious what to do for example when denominators are present. Also there are underlying assumptions e.g. that parameters a,b,... (from the example) are elements of the base field Q. So you really need to apply algebraic methods. $\endgroup$ Mar 29 at 15:15
  • $\begingroup$ @Daniel Lichtblau Thank you very much! This problem is not difficult to solve by hand, but it seems not easy to solve by MMA. I thought MMA would have a function or simple code to check whether a list is a number field, but it seems not. $\endgroup$
    – lotus2019
    Mar 30 at 2:28

1 Answer 1


I'll show the hard case, working with quotients. Say we have


Let's make the square root into a variable sqrt2, satisfying the relation sqrt2^2==2. Then convert the fraction expression into a polynomial equality:

(a + b*sqrt2) - frac*(c + d*sqrt2)

Next extract a Groebner basis with frac ordered above sqrt2 and all else parameters.

gb = 
 GroebnerBasis[{(a + b*sqrt2) - frac*(c + d*sqrt2), 
   sqrt2^2 - 2}, {frac, sqrt2}, CoefficientDomain -> RationalFunctions]

(* Out[607]= {-2 + sqrt2^2, -a c + 
  2 b d + (c^2 - 2 d^2) frac + (-b c + a d) sqrt2} *)

We can solve for frac as a linear polynomial in sqrt2 and see this by separating out the constant and sqrt2 terms.

Collect[SolveValues[gb[[2]] == 0, frac], sqrt2]

(*Out[609]= {(a c - 2 b d)/(c^2 - 2 d^2) + ((b c - a d) sqrt2)/(
  c^2 - 2 d^2)} *)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.