The larger right triangle with hypotenuse x + 5 and short leg x + 2 is similar to the smaller right triangle with hypotenuse x + 2 and short leg x.
Because of this similarity, we have
(x + 5)/(x + 2) = (x + 2)/x
Solve for x:
x(x + 5) = (x + 2)^2
x^2 + 5x = x^2 + 4x + 4
x = 4