# The perimeter of a right-angled triangle is 40 cm, and the hypotenuse is 17 cm. Find the length of the legs.

Let one leg of a right-angled triangle be x cm, and the second leg y cm.From the condition, the sum of the sides of a right-angled triangle, that is, its perimeter is 40 cm.And the hypotenuse is 17 cm.Let’s make an equation and express one side:

P = x + y + z;

x + y + 17 = 40;

y = 40 – 17 – x;

y = 23 – x;

Let’s use the Pythagorean theorem and compose the equation:

z² = x² + y²;

(x² + (23 – x) ²) = 17²;

(x² + (23 – x) ²) = 289;

x² + 529 – 46x + x² = 289;

2x² – 46x + 529 – 289 = 0;

2x² – 46x + 240 = 0;

x² – 23x + 120 = 0;

Find the roots by solving the quadratic equation:

Let’s calculate the discriminant:

D = b² – 4ac = (- 23) ² – 4 * 1 * 120 = 529 – 480 = 49;

D ›0 means:

x1 = (- b – √D) / 2a = (23 – √49) / 2 * 1 = (23 – 7) / 2 = 16/2 = 8;

x2 = (- b + √D) / 2a = (23 + √49) / 2 * 1 = (23 + 7) / 2 = 30/2 = 15;

Let’s find the second side:

y = 23 – x

If x1 = 8 cm, then y1 = 23 – 8 = 15 cm;

If x2 = 15 cm, then y2 = 23 – 15 = 8 cm;

Answer: the lengths of the legs are 15 cm and 8 cm, respectively.