1
$\begingroup$

I need to find example if $x,\sqrt{x^2+6},\sqrt{x^2+12}$ all can be rational at once or not. But the following command FindInstance[Element[Sqrt[x + 6], Rationals], {x}]returns an errors saying

The methods available to FindInstance are insufficient to find the requested instances or prove they do not exist.

Anyway to bypass this or modify the input to get result?

Edit FindInstance[Element[y - 8.4, Rationals], {y}] also returns the same error. Is this a bug or what?

$\endgroup$
  • $\begingroup$ Please, elaborate what means "all can be rational at once or not" $\endgroup$ – José Antonio Díaz Navas Apr 30 '18 at 17:53
  • $\begingroup$ @JoséAntonioDíazNavas for example both √y and √(y+9) are rational for y =16. I need to x such that all three of those terms are rational $\endgroup$ – Anvit Apr 30 '18 at 18:35
3
$\begingroup$

Maybe this?:

FindInstance[6 + x^2 == y^2 && 12 + x^2 == z^2, {x, y, z}, Rationals]

{{x -> -(1/2), y -> -(5/2), z -> 7/2}}

Given that by definition $|c|=\sqrt{c^2}$ for $c\in\mathbb{R}$, then the solutions should be:

{{x -> -(1/2), y -> 5/2, z -> 7/2}} || {{x -> 1/2, y -> 5/2, z -> 7/2}}

$\endgroup$
0
$\begingroup$

You might try brute-force search, enumerating all (positive) rationals starting from 0:

x = 0; While[! (Element[Sqrt[x^2 + 6], Rationals] &&Element[Sqrt[x^2 + 12], Rationals]), x = 1/(Floor[x] + 1 - FractionalPart[x])]; x

with simple answer: (* x = 1/2 *).

$\endgroup$
  • $\begingroup$ relying on a bit of luck that the answer occurs early in the sequence. This could take approximately forever. $\endgroup$ – george2079 May 2 '18 at 19:29
  • $\begingroup$ Above one-liner check 10^6 distinct rationals/second. You can easily get 10^8/sec rewriting in C. $\endgroup$ – Andrzej Odrzywolek May 3 '18 at 18:41
  • $\begingroup$ Ah, but the space of "all" rationals is infinite. It is a fair point that such a puzzle likely has a "nice" answer though. $\endgroup$ – george2079 May 3 '18 at 19:07
  • $\begingroup$ Space of all rationals representable in computer is finite, e.g. limited by memory. FindInstance probably uses algorithm like this for Integers, so why not for Rationals? $\endgroup$ – Andrzej Odrzywolek May 4 '18 at 5:27
0
$\begingroup$

A systematic look-up for x^2 == y && 9 + y == z^2

sol = Union[{x1/x2, x1^2/x2^2, z1/z2} /. 
       Solve[(9 + (x1/x2)^2 == (z1/z2)^2 && 0 <= x1 <= a && 0 < x2 <= a &&
    0 <= z1 <= a && 0 < z2 <= a) /. a -> 100, {x1, x2, z1, z2}, 
    Integers, Method -> Reduce]]

(*   {{0, 0, 3}, {13/28, 169/784, 85/28}, {11/20, 121/400, 61/20},
{16/21, 256/441, 65/21}, {7/8, 49/64, 25/8}, {5/4, 25/16, 13/4},
{8/5, 64/25, 17/5}, {28/15, 784/225, 53/15}, {9/4, 81/16, 15/4},
{65/24, 4225/576, 97/24}, {20/7, 400/49, 29/7}, {63/20, 3969/400, 87/20},
{55/16, 3025/256, 73/16}, {4, 16, 5}, {56/11, 3136/121, 65/11},
{45/8, 2025/64, 51/8}, {80/13, 6400/169, 89/13}, {77/12, 5929/144, 85/12},
{36/5, 1296/25, 39/5}, {35/4, 1225/16, 37/4}, {72/7, 5184/49, 75/7},
{40/3, 1600/9, 41/3}}   *)

and for 6 + x^2 == y^2 && 12 + x^2 == z^2

sol2 = Union[{x1/x2, y1/y2, z1/z2} /. 
   Solve[(6 + (x1/x2)^2 == (y1/y2)^2 && 12 + (x1/x2)^2 == (z1/z2)^2 &&
    0 <= x1 <= a && 0 < x2 <= a && 0 <= y1 <= a && 0 < y2 <= a && 
   0 <= z1 <= a && 0 < z2 <= a) /. a -> 100, {x1, x2, y1, y2, z1, 
   z2}, Integers, Method -> Reduce]]

(*   {{1/2, 5/2, 7/2}}   *)

Seems to the the only solution.

$\endgroup$

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.