Hi could someone please help out? with workings please, thanks alot.

An isosceles right-angled triangle has one side length of (X+2)cm and the length of the hypotenuse is 12cm. Find the perimeter of the triangle.

I got up to (x+2)^2 + (X+2)^2 = 144

And i also worked out a method with the right answer, 2(x+2)^2 = 144

could someone explain to me why the first one doesnt work?