6. Two right triangles have a common hypotenuse. The difference in the lengths of the legs of one (20) of them is $9 \mathrm{~cm}$, and the other $13 \mathrm{~cm}$. The sum of the areas of these two triangles is $90 \mathrm{~cm}^{2}$. Calculate the lengths of their legs.
First solution. Let $a$ and $b$ be the legs of one triangle, and $m$ and $n$ be the legs of the other triangle, with $c$ being their common hypotenuse. From the problem statement, we have:

$$
\begin{gathered}
a^{2}+b^{2}=c^{2}, \quad m^{2}+n^{2}=c^{2} \\
a-b=9, \quad m-n=13 \\
\frac{1}{2} a b+\frac{1}{2} m n=90
\end{gathered}
$$

![](https://cdn.mathpix.com/cropped/2024_05_30_fac652c8a845a57c6fa7g-08.jpg?height=306&width=534&top_left_y=2280&top_left_x=770)

We obtain the system of equations:

$$
\begin{aligned}
a-b & =9 \\
m-n & =13 \\
a b+m n & =180 \\
a^{2}+b^{2} & =m^{2}+n^{2}
\end{aligned}
$$

(4 points)

From the first and second equations, we have

$$
a=b+9, \quad m=13+n
$$

From $(4)+2 \cdot(3)$, we get

$$
\begin{aligned}
(a+b)^{2}-(m-n)^{2} & =360 \\
(9+2 b)^{2}-13^{2} & =360 \\
b^{2}+9 b-112 & =0
\end{aligned}
$$

The only positive solution is $b=7$. From (1), we have $a=16$. The lengths of the legs of the first triangle are $16 \mathrm{~cm}$ and $7 \mathrm{~cm}$.

(8 points)

For the second triangle, we have:

$$
\begin{aligned}
m-n & =13 \\
m n & =180-a b=68 \\
n(13+n) & =68 \\
n^{2}+13 n-68 & =0
\end{aligned}
$$

The only positive solution is $n=4$. Therefore, $m=17$. The lengths of the legs of the second triangle are $17 \mathrm{~cm}$ and $4 \mathrm{~cm}$.

(8 points)