This header plots the critical line of the Riemann Zeta Function.  A complete understanding wins a \$1,000,000 prize.
 . . .
 Main Links Orders Post Next Page Next + 10

Bob's Brash and Unsubstantiated Claim
by Bob Harris

All rational triangles with a shared angle can be expressed via a single value, k.

Let's examine the angle opposite 3 in a 3-2-4 triangle.  This angle has cos = 11/16.

I claim than the triangle b-a-1, with all sides rational, has the same angle opposite a.  a and b are defined, for any rational value k (except 1), by the rational functions

3   2k^2 - k + 2
a = - * ------------
8      k^2 - 1

1   4k^2 + 12k - 7
b = - * --------------
8      k^2 - 1

There are some exceptional cases where the formula produces sides with negative lengths, or a+b = 1.  I don't quite understand why yet.  But some exploration with a spreadsheet shows that for k>1, the triangles are all valid.

For example, let k = 5/2.  This gives a = 6/7 and b = 8/7 (and c = 1). Scaling up by 7, we get a' = 6, b' = 8, c' = 7.

For another example, let k = 19.  This gives a = 47/64 and b = 37/64 and a 47-37-64 triangle.

k = -46/19 produces a = 12240/14040, b = 2880/14040, and these reduce to 34/39 and 8/39, yielding the 8-34-39 triangle.

If you know the triangle, it's easy to find k.  k = (b-b')/(a-a'), so for the 3-38-40 triangle, a = 38/40, b = 3/40, and we get k = -17/8. Plugging this back into the formula produces a = 1710/1800, b = 135/1800, which reduce to 38/40 and 3/40.  If we flip the triangle around the other way, 40-38-3, we get k = 14/13.

General case

We are given a triangle with integer sides d, e, and f, and we want to find other integer triangles which contain the same angle as that opposite d.

Let's define q, the cosine of the angle of interest, which by the law of cosines is

e^2 + f^2 - d^2
q = ---------------
2ef

Also, for reasons that may become clear later, we'll define

d                 e
a' = -     and    b' = -
f                 f

The triangle with rational sides a', b', and 1 is similar to the d, e, f triangle.

Finding the Rational Triangles

Now consider a general rational triangle with sides a, b, and 1 (a and b are rational), for which the angle opposite a is our desired angle.  Then

b^2 + 1 - a^2
------------- = q
2b

So

a^2 - b^2 + 2bq - 1 = 0            (1)

We already know one solution to (1), namely a=a', b=b'.

Note that we can easily convert any rational triangle to an integer triangle.

[The next steps apply the method of Diophantus described in "Diophantus and Diophantine Equations", Isabella Grigoryevna Bashmakova, ISBN 0-88385-536-7, published by the Mathematical Association of America, pages 29-30]

Let's recast the problem into two other rational variables.  Define rationals t and k by

t = a - a'             (which means a = a' + t)

and

