3. Using the fact that Pythagorean triples have the form

$$
\left(x y, \frac{x^{2}-y^{2}}{2}, \frac{x^{2}+y^{2}}{2}\right), x>y
$$

where $x$ and $y$ are natural numbers with the same parity, determine which right triangle with integer sides and one leg of 1000 has:

a) the largest perimeter;

b) the smallest area.
Solution. From $1000=p q$ we get that $p=2^{a} 5^{b}$ and $q=2^{3-a} 5^{3-b}$, where $a \in\{1,2\}$ and $b \in\{0,1,2,3\}$. Therefore, the sides of the triangle are

$$
x=1000, y=2^{2 a-1} 5^{2 b}-2^{5-2 a} 5^{6-2 b}, z=2^{2 a-1} 5^{2 b}+2^{5-2 a} 5^{6-2 b}
$$

a) The perimeter $L=x+y+z=1000+2^{2 a} 5^{2 b}$ will take the largest value for the largest allowed values of $a$ and $b$, i.e., for $a=2$ and $b=3$. Consequently,

$$
x=1000, y=124998, z=125002 \text { and } L=251000 \text {. }
$$

b) The area of the triangle will be the smallest for those values of $a$ and $b$ for which $y=\frac{1}{2}\left(p^{2}-q^{2}\right)$ will take the smallest positive value. By direct verification, it is found that this is achieved for $a=1$ and $b=2$. Consequently,

$$
x=1000, y=1050, z=1450 \text { and } L=525000 \text {. }
$$