Let x and y be the two legs of the right triangle.
By Pythagorean Theorem:
x^2 + y^2 = 289
Also since perimeter = 40:
x + y + 17 = 40
Determine x from 2nd equation:
x = 23 - y
substitute value for x into 1st equation:
(23-y)^2 + y^2 = 289
529 - 46y + y^2 + y^2 = 289
2y^2 - 46y + 240 = 0
y^2 - 23 + 120 = 0
Factor:
(y-15)(y-8) =
If y = 15, then x = 23 - 15 = 8
If y = 8, then x = 23 - 8 = 15
Thus the other two sides must be 15 and 8.
Verify: perimeter is 15 + 8 + 17 = 40 --- check
(15)*2 + (8)^2 = 289 ---- check
y cannot be 40 because the perimeter is 40, so y must be equal to 6.
and x must be equal to 23 - 6 =