Let the smaller sides of the triangle have a length a and b. The length of the hypotenuse is sqrt( a^2 + b^2)
The area of the triangle is (1/2)*a*b = 6
=> ab = 12
=> a = 12/b
The perimeter is a + b + sqrt (a^2 + b^2) = 12
a + b + sqrt (a^2 + b^2) = 12
replace 12 with ab
=> a + b + sqrt (a^2 + b^2) = ab
=> ab - (a + b) = sqrt (a^2 + b^2)
square the two sides
=> a^2*b^2 + (a +b)^2 - 2ab*(a + b) = a^2 + b^2
=> a^2*b^2 + a^2 + b^2 + 2ab - 2ab*(a + b) = a^2 + b^2
=> a^2*b^2 + 2ab - 2ab*(a + b) = 0
divide all the terms by ab
=> ab + 2 - 2(a + b) = 0
substitute a = 12/b
=> b*12/b + 2 - 2(12/b + b) = 0
=> 14 = 2*(12/b + b)
=> 7 = 12/b + b
=> 7b = 12 + b^2
=> b^2 - 7b + 12 = 0
=> b^2 - 4b - 3b + 12 = 0
=> b(b - 4) - 3(b - 4) = 0
=> (b - 3)(b - 4) = 0
b = 3 or b = 4
a = 4 or a = 3
The hypotenuse is sqrt (a^2 + b^2) = sqrt ( 3^2 + 4^2) = sqrt 25 = 5
The required hypotenuse = 5.