# Enigmatic Code

Programming Enigma Puzzles

## Enigma 1329: Height of ignorance

From New Scientist #2488, 26th February 2005

A friend asked Joe, a keen rugby player, how high rugby goal posts were. Joe had no idea. So he went to the local club with two gadgets he’d made, one to measure the angle from ground level up to the top of a goal post and the other, a large pair of dividers, to measure distance.

He set the dividers to a standard distance. Then he walked 10 standard distances in a straight line from one goalpost and measured the angle to the top of the post. As a check, he walked on the same distance in the same direction and measured the angle again. Just to be certain his calculation would be correct, he walked on the same distance in the same direction and measured the angle for a third time. In calculating the height of the post Joe was surprised to find that the sum of the three angles equalled one right angle.

What was the height of the goalpost in standard distances?

[enigma1329]

### 6 responses to “Enigma 1329: Height of ignorance”

1. Jim Randell 26 April 2014 at 8:35 am

Here’s a numerical solution using the find_value() function from the enigma.py library. It runs in 39ms.

```from math import atan2, radians
from enigma import find_value, printf

# given the height of the goal posts find the sum of the angles
def angle_sum(h):
return atan2(h, 10) + atan2(h, 20) + atan2(h, 30)

# find when the angle sum is 90 degrees
r = find_value(angle_sum, radians(90), 0, 1000)

# the result
printf("goalpost height = {r.v:.3f}")
```

Solution: The goalposts have a height of 10 standard distances.

• Jim Randell 26 April 2014 at 8:40 am

Analytically we can use the equality:

atan(u) + atan(v) = atan(u + v, 1 – uv)

to derive:

atan(a) + atan(b) + atan(c)
= atan(a + b, 1 – ab) + atan(c)
= atan((a + b) + (1 – ab)c, (1 – ab) – (a + b)c)
= atan(a + b + c – abc, 1 – (ab + ac + bc))

so the sum of the angles in the puzzle is:

atan(h, 10) + atan(h, 20) + atan(h, 30)
= atan(11h/60 – h^3/6000, 1 – h^2/100)
= atan(h(1100 + h^2), 60(100 – h^2))

and this is 90 degrees, so the second argument to atan() must be zero:

100 – h² = 0
h² = 100
h = 10 (h > 0)

Or you can just plug it into Wolfram Alpha [ http://www.wolframalpha.com/input/?i=arctan%28h%2F10%29+%2B+arctan%28h%2F20%29+%2B+arctan%28h%2F30%29+%3D+90%C2%B0 ].

• Jim Randell 26 April 2014 at 11:19 pm

We can also consider the complex numbers:

z1 = d + ih, z2 = 2d + ih, z3 = 3d + ih

where d is the initial distance from the goalposts, and h is the height of the goalposts.

The arguments of these complex numbers are the angles measured, so:

arg(z1) + arg(z2) + arg(z3) = 90°

And using the equality:

arg(z1) + arg(z2) + arg(z3) = arg(z1 z2 z3)

We see that the complex number:

z1 z2 z3

must have no real component.

The product of the numbers is:

z1 z2 z3 = (d + ih)(2d + ih)(3d + ih) = 6d(d2 – h2) + ih(11d2 – h2)

Hence:

Re[z1 z2 z3] = 6d(d2 – h2) = 0
⇒ (d2 – h2) = 0
⇒ (d + h)(d – h) = 0
⇒ d = h

So the height of the goalposts is the same as the distance from the goalposts in the first measurement. i.e. 10 standard distances.

• arthurvause 27 April 2014 at 11:04 pm

Very elegant, as complex number solutions often are in comparison to trig solutions.

The related puzzle that I mentioned has a one line solution using complex numbers:
(3+i)(2+i)=5(1+i)

2. arthurvause 26 April 2014 at 2:54 pm

This reminds me of a related puzzle that I came across a few years ago. Here is a blog entry that describes it.

3. geoffrounce 26 April 2014 at 3:56 pm

This programme finds the goalpost height and the three angles in degrees.

```from math import atan, pi
# h is height of goalpost

for h in range(1,100):
ang1 = ang2 = ang3 = 0
#convert angles to degrees
ang1 = atan(h/10) * (180/pi)
ang2 = atan(h/20) * (180/pi)
ang3 = atan(h/30) * (180/pi)
total = ang1 + ang2 + ang3
if abs(total - int(total)) < 0.00001:
print('height = {}, Angle1= {}, Angle2= {}, Angle3 = {}'
. format(h,ang1,ang2,ang3))

```