23 August 2007

The solution to the triangle puzzle

Yesterday, I asked a question:

Given a scalene right triangle with sides of integer length and perimeter P, show that there is a corresponding scalene triangle with one angle which is 60 degrees and perimeter 1.5P.

For example, the 3-4-5 triangle is a right triangle with perimeter 12; the 3-7-8 triangle has a 60-degree angle (the one opposite the side of length 7) and has perimeter 18.

As promised, here's the solution.

First, how do we check that a triangle has a 60-degree angle? We use the law of cosines. When I originally did the analysis, I assumed that larger angles of a triangle had to be opposite longer sides. This is actually only guaranted to be true for triangles in which all angles are acute (in which case it follows from the law of sines). The sixty-degree angle in a scalene triangle (for those of you who don't know the word, it just means that all three sides have different lengths) must be the second largest angle. It can't be the largest angle, because then the sum of the angles would be less than 180 degrees; similarly it can't be the smallest angle, because then the sum of the angles would be greater than 180 degrees. In the following analysis I will assume that the side opposite the 60-degree angle is the second-longest side. It turns out that we can answer the problem under this assumption;

So we're looking for triples a < c < b of positive integers, with c2 = a2 + b2 - (2 cos 60o) ab. But cos 60o = 1/2, so we need to find triples for which c2 = a2 + b2 - ab. For example, the 3-7-8 triangle is one of these; we have a = 3, c = 7, b = 8, and 32 + 82 - 2(3)(8) = 72, as you can check.

To get an idea of what the correspondence might look like, I tried to figure out which triangles with 60-degree angles corresponded to the 5-12-13 and 7-24-25 right triangles. On a bit of a wild guess, I noticed that the shortest side of the 3-4-5 and 3-7-8 triangles was the same, so I assumed that the shortest side of the triangle corresponding to the 5-12-13 would be 5. The perimeter of the triangle we seek is 45, so it has sides 5, 40-b, b. Setting up the equation above, we have

(40-b)2 = 52 + b2 - 5b

which is actually a linear equation (the b2 terms cancel), with the single solution b = 21. This gives us a 5-19-21 triangle. The same procedure applied to the 7-24-25 right triangle gives 7-37-40.

At this point I have enough data that I can try to guess what the pattern is. I remember that all primitive Pythagorean triples-- that is, triples of integers (a,b,c) such that a2 + b2 = c2, and a, b, and c don't have a common multiple -- can be written in the form

(r2 - s2, 2rs, r2 + s2)

for some r and s, with r > s, where r and s relatively prime and not both odd. The perimeter of this right triangle is 2rs + 2r2, so I sought a corresponding triangle with a 60-degree angle and perimeter 3rs + 3r2. It seems reasonable to guess that the three side lengths will be linear combinations of r2, rs, and s2.

In the case of the 7-24-25 triangle, we have r = 4, s = 3. Thus r2 = 16, rs = 12, s2 = 9. I observe that 7 = 16-9, 37 = 16 + 12 + 9, 40 = 16 + 2(12). More generally, from the general triple listed above we get

(r2 - s2, r2 + rs + s2, r2 + 2rs).

It only remains to check that these three numbers sum to 3rs + 3r2 -- they do -- and this triple, if we call it (a, c, b), obeys the relation c2 = a2 + b2 - ab; it does, but I'll spare you the algebra.

I conclude by giving the primitive Pythagorean triples with hypotenuse less than 100, and their corresponding triangles with a sixty-degree angle and one and a half times the perimeter:

If we're given a non-primitive Pythagorean triple, it's a constant multiple of a primitive one; for example, 6-8-10 is twice 3-4-5, so we get twice 3-7-8, i. e. 6-14-16. Alternatively, the triple 8-6-10 (in that order) comes from r=3, s=1; applying the formulas above gives 8-13-15. "Blinding Insight" gives a solution that's different from mine in the comments to yesterday's post, since it's based on a different parametrization; this solution gives different, but still valid, answers.

Note that this doesn't necessarily generate the triangles with a sixty-degree angle and integer sides in "primitive" form. For example, r = 5, s = 2 gives the triple (21, 39, 45) were we might hope for (7, 13, 15). Indeed, if s-r is divisible by 3, then all three sides of the sixty-degree triple will be divisible by three. Furthermore, the perimeter of the sixty-degree triple is always divisible by three, so we'll never get (7, 13, 15) in that form.


Anonymous said...

Yeah, it's a cute one. What I liked about it is how the nice rational value of $\cos(\pi/3)$ makes it an algebra problem and eliminates all that messy trigonometry.

Michael Lugo said...

Well, if cos (pi/3) weren't rational then the whole problem would be impossible. (So the superficially similar problems where 60 degrees is replaced by 30 or 45 have no solution.)

Blinding Insight said...

Isabel, My solution and yours are related by the transformation: (r,s) -> (r+s, r)

Actually, I parametrized all possible scalene-60 triples:
Read here

Anonymous said...

"So we're looking for triples a < c < b of positive integers, with c2 = a2 + b2 - (2 cos 60o) ab. But cos 60o = 1, so we need to find triples for which c2 = a2 + b2 - ab. For example, the 3-7-8 triangle is one of these; we have a = 3, c = 7, b = 8, and 32 + 82 - 2(3)(8) = 72, as you can check."

Shouldn't that be c2 = a2 + b2 - 2ab?

Michael Lugo said...


no. Go back a few lines; you see that I mention the quantity (2 cos π/3). I made the mistake of writing cos π/3 = 1, when I really meant cos π/3 = 1/2; it's the latter value that I actually go on to use.

(The post should be corrected now.)