Can I get some example coordinates of an equilateral triangle, but only integers?
I'm trying to implement Bresenham's Circle drawing algorithm and I intend to draw a circumscribed and inscribed circle (circumcircle and incircle) in a triangle. I need some simple ways to find coordinates of an equilateral triangle to test my code.
Any help will be appreciated. Thanks.
$\endgroup$ 25 Answers
$\begingroup$Unfortunately, the coordinates of the vertices of an equilateral triangle can't all be integers. As dxiv pointed out, this is because $\sqrt 3$ is irrational. If it doesn't have to be exactly equilateral, you could have e.g. circumcentre (0, 0), radius 5, points $(0, 5), (\pm 4, -3)$. The angles are about $73.7^\circ, 53.1^\circ, 53.1^\circ$. A triangle which is closer to being equilateral has circumcentre $(0, 0)$, radius 89 and points $(0, 89)$, $(\pm 80, 39)$. The angles are about $64^\circ, 58^\circ, 58^\circ$.
If the circumcentre's coordinates don't have to be integers, then there are triangles with lower integer coordinates which are better approximations to equilateral triangles, e.g. where the vertices' coordinates are $(0, 0), (x, y), (y, x)$ where $\frac{y}x\approx \arctan \frac{\pi}{12}$, e.g.
- $(4,1)$ with angles $62^\circ, 59^\circ, 59^\circ$
- $(15,4)$ with angles $60.137^\circ, 59.931^\circ, 59.931^\circ$
- $(56,15)$ with angles $60.010^\circ, 59.995^\circ, 59.995^\circ$
Here's a proof that if a triangle's vertices' coordinates are integers, then it is not equilateral.
Suppose that such a triangle $ABC$ were equilateral, with every side of length $l$, and with $l$ minimal given these conditions. If $4\mid l^2$ then all the $x$-coordinates have the same parity, and all the $y$-coordinates have the same parity, so we may translate $ABC$ if necessary so that all the coordinates are even, then shrink it linearly by a factor of $2$, contradicting minimality of $l$.
So $4\nmid l^2$.
By the pigeonhole principle, at least two of the vertices have $x$-coordinates of the same parity. Pick two such and label them $A$ and $B$, and the other vertex $C$. Likewise, at least two of the vertices have $y$-coordinates of the same parity. If $A$ and $B$ were such, then $4\mid l^2$, which has been shown to be false. So wlog $A$ and $C$ have $y$-coordinates of the same parity. Then $|BC|^2$ is even but $|AB|^2$ and $|AC|^2$ are odd, so $ABC$ is not equilateral.
Alternative proof
Again suppose $l$ minimal. Chequer the lattice points. If $l^2$ is odd, every two vertices have different colours. But, by the pigeonhole principle, at least two must have the same colour. So $l^2$ is even, so all vertices have the same colour, and thus lie on the coarser lattice of points of that colour. Thus a linear transform $\mathbf{T}$ may be applied which maps this coarse lattice onto the original. $\mathbf{T}$ rotates by $45^\circ$, preserves angles and halves areas, yielding a smaller example. This contradicts minimality of $l$.
$\endgroup$ 3 $\begingroup$It is possible, the coordinates (a,0,0), (0,a,0) and (0,0,a) (where a is an integer) form an equilateral triangle.
$\endgroup$ 0 $\begingroup$This is not possible.Let me try to explain this simply.
Draw an equilateral triangle $ABC$. Arrange your own coordinate system in such a way that $B$ is $(0,0)$ and side $BC$ coincides with $X$ axis. Note that this does not affect the generality of the proof in any way.
Now, drop a perpendicular from $A$ to $BC$ at a point $D$ on $BC$.
Arbitrarily assume side of the equilateral triangle to be $a$.
So, now, applying simple trigonometric ratios we see that $BD=a/2$ and $AD=\frac{\sqrt3}{2}a$.
So,the coordinates of $A$ are $(a/2,\frac{\sqrt3}{2}a)$. So, not that it is not possible to simultaneously make the $x$ and $y$ coordinates rational, let alone integral.
$\endgroup$ 3 $\begingroup$Pick's Theorem implies that a triangle with lattice point vertices has rational area. The area of such an equilateral triangle is a rational multiple of the square root of $3$.
$\endgroup$