Teaser 1956: Moving the goalpost
From The Sunday Times, 12th March 2000 [link]
We have a large rectangular field with a wall around its perimeter and we wanted one corner of the field fenced off. We placed a post in the field and asked the workment to make a straight fence that touched the post and formed a triangle with parts of two sides of the perimeter wall. They were to do this in such a way that the area of the triangle was as small as possible. They worked out the length of fence required (less than 60 metres) and went off to make it.
Meanwhile, some lads played football in the field and moved the post four metres further from one side of the field and two metres closer to another.
Luckily when the men returned with the fence it was still the right length to satisfy all the earlier requirements. When they had finished erecting it, the triangle formed had each of its sides equal to a whole number of metres.
How long was the fence?
This puzzle is included in the book Brainteasers (2002). The puzzle text above is taken from the book.
[teaser1956]










Jim Randell 11:54 am on 3 December 2020 Permalink |
I thought the wording in this puzzle was a bit confusing. Moving the post 4 metres further from one side of the field is necessarily moving it 4 meters closer to another side of the field. I think we are to suppose the sides of the field are those that are used in forming the perimeter of the triangle, but in my code I considered all 8 potential positions.
If the post is at (a, b), then we can show that the minimal area triangle (made with the x– and y-axes) is achieved when the fence runs from (2a, 0) to (0, 2b). So the post is at the mid-point of the fence.
The final triangle is a Pythagorean triple with hypotenuse z, less than 60, and, if the hypotenuse passes through the point (a′, b′), then the other sides are, 2a′ and 2b′.
So we need to look for points (a, b), where a and a′ differ by 2 or 4, and b and b′ differ by 4 or 2, such that (2a)² + (2b)² = z².
This Python program runs in 46ms.
Run: [ @replit ]
from enigma import (pythagorean_triples, cproduct, Rational, printf) # choose a rational implementation Q = Rational() # consider pythagorean triples for the final triangle for (x, y, z) in pythagorean_triples(59): # and the position of the post (a1, b1) = (Q(x, 2), Q(y, 2)) # consider the original position of the post for ((dx, dy), mx, my) in cproduct([((2, 4), (4, 2)), (1, -1), (1, -1)]): (a, b) = (a1 + mx * dx, b1 + my * dy) if a > 0 and b > 0 and 4 * (a * a + b * b) == z * z: printf("({x}, {y}, {z}) -> (a1, b1) = ({a1}, {b1}), (a, b) = ({a}, {b})")Solution: The fence is 25m long.
The triangles are a (7, 24, 25) and a (15, 20, 25) triangle.
The program finds 2 solutions as we don’t know which is the starting position and which is the final position:
However, if the post is moved 2m closer to one of the axes and 4m further from the other axis, then blue must be the starting position and red the final position.
LikeLike
John Crabtree 3:30 pm on 4 December 2020 Permalink |
As shown above, the post is at the midpoint of the fence.
Let the initial sides be A and B, and the new sides be A + 8 and B – 4.
One can show that B = 2A + 10, and if the hypotenuse = B + n then A = 2n + sqrt(5n^2 + 20n),
n = 1 gives A = 7, ie (7, 24, 25) and (15, 20, 25)
n = 5 gives A = 25, ie (25, 60, 65) and (33, 56, 65)
This explains the limit on the length of the fence being less than 60 metres
BTW, n = 16 gives (72, 154, 170) and (80, 150, 170)
LikeLike