In this figure with two non-congruent equilateral triangles and three-fold rotational symmetry the distance between any two of the 6 vertices is an integer. Can you give a solution?

I know only one essential solution (the GCD of the distances should be 1). If the two triangles are congruent the problem is much easier and there are many essentially different solutions.

enter image description here

  • 1
    $\begingroup$ Herbert welcome to Puzzling! Good to see you here. $\endgroup$ Feb 8, 2021 at 10:08
  • $\begingroup$ Zl svefg vafgvapg jnf gb fgneg purpxvat cnvef bs Rvfrafgrva vagrtref, ohg V'z ortvaavat gb jbaqre vs fbyivat gur Qvbcunagvar rdhngvbaf zvtug unir orra n orggre ebhgr nsgre nyy... $\endgroup$ Feb 9, 2021 at 19:08
  • 1
    $\begingroup$ @Zomulgustar You should generally let people know when a comment is using (rot13) for spoilers - not everyone knows what it is. $\endgroup$
    – Deusovi
    Feb 9, 2021 at 20:22
  • 1
    $\begingroup$ Thanks for the reminder, would edit if I could. A third path is looking more promising anyway, if I have time to code it up before someone beats me to the punch. ^_^ $\endgroup$ Feb 9, 2021 at 20:41
  • $\begingroup$ Just to make sure I'm not brute-forcing in an inappropriate way (other than the traditional not bringing enough), would it be fair game to ask how many bits I'd need to express the sum of all fifteen edges in your integer solution? $\endgroup$ Feb 11, 2021 at 6:00

3 Answers 3


One solution thus far: 323,392, and 645 for the distances between points of different triangles (red), 407 and 713 for the equilaterals' edge lengths. The two triangles are rotated relative to each other by arccos(421/1147)

After briefly checking pairs of Eisenstein integers (and even more briefly looking in horror at the prospect of solving the Diophantine equations analytically), I decided to force three of the five lengths to rational by iterating over integer triangles of increasing perimeter, using one edge for one of the equilateral triangles, and the remaining vertex to locate a corner of the other equilateral. Then, using the law of cosines and sagemath's complex numbers, I solved for the locations of the remaining points and the two remaining distances directly. I think I was using a few too many unexpected steps for the symbolic processor to handle (it didn't report back sqrt(49) as a rational) so I used complex double precision...I didn't dare use less as there were some amazingly close misses for such small integers. For example, plugging in 54,146 for the two red sides and 140 for the black equilateral edge gives 186.999999078213 and 198.999999133798 for the other two lengths.

I actually stopped my search just shy of the first success, figuring 1000 as a perimeter of the smallest red-red-black triangle was as good a time to optimize as any. Using the identity recently mentioned below (sum of squares of red edges=sum of squares of triangle lengths) didn't require any non-integer math at all, so I built a lookup table of sums of distinct nonzero squares and switched to forcing the three red edges to integers, culling the overwhelming majority of cases without having to invoke complex math. Also, I recognized that the three triangles formed with two red edges and one of the equilateral legs had an exploitable relationship: of the three angles where two red edges meet, two of them sum to the third. Three acos calls were still a lot faster than solving for all the points, and filtered out even more candidates, so cross-checking my results up through 1000 only took a few minutes now. I finally pushed past 1000 and found the above pentad shortly thereafter. Code available upon request, but it's pretty messy :p Now to use the resulting value of t to make sure it satisfies WhatsUp's Diophantine eq. below.... the rotation angle yields a t of +/- 28/11, which mercifully seems to check out 'by hand'.

Per their suggestion, I really would like to see what the professionals at mathoverflow can do with this. Is there some reason why there seem to be more 'near misses' than a uniform distribution of sums of square roots would suggest? Is there anything else special about this solution, which might suggest where to look for others? I eyeballed the ratio of the larger and smaller triangles to be suspiciously close to a relevant irrational, but looking closer reducing the larger a few steps would be a better approximation.

  • $\begingroup$ Perfect! It is exactly the same solution I found. My approach was almost the same as yours, with only subtle differences. I give details of my approach in another post. $\endgroup$ Feb 12, 2021 at 10:41

