Brainteaser 1108: Field fare
From The Sunday Times, 30th October 1983 [link]
The field near to our home is rectangular. Its longer sides run east to west. In the south-east corner there is a gate. In the the southern fence there is a stile a certain number of yards from the south-west corner. In the northern fence there is a stile, the same certain number of yards from the north-east corner. A straight path leads across the field from one stile to the other. Another straight path from the gate is at right angles to the first path and meets it at the old oak tree in the field.
When our elder boy was ten, and his brother five years younger, they used to race from opposite ends of a long side of the field towards the stile in that as the target. But later, when they were a little less unevenly matched, they raced from opposite stiles towards the oak as the target. Of course the younger boy raced over the shorter distances. This change of track gave the younger boy 9 yards more and the elder boy 39 yards less than before to reach the target.
The sides of the field and the distances of the oak tree from each of the stiles are all exact numbers of yards.
How far apart are the two stiles, and how far is the oak tree from the gate?
[teaser1108]
Jim Randell 8:09 am on 8 September 2020 Permalink |
If we suppose the north and south boundaries of the field are separated by a distance of a, and the stiles divide the these boundaries into sections with length x and y, and the distances from the tree to the stiles are b and c, and the distance from the tree to the corner is z. Then we have a layout like this:
When the children were younger they would run distances x and y.
And when they were older the distances are b and c.
Hence:
The distance between the two stiles, (b + c) forms the hypotenuse of a Pythagorean triangle with other sides of (y − x) = (c − b + 48) and a (triangle: S1 Y S2).
So we can consider Pythagorean triples for this triangle. One of the non-hypotenuse sides corresponds to a, and the other when added to the hypotenuse gives:
So choosing one of the sides for a, allows us to calculate the value for c, and then b, x, y, z.
The distance G S2 is the hypotenuse of the two triangles (G T S2) and (G X S2), and we can check that these hypotenuses match.
The following Python program runs in 58ms.
Run: [ @replit ]
from enigma import (pythagorean_triples, div, sqrt, printf) # consider pythagorean triples corresponding to (a, c - b + 48, b + c) for (X, Y, Z) in pythagorean_triples(1000): # choose a side for a for (a, other) in [(X, Y), (Y, X)]: # and: other + Z = 2c + 48 c = div(other + Z - 48, 2) if c is None or c < 1: continue b = Z - c x = b - 9 y = c + 39 if not (0 < b < c and 0 < x < y): continue # calculate z^2 z2 = y * y - c * c if not (b * b + z2 == a * a + x * x): continue # output solution printf("({X}, {Y}, {Z}) -> a={a} b={b} c={c}, x={x} y={y} z={z:g}", z=sqrt(z2))Solution: The stiles are 200 yards apart. The oak tree is 117 yards from the gate.
The short side of the field is 120 yards.
The long side is 230 yards, and this is split into sections of 35 and 195 yards by the stiles.
The oak tree is 44 yards from one stile and 156 yards from the other.
This puzzle appeared in the 1986 book Microteasers (p 4) by Victor Bryant, in which he deals with solving puzzles using the BBC Micro. (See: [ @EnigmaticCode ]).
Here is Victor Bryant’s BBC BASIC program (slightly modified by me to stop after the first solution is encountered, and print the run time for the program):
Here is a Python program using the same approach. It takes 65ms to find the first solution, or 137ms to run to completion. (On an emulated BBC Micro Victor’s program takes about an hour to run to completion).
from enigma import (irange, subsets, is_square, printf) for (b, c) in subsets(irange(25, 500), size=2): a = is_square((c + 39)**2 - c**2 + b**2 - (b - 9)**2) if a is None: continue if a**2 + (c - b + 48)**2 != (b + c)**2 : continue printf("a={a} b={b} c={c}") breakComparing internal runtimes we find that my program runs in 2.4ms (to completion), and the port of Victor’s program in 17.3ms (to first solution; 219ms to completion). They search a similar solution space, (i.e. distance S1 S2 less than 1000 yards).
LikeLike
Jim Randell 3:08 pm on 14 September 2020 Permalink |
Here’s my analytical solution:
We have:
and
Now, c is an integer, so z²/39 is an odd integer:
and:
and: c > b > 9, so k > 29.
Also, we have:
So: b > 24 ⇒ k > 44.
And:
As k → ∞, b → 87/2 = 43.5, so: b ≥ 44 and k ≤ 175.
This gives us a limited range of values for k, which we can check:
from enigma import (irange, div, is_square, sqrt, printf) # consider possible values for k for k in irange(45, 175): # calculate a, b, c, x, y, z c = k - 19 b = div(87 * k + 219, 2 * k + 1) if b is None or not (0 < b < c): continue a = is_square(4 * (b - 24) * (c + 24)) if a is None: continue x = b - 9 y = c + 39 z = sqrt(78 * k + 39) if not (0 < x < y): continue # output solution printf("[k={k}] a={a} b={b} c={c}; x={x} y={y} z={z:g}")Or we can narrow down the values with further analysis:
Now:
and so:
The value of (2k + 1) is in the range 91 to 351, so the (39 / (2k + 1)) part, must contribute pairs of factors (which divide into the pairs of factors provided by the [2(k + 5)]² part).
So (2k + 1) is some odd square multiple of 39 (which also means that z must be an integer).
The only option in the required range is:
LikeLike
John Crabtree 6:11 am on 9 September 2020 Permalink |
(b + c)^2 = a^2 +(y – x)^2
a^2 + x^2 = b^2 +z^2
y^2 = c^2 + z^2
Adding the three equations and simplifying gives bc + xy = z^2
But z^2 = 39(2y – 39) = (39k)^2
And so y = 39(k^2 + 1)/2
Using b = x + 9 and c = y – 39, leads to x = 69/2 + 9/(2.k^2)
For integral solutions, either k = 1 and then x = y = z = 39 which is invalid,
or k = 3, x = 35, y = 195 and z = 117, etc with a = 120 as a check
LikeLike
John Crabtree 4:08 am on 10 September 2020 Permalink |
I should have included: a = 39k + 9/k = z + 9/k
LikeLike
Frits 10:37 am on 10 September 2020 Permalink |
Nice solution, I checked your equations.
I think you have to proof k (and z?) is an integer
before only only considering k=1 and k=3.
fi, k = 3^0.5 would also lead to an integral solution for x.
We only know for sure that a, b, c and x,y are natural numbers.
LikeLike
John Crabtree 4:02 pm on 11 September 2020 Permalink |
Frits, thank you. I had assumed that z was a whole number, which we are not told. We also need to consider a, =(2y -30)/k before determining possible values of k. y is a whole number, and so k must be rational, = n/m. But then for y to be a whole number, m= 1, and so k is an integer.
I think that this makes the manual solution, which should exist, complete.
LikeLike
Frits 11:31 pm on 12 September 2020 Permalink |
Hi John,
Unfortunately some of your text was lost during formatting. I can follow the logic if (2y -30)/k equals an integer expression. What formula or variable did you intend to use as left hand side of ” (2y -30)/k”?
I now used opening and closing pre tags for this section.
LikeLike