# Enigmatic Code

Programming Enigma Puzzles

## Enigma 1198: Rightly similar

From New Scientist #2354, 3rd August 2002 [link]

George, Fred and Harry have been doodling with pencil and paper — each has drawn a right-angled triangle. The three triangles are similar — that is to say all the same shape but different sizes.

Although they are different sizes, each of the three triangles has one side measuring exactly 10 cm.  None of the other sides are integers. One of the non-integer sides of George’s triangle is the same length as one side of Fred’s, and the other non-integer side of George’s triangle is the same length as one side of Harry’s triangle.

One side of Fred’s triangle has no exact equal in the other two triangles, and the same is true of one side of Harry’s triangle. Of those two sides, Harry’s is the longer.

How much longer?

[enigma1198]

### 3 responses to “Enigma 1198: Rightly similar”

1. Jim Randell 12 October 2015 at 8:20 am

The answer is apparent with a bit of analysis.

There are three different similar right-angled triangles. Each one has a side of length 10, labelling the smallest triangle (o1, a1, h1) where o1 is the side opposite the smallest angle, a1 is the side adjacent to it, and h1 is the hypotenuse.

The triangles (from smallest to largest) are thus:

1: o1 < a1 < 10
2: o2 < 10 < h2
3: 10 < a3 < h3

The only triangle that can share non-integer sides with the other two is triangle 2, so this must be George's. And it must share o2 with a1 (a1 = o2 = x) and h2 with a3 (h2 = a3 = y). The unshared sides being o1 and h3. So Fred's triangle is triangle 1 and George's triangle is triangle 3. And we need to compute (h3o1).

In triangle 2:

o2² + 10² = h2²
⇒ x² + 100 = y²
⇒ y² − x² = 100

The following ratios are maintained:

o1 : x : 10 = x : 10 : y = 10 : y : h3

In particular:

h3 = y² / 10, o1 = x² / 10

(h3 − o1) = (y² − x²) / 10 = 100 / 10 = 10.

Solution: Harry’s unmatched side is 10 cm longer than Fred’s unmatched side.

The triangles look like this:

The 10 cm sides are shown in red. The lengths shared between Fred’s and George’s triangles are shown in green. The lengths shared between George’s and Harry’s triangles are shown in blue.

Where x = √5 − 1, we can write the lengths of the triangles as follows:

Fred: (5x ≈ 6.18, 5√(2x) ≈ 7.86, 10)
George: (5√(2x) ≈ 7.86, 10, 10√(2/x) ≈ 12.72)
Harry: (10, 10√(2/x) ≈ 12.72, 5(1 + √5) ≈ 16.18)

If we divide the lengths of the sides of the triangles by 10, so that each triangle has one side that is a unit length, then the length hypotenuse of Harry’s triangle is The Golden Ratio, φ = (1 + √5)/2.

The difference required in the answer is thus:

5(1 + √5) − 5(√5 − 1) = 5 + 5√5 − 5√5 + 5 = 10.

The smallest angle in the triangles is:

arcsin((√5 − 1)/2) ≈ 38.2°.

which is a solution of:

cos(x) = tan(x).

• Jim Randell 12 October 2015 at 8:26 am

We can also let SymPy do the maths for us.

This Python program runs in 4.38s.

```from sympy import symbols, Eq, solve
from enigma import printf

# variables
vs = (s, c, o1, a1, o2, h2, a3, h3) = symbols(('s', 'c', 'o1', 'a1', 'o2', 'h2', 'a3', 'h3'))

# equations
eqs = (

# sin
Eq(s, o1 / 10),
Eq(s, o2 / h2),
Eq(s, 10 / h3),

# cos
Eq(c, a1 / 10),
Eq(c, 10 / h2),
Eq(c, a3 / h3),

# pythogoras
Eq(s ** 2 + c ** 2, 1),

# shared sides (one of a1 = o2, h2 = a3 is implied)
Eq(a1, o2),
)

for r in solve(eqs, dict=True):
if not all(r[v].is_real and r[v] > 0 for v in vs): continue

(rs, rc) = (r[s], r[c])
printf("sin = {rs} [{rsf}]", rsf=float(rs))
printf("cos = {rc} [{rcf}]", rcf=float(rc))
rt = (rs / rc).simplify()
printf("tan = {rt} [{rtf}]", rtf=float(rt))

(ro1, ra1) = (r[o1], r[a1])
printf("Fred = (o1, a1, 10), o1={ro1} [{ro1f}], a1={ra1} [{ra1f}]", ro1f=float(ro1), ra1f=float(ra1))
(ro2, rh2) = (r[o2], r[h2])
printf("George = (o2, 10, h2), o2={ro2} [{ro2f}, h2={rh2} [{rh2f}]", ro2f=float(ro2), rh2f=float(rh2))
(ra3, rh3) = (r[a3], r[h3])
printf("Harry = (10, a3, h3), a3={ra3} [{ra3f}], h3={rh3} [{rh3f}]", ra3f=float(ra3), rh3f=float(rh3))

# solution = h3 - o1
v = (rh3 - ro1).simplify()
printf("h3 - o1 = {v} [{vf}]", vf=float(v))
```
• Hugh Casement 12 October 2015 at 12:02 pm

Great analysis, Jim.

So the five values are the geometric progression 10/φ, 10/√φ, 10, 10√φ, 10φ.
cos² α = tan² α = sin α = 1/φ = φ – 1.