link to PDF

Abstract:

We strive to show the answer to XP-110 is Yes using a computer program derived from mathematics.

Part 0: Summary of Problem

XP-110 is a challenge problem aimed at precalculus/trigonometry students, and it goes like this:

Mariko and Chun play a math game. The teacher gives them the quadratic p(x) = __ x2 + __ x + ___ = 0 . Mariko chooses any three numbers and Chun uses these three numbers to fill in the blanks. Can Mariko find three numbers so that both roots of p(x) are rational no matter where Chun puts them?

Part 1: Definitions

Let be the number that fills in the first blank. Similarly, let and be the number that fills in the second and third blanks, respectively. We can assume that numbers in this context can mean any non-zero integer.

Part 2: Writing an Equivalent Form

It is a well-established notion that if the roots of p(x) are rational, then the discriminant of p(x) is a perfect square. The word "both" means that we should strive for a non-zero perfect square (as a zero discriminant will imply a single root of multiplicity two). We also have to make sure that the three numbers have to be non-zero, otherwise we would end up with a rearrangement that is not quadratic. There are possible arrangements, namely the following:

Of those six possible arrangements, there are three possible discriminants (not six, as sometimes, swapping two variables will not change the discriminant)

Combining the two definitions, we can write an equivalent form of what the question asks us to do:

Can we find non-zero numbers , , and such that , , and are perfect squares?

This form is what we strove for, and it can be easily programmed, as we will see in the next part.

Part 3: The Code

/* This code attempts to solve XP-110 via brute force:
The problem stipulates the following:
Mariko and Chun play a math game. The teacher gives them the quadratic 
p(x) = __x^2 + __x + __ = 0.

Mariko chooses any three numbers and Chun uses 
these three numbers to fill in the blanks.
Can Mariko find three numbers so that both roots of p(x)
 are rational no matter where Chun puts them? */
public class HelloWorld {
    public static void main(String[] args) {
        boolean mariko = false;
        for(long a = -2; a < 2; a++){
            for(long b = -2; b < 2; b++){
                for(long c = -2; c < 2; c++){
             long x = a*a-4*b*c; 
             long y= b*b-4*a*c;
             long z= c*c-4*a*b;
             boolean xSquare = ((Math.sqrt(x) - Math.floor(Math.sqrt(x))) == 0);
             boolean ySquare = ((Math.sqrt(y) - Math.floor(Math.sqrt(y))) == 0); 
             boolean zSquare = ((Math.sqrt(z) - Math.floor(Math.sqrt(z))) == 0);
             // by definition, if the discriminant is a perfect square, then both roots of p(x) are rational
             if(xSquare&&ySquare&&zSquare&&a!=0&&b!=0&&c!=0){ //if all three conditions are met plus the fact p(x) has to be quadratic!
                 System.out.println("a="+a); //print out the triple!
                 System.out.println("b="+b); //print out the triple!
                 System.out.println("c="+c); //print out the triple!
                 System.out.println();
                 mariko = true;
             }
                }   
            }
        }
        if(mariko){
                    System.out.println("Yes, Mariko can find three numbers so that both roots of p(x) are rational no matter where Chun puts them."); //let us know the problem halts

        }
        else{
                    System.out.println("No, Mariko cannot find three numbers so that both roots of p(x) are rational no matter "); //let us know the problem halts

        }
    }
}

Note: The bounds in Line 13, 14, and 15 can be arbitrarily changed. They are intentionally small as an example.