2
$\begingroup$
Let h = the height of the right triangle (an integer). Let c = the hypotenuse Let l = the other leg  So l^2+h^2=c^2 

I am trying to figure out, for instance, why there are 8 such triangles when h=12. I try to figure this out manually and I'm only finding (EDIT) 4:

5 12 13 9 12 15 16 12 20 35 12 37 

Is there a general approach to finding these (other than factorizations of h^2)?

  • 0
    @Mike: ... well, I got it wrong eventually, anyway. =]2012-04-18

3 Answers 3

2

You can rewrite the Pythagorean theorem for your case as $144=c^2-\ell^2=(c-\ell)(c+\ell)$. There are lots of ways to factorize 144, which means lots of ways of writing it as $(c-\ell)(c+\ell)$.

Addendum: Just expanding a bit on some of what was covered in the comments. In response to Maesumi's answer, you make the remark,

I'm trying to basically find the sum of the number of triangles given height $n$ over a range of $n$.

If $h$ is odd, then, writing $h^2=xy$ with $x\lt h$ and $y\gt h$, the triples $(a,b,c)$ with $b=h$ are $((y-x)/2,h,(y+x)/2)$. If $h$ is even, then, writing $h^2=4wz$ with $w\lt h/2$ and $z\gt h/2$, the triples are $(z-w,h,z+w)$. This implies that a formula for the number of triangles of height $h$ is $ \begin{cases} \frac{\sigma_0(h^2)-1}{2} & h\text{ odd,}\\ \frac{\sigma_0((h/2)^2)-1}{2} & h\text{ even,} \end{cases} $ where $\sigma_0(n)$ is the number of divisors of $n$. Not that this helps you at all, since it's equivalent to what you're already doing. I gather that you are needing to compute this for a very large number of very large values of $h$. I'm not sure that there's any faster way to do this than by actually factorizing those values of $h$.

You've probably seen the Online Enyclopedia of Integer Sequences page related to your problem, http://oeis.org/A046079, but if not, it's worth having a look.

Addendum II: Filling in more details from the comments, which I muddled due to bad notation. You ask for a bound on the hypotenuse, $c$, given the height $h$. Let $\ell$ be the length of the other leg. The bound is different for $h$ even and for $h$ odd.

$h$ even: Since $c$ and $\ell$ must have the same parity if $h$ is even, we have $\ell\le c-2$ in this case, and so $ h^2=c^2-\ell^2\ge c^2-(c-2)^2=4c-4. $ Hence $c\le c_\text{max}=(h/2)^2+1$.

$h$ odd: Since $c$ and $\ell$ must have opposite parity when $h$ is odd, we have $\ell\le c-1$ in this case. From this it follows that $c\le c_\text{max}=(h^2+1)/2$.

Interestingly, there is always a triple with maximal hypotenuse since $c_\text{max}^2-h^2$ is always a perfect square.

  • 0
    @draks : Your questions are very interesting. Since this Pythagorean problem involves the *difference* of two squares, which factorizes over the integers, the analysis is straightforward. I don't immediately see anything analogous for sums of powers, but I will think about it.2012-04-19
1

If you take (3,4,5) and multiply by 3 you get (9,12,15) but if you multiply with 4 you get (12,16,20). If your problem allows 0 and negative numbers or switching numbers then the count will change. For general solutions write $x^2+12^2=z^2$. This gives you $(z-x)*(z+x)=144$. factor 144 to two numbers, both have to be even (or both odd which does not happen here) to get integer answers, so you get $((z-x),(z+x))=(2,72),(4,36),(6,24),(8,18)$. First one gives $z=37,x=35$, next $z=20 x=16$, next $z=15,x=9$, next $z=13, x=5$. If you allow for exchanging legs you get 8. So the unfamiliar answer was $12^2+35^2=37^2$.

  • 0
    @TaraB My factorization algorithm is quite fast, but my limit is up into the trillions. Even good factorization algorithms are not fast enough here. I've already spent a week on the factorization approach and just could not get it to run in reasonable runtime.2012-04-18
1

You might find this paper of interest: http://www.math.ou.edu/~dmccullough/teaching/pythagoras2.pdf

  • 0
    Without any further information, this is more a comment than an answer, but there's still space left...2012-04-20