# Generating integral triangles with two equal sides

How can I generate all triangles which have integral sides and area, and exactly two of its three sides are equal?

For example, a triangle with sides ${5,5,6}$ satisfies these terms.

-

Heron's formula says the area of a triangle with sides $a, b, c$ is $$Area = \sqrt{s(s-a)(s-b)(s-c)}$$ where $s$ is the semiperimeter, $s = \frac{a+b+c}{2}$. Now, your assumption is two sides are equal, so $a, b, b$. The area is now $$Area = \sqrt{s(s-a)(s-b)^2} = (s-b)\sqrt{s(s-a)}$$ Now $s-b$ might not be an integer, if $s$ is not, but it will at worst be a fraction of the form $\frac{z}{2}$. I will deal more with this later.

For now, we want $\sqrt{s(s-a)}$ to be an integer, so $s(s-a)$ must be a perfect square. Now, $s = \frac{a + 2b}{2} = \frac{a}{2} + b$ so this simplifies to wanting $$s(s-a) = (\frac{a}{2} + b)(\frac{a}{2} + b - a) = (b + \frac{a}{2})(b - \frac{a}{2}) = b^2 - \frac{a^2}{4}$$ a perfect square, so let's say it equals $c^2$. Thus, we want all integer solutions to $$c^2 + \left(\frac{a}{2}\right)^2 = b^2$$ If we happen to get a solution such that $(s-b)\sqrt{s(s-a)}$ is not an integer, then multiply all side lengths by 2 to get a similar triangle with $s$ and thus $s-b$ an integer.

Other than that, the problem is reduced to finding all solutions to this equation, which is a well known problem with a well known solution.

-
Does $s(s-a)$ being a perfect square, $\implies s-b$ also integer? –  lab bhattacharjee Sep 17 '12 at 15:30
@labbhattacharjee Thanks! fixed –  Graphth Sep 17 '12 at 15:50

Area of isosceles triangle with sides $a,a,b$ is $\frac{b\sqrt{4a^2-b^2}}{4}$

Now $\sqrt{4a^2-b^2}$ must be integer$=c$(say),

$\implies 4a^2-b^2=c^2\implies b^2+c^2=4a^2$

Clearly, $b,c$ are of same parity.

If $b,c$ are odd $=2C+1,2D+1$ respectively, then $b^2+c^2=(2C+1)^2+(2D+1)^2$ $=4(C^2+D^2+C+D)+2\equiv 2\pmod 4$,not multiple of $4$.

$\implies b,c$ are even

Let $b=2B,c=2C$

So, $B^2+C^2=a^2$

Area of the isosceles triangle becomes $B\sqrt{a^2-B^2}=BC$

The parametric solution of $B^2+C^2=a^2$ is $k(p^2-q^2), 2pqk, k(p^2+q^2)$ where $p,q,k$ are any non-negative integers and $p>q$ .

So, the general solutions are $a=k(p^2+q^2), b=2B=2k(p^2-q^2),c=2C=2(2pqk)=4pqk$ or $a=k(p^2+q^2), b=2B=4pqk,c=2C=2k(p^2-q^2)$, the area being $pq(p^2-q^2)$, in either case.

If $k=1, p=2,q=1,a=2^2+1^2=5,b=2(2^2-1^2)=6$ or $b=4\cdot 2\cdot 1=8$

-
just double a pythagorean right triangle –  i. m. soloveichik Sep 17 '12 at 15:05
@i.m.soloveichik, exactly, the connecting edge being any one of the sides other than hypotenuse. –  lab bhattacharjee Sep 17 '12 at 16:12
@i.m.soloveichik But, what if the triangle you double has area that is, say $9/2$, or say a side length that is irrational. If that's all you did, you would miss these. –  Graphth Sep 17 '12 at 16:32
@Graphth, the general solution will always produce integral sides and area as $p,q,k$ are integers, right? –  lab bhattacharjee Sep 19 '12 at 13:08