This is not a complete answer, but a mathematical analysis of the problem.

Since we can scale the graph, we may look for solutions in rational numbers rather than in integers.

Without loss of generality, we may assume that one triangle has side length $1$. If we let $a$ be the side length of the other triangle and let $\theta$ be the angle of rotation between them, then we are facing the following conditions:

\begin{eqnarray} \frac 1 3 \left(1 + a^2 - 2a\cos \theta\right) &\in& \Bbb Q^2\\ \frac 1 3 \left(1 + a^2 - 2a\cos (\theta + \frac {2\pi} 3)\right) &\in& \Bbb Q^2\\ \frac 1 3 \left(1 + a^2 - 2a\cos (\theta - \frac {2\pi} 3)\right) &\in& \Bbb Q^2\\ \end{eqnarray}

These conditions implie that $\cos \theta$ and $\cos(\theta \pm \frac {2\pi}3)$ are all rational numbers.

It is easy to parametrize the possible values of $\cos \theta$ fulfilling the above condition.

If we write $c$ for $\cos \theta$ and $s$ for $\sin \theta$, then the conditions are: \begin{eqnarray} c &\in& \Bbb Q\\ -\frac 1 2 c \pm \frac {\sqrt 3}2 s &\in& \Bbb Q\\ c^2 + s^2 &=& 1 \end{eqnarray} Writing $d = s /\sqrt 3$, we are simply looking for $c, d \in \Bbb Q$ such that $c^2 + 3d^2 = 1$.

A standard procedure (projecting from the point $(c, d) = (1, 0)$) then gives us $c = \frac {t^2 - 3}{t^2 + 3}$ for some $t \in \Bbb Q$.

Therefore, the original conditions translate to the following diophantine equation: \begin{eqnarray}\tag{*} 1 + a^2 - a\cdot \frac{2t^2 - 6}{t^2 + 3} &=& 3u^2\\ 1 + a^2 - a\cdot \frac{-t^2 + 6t + 3}{t^2 + 3} &=& 3v^2\\ 1 + a^2 - a\cdot \frac{-t^2 - 6t + 3}{t^2 + 3} &=& 3w^2\\ \end{eqnarray} We want to find rational solutions $(a, t, u, v, w)$ (with some conditions) to this group of equations.

This is, of course, an algebraic surface. I have almost no knowledge about rational points on a general algebraic surface, especially such a complicated one.

I would be very much impressed if the OP has a complete answer to this question. And I think the question is probablly more suitable for the MathOverflow site.

Below I give some observations.

If we put $a = 1$, then we cut out a curve on the surface. This curve is very special:

\begin{eqnarray} \frac{4}{t^2 + 3} &=& u^2\\ \frac{(t - 1)^2}{t^2 + 3} &=& v^2\\ \frac{(t + 1)^2}{t^2 + 3} &=& w^2\\ \end{eqnarray} The mapping $(t, u, v, w)\mapsto (t, 2/u)$ then gives (up to irreducible components) a birational equivalence of this curve with the curve $x^2 + 3 = y^2$, which is again birationally equivalent to the projective line.

This implies that there are infinitely many rational points on this curve, which can be given by explicit formulas with one rational parameter.

However, these are the solutions that the OP excludes.

For any fixed (positive) $a\neq 1$, each single equation in $(*)$ becomes a curve of genus $1$, i.e. it is (geometrically) an elliptic curve. This suggests that rational points might be very rare, as we are looking for a value of $t$ that simultaneously gives three rational points on three elliptic curves.

However, this is just a heuristic argument and might not be true. For example, if we replace $3u^2, 3v^2, 3w^2$ with $u^2, v^2, w^2$, then there are indeed many more rational points away from $a = 1$. My guess is that they come from another rational curve on the surface.

The final conclusion of this answer is that this problem is too difficult for me, as I don't have enough knowledge to solve it. I also have no idea what are the known results on this subject (if this is posted on the MathOverflow site, then we can expect experts telling us the state of art).