b - b'   b - b'
k = ------ = ------    (which means b = b' + kt)
a - a'     t

Substituting into (1), we get

a'^2 + 2a't + t^2 - b'^2 - 2b'kt - (k^2)t^2 + 2b'q + 2ktq - 1 = 0

=>  (a'^2 - b'^2 + 2b'q) + (1 - k^2)t^2 + 2(a' - b'k + qk)t - 1 = 0

Recalling that a'^2 - b'^2 + 2b'q = 1, this gives us

(1 - k^2)t^2 + 2(a' - b'k + qk)t = 0

So either t is zero (which we reject), or

2(a' - b'k + qk)
t = ----------------
k^2 - 1

From the definitions of t and k, we then find that

a'k^2 + 2(q - b')k + a'
a = -----------------------
k^2 - 1

and

(2q - b')k^2 + 2a'k - b'
b = ------------------------
k^2 - 1

Since we know a', b', and q, we are free to choose rational values of k, and (with a few exceptions) these will give us rational triangles with sides a, b, 1.

An Example

Consider the 3, 2, 4 triangle, and the angle opposite 3.  It has cosine q = 11/16, a' = 3/4, and b' = 1/2.

So a general solution is provided by

3       3     3
- k^2 + - k + -
4       8     4   6k^2 + 3k + 6
a = --------------- = -------------
k^2 - 1        8(k^2 - 1)

and

7       3     1
- k^2 + - k - -
8       2     2   7k^2 + 12k - 4   (k + 2)(7k - 2)
b = --------------- = -------------- = ---------------
k^2 - 1         8(k^2 - 1)        8(k^2 - 1)

For example, with k = 2, we get

36          48
a = --  and b = --
24          24

which simplifies to an interger triangle with sides 3, 4, and 2 (our original with two sides swapped).

For k = 2.5 (remember, k is rational, not just an integer), we get

51   68             69.75   93
a = -- = --   and   b = ----- = --
42   56              42     56

which produces a triangle with sides 68, 93, and 56.

Since k is rational, we can express it as n/d for integers n and d.  This changes the formula to a little more convenient form:

6n^2 + 3nd + 6d^2             (n + 2d)(7n - 2d)
a = -----------------   and   b = -----------------
8(n + d)(n - d)               8(n + d)(n - d)

Things I Don't Comprehend Yet (but haven't looked at too deeply)

Not all values of k produce valid triangles.  Obviously k = +/- 1 is a problem, since the denominator is zero.  Some other values produce negative or zero results for a and or b, as well as values for which a+b is less than 1.  This is not surprising, since we're finding solutions to a^2 - b^2 + 2bq - 1 = 0, not just sides of triangles.

What I can't figure out, though, is what range of k is legitimate.  For the example problem, it seems to be any k outside the close range -2 through +1.  In other words, k < -2 is ok, and k > 1 is ok.  k = -4 produces our original triangle.

The postive values of k seem to produce pairs with b > a.  The negative values produce pairs with a > b.

According to the book about Diophantus, this technique should produce *every* rational solution.  I don't know how to prove that.  It also might be true that was k sweeps through the legal values, no solution is produced more than once.

Other Things I Noticed

For large values of k, the ratio of a to b will be nearly constant.  [Ed -- This really doesn't mean much.  In the range k = 1/2 to 1, an infinite number of different rational triangles will be produced, all leading to wildly different integer triangles]

More Thoughts

Don't be too amazed.  If I hadn't happened to buy that Diophantes book on sale (I think) from MAA about a year ago, I couldn't have solved this.  It's an odd book, a mixture of history and a little bit of math.  The only reason I happened to think of this was, in reading Bill Daly's work, it looked like might have been using a similar technique.  I'm not sure if he was, but that's what caused that spark for me.

You should look at the graph of a vs. b-q for a,b,1 triangles with a desired cosine q (here a and b are real numbers).  b^2 + 1 - a^2 = 2bq  becomes a^2 - (b-q)^2 = 1 - q^2.  I didn't know it, but that's the formula for a hyperbola.  So all my solution does (and this is straight from the book) is you know one point on the hyperbola (from the triangle we started with) and run a straight line with slope k through that point.  Where it intersects the hyperbola again is the other solution generated by k.

k = -46/19 produces a = 12240/14040, b = 2880/14040, and these reduce to 34/39 and 8/39, yielding the 8-34-39 triangle.

Turns out if you know the triangle, it's easy to find k.  k = (b-b')/(a-a'), so for the 3-38-40 triangle, a = 38/40, b = 3/40, and we get k = -17/8. Plugging this back into the formula produces a = 1710/1800, b = 135/1800, which reduce to 38/40 and 3/40.  If we flip the triangle around the other way, 40-38-3, we get k = 14/13.

This exercise provides the seed of a proof that any rational solution will be produced by the formula.  Suppose there is some rational solution (a,b). Certainly k = (b-b')/(a-a') is rational (as long as a isn't equal to a'). And we know that for any rational k we get a rational solution.  I think this also implies that the solutions produced are unique, except for each triangle being produced in two orientations.

There's still the issue of what range of k should be swept through to generate all solutions (well, we can't generate all, because there are an infiinity of them).  For the 3-2-4 triangle, it appears that k<-2 and k>1 must be swept through.  I don't think that -2 and 1 are intrinsic to the problem-- I think they resulted from my use of 3-2-4 as my starting point, and that choosing another starting point for the same angle (e.g. 3-38-40) would give me a different forumula and a different range of valid k.

I'm not sure this method helps much in exhaustively finding *small* solutions.  For example, if you wanted to find all solutions with sides smaller than 1000, you'd still have to search all k's regardless of denominator, since you can't tell when, with some k's denominator of order 1000000, you'd come up with a result where just about everything factors out.

I had previously mentioned that all the k<-2 solutions had a>b.  This is not true.  At k = -10, a=b (an isosceles solution), and for k<-10 we seem to have a<b solutions.

(You probably already mentioned this on your site).  I also discovered that you can generally produce an isosceles solution for one of these angles.  If the cosine is q, then a=1/2q makes an a-a-1 triangle.  Of course a has to be greater than 1/2, but I think that is the same as saying the target angle was less than 90 degrees.

Another improvement to this is, since k is rational, replace it by n/d (n, and d being integers).  I was surprised that the formula stays so similar. And I found that some factoring can be done.

3   2n^2 - nd + 2d^2     3   2n^2 - nd + 2d^2
a = - * ----------------   = - * ----------------
8      n^2 - d^2         8     (n-d) (n+d)

1   4n^2 + 12nd - 7d^2   1   (2n-d) (2n + 7d)
b = - * ------------------ = - * ----------------
8      n^2 - d^2         8     (n-d) (n+d)

Another insight:  for any value of k, the ratio of a to b is

a   6k^2 - 3k + 6
- = --------------
b   4k^2 + 12k - 7

and so for large values of k, the ratio approaches the constant 1.5.  That means if you look at all the integer triangles that have this angle, 'most' of them are very similar (in the english use of the word), and are nearly similar (in the geometric use of the word).