Explanation:
Pythagoras.
c² = a² + b²
c being the Hypotenuse (the side opposite of the right angle).
so, the length of the rectangle is the Hypotenuse of the right-angled triangle on the top :
length² = 7² + 3² = 49 + 9 = 58
length = sqrt(58)
the diagonal of the rectangle is again the Hypotenuse of the right-angled triangle of length (sqrt(58)), width (x) and diagonal (9) of the rectangle.
so, we have
9² = sqrt(58)² + x² = 58 + x²
81 = 58 + x²
23 = x²
x = sqrt(23)