Consider the ratio of the two legs of the two smaller interior right triangles. (refer to attached diagrams for the triangles - I have outlined one in blue and the other in red)
These will be equal since the triangles are similar
shorter leg : longer leg
(blue triangle = red triangle)
⇒ x : 4 = 2 : x
⇒ x/4 = 2/x
⇒ x² = 8
⇒ x = √8
⇒ x = 2√2
Now we have x, we have the two legs of the right triangle with hypotenuse labelled y.
Using Pythagoras' Theorem a² + b² = c² (where a and b are the legs and c is the hypotenuse)