# How can I choose the integer numbers a, b, c, d, t so that the equation $\sqrt{a x^2+b x+c}=d x+t$ has two integer solutions?

The equation $$\sqrt{x^2+36 x+180}=2 x+15$$ have two integer solutions are $$x = -5$$ and $$x = -3$$. How can I choose the integer numbers $$a, b, c, d, t$$ so that the equation $$\sqrt{a x^2 + b x + c} = d x + t$$ has two integer solutions? I tried

Solve[a x^2 + b x + c == (d x + t)^2, x]


{{x -> (-b + 2 d t - Sqrt[ b^2 - 4 a c + 4 c d^2 - 4 b d t + 4 a t^2])/( 2 (a - d^2))}, {x -> (-b + 2 d t + Sqrt[b^2 - 4 a c + 4 c d^2 - 4 b d t + 4 a t^2])/(2 (a - d^2))}}

How can I add conditions (-b + 2 d t - Sqrt[ b^2 - 4 a c + 4 c d^2 - 4 b d t + 4 a t^2])/(2 (a - d^2)) and (-b + 2 d t + Sqrt[ b^2 - 4 a c + 4 c d^2 - 4 b d t + 4 a t^2])/(2 (a - d^2)) are integer numbers.

FindInstance[Sqrt[a x1^2 + b x1 + c] == d x1 + t &&
Sqrt[a x2^2 + b x2 + c] == d x2 + t,
{a, b, c, d, t, x1, x2}, Integers, 10]

(*    {{a -> -582, b -> 0, c -> 1, d -> 1, t -> 1, x1 -> 0, x2 -> 0},
{a -> -526, b -> -46, c -> 0, d -> 0, t -> 0, x1 -> 0, x2 -> 0},
{a -> -1, b -> 30, c -> 0, d -> 2, t -> -60, x1 -> 30, x2 -> 30},
{a -> 961, b -> 1, c -> 0, d -> 15, t -> 0, x1 -> 0, x2 -> 0},
{a -> 1, b -> 30, c -> 0, d -> 46, t -> 0, x1 -> 0, x2 -> 0},
{a -> -820, b -> -15, c -> 0, d -> 12, t -> 0, x1 -> 0, x2 -> 0},
{a -> 656, b -> -24, c -> 0, d -> 22, t -> 0, x1 -> 0, x2 -> 0},
{a -> 2, b -> 12, c -> -54, d -> -1, t -> -9, x1 -> -9, x2 -> -9},
{a -> -308, b -> 16, c -> 0, d -> 79, t -> 0, x1 -> 0, x2 -> 0},
{a -> 1, b -> 1, c -> 0, d -> 11, t -> 0, x1 -> 0, x2 -> 0}}    *)


If you prefer non-boring solutions: all parameters and solutions shall be non-zero, and $$a\neq d^2$$ to make sure we have a really quadratic problem:

FindInstance[Sqrt[a x1^2 + b x1 + c] == d x1 + t &&
Sqrt[a x2^2 + b x2 + c] == d x2 + t &&
a != 0 && b != 0 && c != 0 && d != 0 && t != 0 &&
a != d^2 &&
x1 != 0 && x2 != 0 && x1 != x2,
{a, b, c, d, t, x1, x2}, Integers, 10]


FindInstance: Warning: FindInstance found only 9 instance(s), but it was not able to prove 10 instances do not exist.

(*    {{a -> -2, b -> -1, c -> 91, d -> 1, t -> 7, x1 -> 2, x2 -> -7},
{a -> -1, b -> -98, c -> 7203, d -> -1, t -> 49, x1 -> -49, x2 -> 49},
{a -> -1, b -> -60, c -> 2700, d -> -1, t -> 30, x1 -> -30, x2 -> 30},
{a -> -1, b -> -10, c -> -8, d -> 1, t -> 10, x1 -> -9, x2 -> -6},
{a -> -1, b -> -6, c -> 55, d -> -1, t -> 5, x1 -> -3, x2 -> 5},
{a -> -1, b -> 8, c -> 42, d -> 1, t -> 6, x1 -> -3, x2 -> 1},
{a -> -1, b -> 54, c -> 2187, d -> 1, t -> 27, x1 -> -27, x2 -> 27},
{a -> 11, b -> -62, c -> 72, d -> -3, t -> 12, x1 -> -9, x2 -> 4},
{a -> 13, b -> 92, c -> 7, d -> 2, t -> 14, x1 -> 3, x2 -> -7}}    *)


No need to use FindInstance. In fact you can generate all possible equations with prescribed roots r1 and r2.

ra = 10;
n = 24;

Table[{r1, r2} = RandomSample[Range[-ra, ra], 2];
{d, k} = RandomChoice[Complement[Range[-ra, ra], {0}], 2];
t = RandomChoice@Complement[Range[0, 2 ra] + Max[-d {r1, r2}], {0}];
Sqrt[(d^2 - k) x^2 + (k (r1 + r2) + 2 d t) x + t^2 -
k r1 r2] == (d x + t), n];

Partition[%, 2] // Grid

Clear[d, k, r1, r2, t, ra, n]


$$\begin{array}{ll} \sqrt{46 x^2-498 x+1356}=34-6 x & \sqrt{103 x^2-1957 x+9334}=98-10 x \\ \sqrt{7 x^2+108 x+486}=2 x+27 & \sqrt{4 x^2+165 x+920}=3 x+30 \\ \sqrt{63 x^2+1047 x+4348}=8 x+66 & \sqrt{77 x^2-1584 x+8100}=90-9 x \\ \sqrt{27 x^2+576 x+2808}=6 x+54 & \sqrt{21 x^2+188 x+288}=5 x+16 \\ \sqrt{4 x^2+61 x+151}=3 x+11 & \sqrt{23 x^2-112 x+168}=14-4 x \\ \sqrt{103 x^2-1550 x+5848}=76-10 x & \sqrt{28 x^2+340 x+1001}=6 x+31 \\ \sqrt{-6 x^2-85 x-271}=-x-3 & \sqrt{104 x^2-852 x+1753}=43-10 x \\ \sqrt{62 x^2+696 x+1939}=8 x+43 & \sqrt{90 x^2+729 x+1573}=9 x+41 \\ \sqrt{73 x^2+825 x+2331}=8 x+51 & \sqrt{3 x^2+18 x+76}=x+10 \\ \sqrt{30 x^2-370 x+1189}=37-5 x & \sqrt{77 x^2-1954 x+12201}=109-9 x \\ \sqrt{44 x^2+677 x+2404}=7 x+48 & \sqrt{-2 x^2+46 x+496}=2 x+16 \\ \sqrt{35 x^2-690 x+3631}=61-5 x & \sqrt{75 x^2-492 x+793}=9 x-31 \\ \end{array}$$

• Can I add GCD[a, b, c] == 1? Commented Nov 19, 2023 at 4:09
• @minhthien_2016: Surely, in the list above there are only three cases where gcd(a,b,c)>1 but you can select only those that gcd(a,b,c)==1 if you wish. Commented Nov 19, 2023 at 11:39