What are the sides of a right-angled triangle whose perimeter is $40 \mathrm{~cm}$ and the radius of the inscribed circle is $3 \mathrm{~cm}$?
Let $a$ and $b$ be the two legs, $k$ the perimeter, and $r$ the radius of the inscribed circle. Then

$$
a^{2}+b^{2}=(k-a-b)^{2}
$$

or

$$
k^{2}-2 k(a+b)+2 a b=0
$$

But

$$
a b=2 t=k r
$$

so

$$
k^{2}-2 k(a+b)+2 k r=0
$$

from which

$$
a=r+\frac{k}{2}-b
$$

and thus

$$
r k=b\left(r+\frac{k}{2}-b\right)=b r+\frac{b k}{2}-b^{2}
$$

or

$$
b^{2}-b\left(r+\frac{k}{2}\right)+r k=0
$$

from which

$$
b=\frac{r+\frac{k}{2} \pm \sqrt{r^{2}+\frac{k^{2}}{4}-3 r k}}{2}
$$

and thus finally

$$
a=\frac{r+\frac{k}{2} \mp \sqrt{r^{2}+\frac{k^{2}}{4}-3 r k}}{2}
$$

Numerical results in this example:

$$
a_{1}=8 \mathrm{~cm}, b_{1}=15 \mathrm{~cm} ; a_{2}=15 \mathrm{~cm}, b_{2}=8 \mathrm{~cm}
$$

The hypotenuse of the triangle is $c=17 \mathrm{~cm}$.