A problem about rational number for right triangles. If a right triangle has hypotenuse of length 5, and the remaining two sides $a, b$ have rational lengths, what can we say about $a$ and $b$? 
 A: Hint: Think Pythagorean Triples.
A: Following Peter's lead, let $(\frac{q}{p})^2 + (\frac{r}{s})^2 = 25$. Here, assume all fractions are in their reduced forms.
Then $(\frac{sq}{p})^2 = (5s+r)(5s-r)$
LHS is an integer as so is RHS. This immediately shows us that p must divide s as it has no common divisors with q. Moreover, by the same argument applied the other way, s must divide p. Therefore, s and p are the same. As far as the question is concerned, this should be enough to say that the rational numbers a and b must have the same denominators in their reduced forms.
EDIT: Just for fun, let's try to categorize all these triplets. Substituting s for p, $q^2 + r^2 = 25s^2$. Thus $q^2 = (5s+r)(5s-r)$. Now, any common factor betwen $5s+r$ and $5s-r$ is also common between 10s and 2r. As s and r have nothing in common, this can be only 1 or 2. In the first case, both $5s+r$ and $5s-r$ must be squares, and in the other both must be twice some square. Once we choose the squares, we can find s and r accordingly. Knowing the quadratic residues mod 5, we can easily choose the squares to make the condition hold, (the only condition is that the average or in the second case the sum of the squares is a multiple of 5). eg. 9 and 121 is a valid pair for the first case (gcd 1) as their average is 65, a multiple of 5. Setting 5s+r=121 and 5s-r=9, we get s = 13, r = 56. So q = sqrt(121*9) = 33.
This gives us $(56/13)^2 + (33/13)^2 = 5$.
A: Let $a = q/p$ and $b = r/s$ with $p,q,r$ and s $\in \mathbb{Z}$
Then $(q/p)^2 + (r/s)^2 = 25$ i.e., $(sq)^2 + (pr)^2 = 25$
Therefore, $sq = 3, pr =4$ or $sq = 4, pr =3$
If $sq = 3, pr =4$
$s = 1$ or $3$ and $p = 1$, $2$ or $4$
The other side is similar.
================ wrong record above =================================
If we doesn't require $gcd(p,q) = 1$ or $gcd(r,s) = 1$ above
We can suppose $a = p/r$ and $b = q/r$ with $p,q,r \in \mathbb{Z}$. 
We have $p^2 + q^2 = (5r)^2$. By moving $r = 1,2\dots$.
A: We want to generate the rational solutions of $u^2+v^2=25$. Equivalently, we 
generate the solutions of the equation $x^2+y^2=25z^2$ in integers, with $z\ne 0$, and set $u=x/z$, $v=y/z$. Ultimately the procedure we get is a close analogue of the standard way of generating primitive Pythagorean triples. The case where $5$ divides one (and therefore both) of $x$ and $y$ is not interesting, so assume that neither $x$ nor $y$ is divisible by $5$. 
The square $3+4i$ of the Gaussian prime $2+i$ must divide one of $x+iy$ or $x-iy$. By changing the sign of $y$ if necessary, suppose that $3+4i$ divides $x+iy$.
So $x+iy=(s+it)(3+4i)=(3s-4t)+(4s+3t)i$, and therefore $x=3s-4t$, $y=4s+3t$.
Squaring, we find that $x^2+y^2=25(s^2+t^2)=25z^2$, so we want $s^2+t^2=z^2$.
It is enough to consider primitive solutions of this equation. These are given by 
(i) $(a^2-b^2,2ab,a^2+b^2)$, and (ii) $(2ab, a^2-b^2, a^2+b^2)$, where $a$ and $b$ are relatively prime and of opposite parity. We have to consider both possibilities because of the lack of symmetry between $s$ and $t$ in $x=3s-4t$, $y=4s+3t$.
Case (i) gives us the solutions $x=3(a^2-b^2)-8ab$, $y=4(a^2-b^2)+6ab$, $z=a^2+b^2$, and therefore the rational solutions 
$$u=\frac{3(a^2-b^2)-8ab}{a^2+b^2},\qquad v=\frac{4(a^2-b^2)+6ab}{a^2+b^2}.$$
Case (ii) yields something similar.
Comment: The above procedure, with possibly changes of sign, generates all non-trivial rational solutions. There is undoubtedly a more attractive way of doing this. Furthermore, it seems likely that even though we are taking $a$ and $b$ relatively prime and of opposite parity, some rational solutions are generated more than once. 
For a more elementary way of getting at a parametric solution, rewrite the equation $x^2+y^2=25z^2$ as $x^2-9z^2=16z^2-y^2$, and imitate the analysis of Pythagorean triples. It is somewhat messy. 