Of course, the OP only asks for one non-trivial rational point (which in some sense becomes a programming task). But as stated above, I would be very impressed if one can actually determine all the rational points, or obtain any non-trivial interesting results.

  • 1
    $\begingroup$ Thank you very much for this analysis which gives me new insights to the problem. I can confirm your set of diophantine equations and have transformed my solution to a rational tuple (a,t) which indeed then gives rational u, v and w, which are the lengths of the red lines above if the outer triangle is scaled to edge length 1. I agree that it would be very interesting to know something more about the solution space in general. My knowledge about elliptic curves is more or less zero. $\endgroup$ Feb 10, 2021 at 2:14
  • 1
    $\begingroup$ The solution I found using integers and not rationals nevertheless has distances small enough and can be found just by brute force in an appropriate way. $\endgroup$ Feb 10, 2021 at 14:00
  • 1
    $\begingroup$ $a$ is, by definition, the side length of one of the given triangles, hence it belongs to "distance between any two of the $6$ vertices". $\endgroup$
    – WhatsUp
    Feb 11, 2021 at 2:09
  • 2
    $\begingroup$ Btw., from your equations (*) we get the remarkable relation u^2 + v^2 + w^2 = a^2 + 1, but I do not see in the moment how this could be exploited. $\endgroup$ Feb 11, 2021 at 19:37
  • 1
    $\begingroup$ @HerbertKociemba This is not surprising, as the sum of $\cos \theta$ and $\cos (\theta \pm \frac{2\pi}3)$ is zero, for any $\theta$. $\endgroup$
    – WhatsUp
    Feb 11, 2021 at 22:07

Let c be the edge length of the "outer" equilateral triangle t. We then iterate over all triangles t_i with integer edge lengths a,b and c such that the t_i share edge c with t, and the third vertex C_i of the t_i is in the same half-plane as the center of t. We demand the C_i also to be inside of the circumscribed circle of t. For the sake of simplicity I iterate
a from 1 to c and
b from Max(a,c-a+1) to Min(c+a-1,Floor(2c/Sqrt(3)))
and sort out invalid triangles (which include for example the cases where C_i is on the circumscribed circle) later. C_i is a potentiell vertex of the "inner" equilateral triangle. Two of the three red lines in the picture of the puzzle description now already have integer lengths, namely a and b. We are done if

  1. The distance d from C_i to the third edge of t is an integer.
  2. The edge length e of the "inner" equilateral triangle - which is uniquely determined by C_i - is an integer.

Now with Mathematica I was able to derive two nice formulas for d and e as a function of a, b and c. With ta(a,b,c)=(a+b+c)(a+b-c)(a-b+c)(-a+b+c) (which is closely related to the area of the triangle by the Heron formula) we get \begin{eqnarray}\ d=\frac{\sqrt{-\sqrt{3} \sqrt{\text{ta}(a,b,c)}+a^2+b^2+c^2}}{\sqrt{2}}\\ e=\frac{\sqrt{-\sqrt{3} \sqrt{\text{ta}(a,b,c)}+3 a^2+3 b^2-c^2}}{\sqrt{2}} \end{eqnarray}
These formulas show that the squarefree part of ta(a,b,c) necessarily has to be 3. This is an extreme restriction and sorts out almost all possible (a,b,c) tuples. Nevertheless prime factorization of ta(a,b,c) and determining the squarefree part seems not to be faster than straight checking d and e for being integers from a practical point of view.

Iteration in Mathematica is relatively slow. So I decided to write a small program in Delphi using floating point numbers, took some care to not omit results by rounding errors and just checked the few possible candidates with Mathematica. Up to c=1000 this takes less than a second, up to c=2000 less than 8 seconds. The only triples with GCD(a,b,c)=1 found were

(323,645,713) with d=392, e=407 and (392,645,713) with d=323, e=407 which both represent the same solution: Outer triangle edge lengths 713, inner triangle edge lengths 407, distances between the two triangles 323, 392 and 645.

I ran a modified program up to c=40000 and found no new solutions under the restriction that |a-b| and |b-c| are not both <5. This restriction was necessary due to rounding problems with big triangle sizes.
I see no reason why the found solution should be unique so it would be nice if another solution could be found!


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.