Point in a square - Solution

Let a square ABCD and a point P inside the square.
Given a = PA = 19, b = PB = 29, c = PC = 23

Relation between a,b,c,d

Let t the side of the square and x,y coordinates of P
(1) a² = x² + (t-y)²
(2) b² = x² + y²
(3) c² = (t-x)² + y²
(4) d² = (t-x)² + (t-y)²
adding a² and c² together on the one hand, adding b² and d² on the other hand, we get :
a² + c² = x² + (t-y)² + (t-x)² + y²
b² + d² = x² + y² + (t-x)² + (t-y)² hence :

 a² + c² = b² + d²

Note. This relation is true in any rectangle ABCD with sides u and v :
a² + c² = b² + d² = x² + (v-y)² + (u-x)² + y²

Value of PD ?
d² = a² + c² - b² = 19² + 23² - 29² = 49, d = 7
This being possible only if a² + c² > b²

Side of the square

substracting (3) - (2), we get c² - b² = t² - 2tx, that is :
x = (t² - c² + b²)/2t
Similarily, substracting (1) - (2) : y = (t² - a² + b²)/2t
Substituting x and y into (2) :
(t² - c² + b²)² + (t² - a² + b²)² = 4b²t², and equation :

 2t4 - 2(a²+c²)t2 + (b² - c²)² + (b² - a²)² = 0

This equation can take other forms as a² + c² = b² + d² :
exchanging b and d, or (a,c) with (b,d), or a and c.
With a=19, b=29, c=23 (and d=7), we get : 2t4 - 2×890 t2 + 327744 = 0
whose solutions are : t = √( 445 ± √34153 )
that is t = 25,095922... and t = 16,130551...
Only the largest value results in a point P inside the square.

Condition for existence is (a²+c²)² - 2(b² - c²)² - 2(b² - a²)² > 0, and could also be written (a²+c²-2b²)² < 4a²c², hence :

 |a - c| < b√2 < a+c

For P to be inside the square, 0<x<t and 0<y<s
Using values of x and y results into :
0 < (t² - c² + b²)/2t < t, that is 0 < t² - c² + b² < 2t², or |b² - c²| < t²
And similarily for y.

 |b² - c²| < t²   |b² - a²| < t²
With the numeric given data : t> √480 = 21,9089...

Geometric construction

Constructing the fourth distance given the 3 others is easy :
Construct a right triangle with sides a and c, then its circumscribed circle (with diameter PQ). Construct M with PM = b.

By swapping the vertices, we can set for the sequel : a > (b,c,d) and b > d,
Because of the relation between a,b,c,d that means : a > b > d > c

look at construction from given a,b,c.
The vertices ABC build an isosceles right triangle, with B being the right angle. Vertex A is deduced from C by rotating -π/2 with center B. Hence the construction :
With P as center, draw circles (A), (B),(C) with radii a, b, c.
We can then fix B anywhere on circle (B).
The locus of A is (A). But the locus of A, which is image of C, is the image (C') of (C) by rotating -π/2 with center B. Let's then draw this circle (C'). A is then the intersection point of (A) and (C').
C is deduced from A by rotating +π/2, then complete the ABCD square.

There are two solutions A1 and A2. Only the largest BA1 may result into point P inside the square.

Discussion

For existence of A, circles (A) and (C') must intersect. that is, as PM=b√2,
a-c<b√2<a+c we find the same as the analytic condition.

Ensuring P is inside the square is equivalent (after rotating by -π/2) to compare position of M and angle BAx.
Angle BAM should be less than π/2, that is A outside the circle with diameter BM. A should also be abovee BM.
First condition is a> PF, second one is a<PH
That last condition is more restrictive than the mere existence condition a<b√2+c because it could be written
a²<b²+(b+c)² = 2b² + c² + 2bc as compared with 2b² + c² + 2bc√2

Calculating PF is harder.
In right triangle BMF : BF² = b² - c² and sin(α) = c/b
In triangle PBF :
PF² = b² + BF² -2b.BF.cos(π/2 -α)= 2b² - c² -2c√(b² - c²)

Hence :

 { 2b²+c²-2bc√2, 2b²-c²-2bc√(1-c²/b²) } < a² < 2b²+c²+2bc

Finding squares with integral a,b,c,d

Look first of all at integer solutions of a² + c² = b² + d²
If (a,b,c,d) is a solution, (ka,kb,kc,kd) is also solution. We care then only of solutions with GCD(a,b,c,d) = 1.
N = a² + c² = b² + d² should then be written in at least two ways as sum of two squares. It is known (Fermat) that N is sum of two squares if and only if exponents of prime factors of the form 4k+3 in N are even.
Studying decompositions of N as sum of two squares is easier by using Gauss integers Z[i], in the form u+iv.
Then the 4k+3 primes are also primes in Z[i], hence a 4k+3 prime factor in N should divide a,b,c and d. Similarily 2 = -i(1+i)² is specific, and if exponent of 2 is even, 2 divides a,b,c,d.

Search of N being sum of two squares in at least two ways N = a² + c² = b² + d²
with GCD(a,b,c,d)=1 is restricted to the set of numbers in the form N = 2n.∏pimi
with all prime factors pi being of the form 4k+1 : 5, 13, 17, 29...
4k+3 prime factors (3, 7, 11, 19...) being excluded, and exponent of 2 being n=0 or 1.
Number of decompositions of N as sum of two squares is d(N)=[(1+∏(mi+1))/2], with [x] = integer part of x (floor function).
There are at least two decompositions if d(N) ≥ 2, that is ∏(mi+1) ≥ 3, hence ∑mi ≥ 2
In these are counted the uninterresting decomposition p² = p² + 0²
Squares of 4k+1 primes should then be excluded.
Doubles of these squares, giving the decomposition 2p² = p² + p², also uninterresting, will also be excluded.
First candidate is then N = 5*13 = 65 = 8² + 1² = 7² + 4²
then 5*17, 2*5*13, 5*29 ...
For every found pair of decomposition of N, remains to check the geometric conditions.

 5*13 = 65 = 8² + 1² = 7² + 4² rejected, no solution (a+c
Because (t.√2)² > a² > (a²+c²)/2 = N/2 We need to check only the values for N < 4t² = 237,14...
All other values of N result into t > 7,699702
The smallest solution is then :

 9² + 2² = 7² + 6²   t = √( (85+√1127)/2 ) = 7,6997019638...

For side t to be also an integer, this problem is conjecture to be impossible.