So, we know that a^2 + b^2 = c^2. Right? That is called the Pythagorean Theorem.
In this case. We can say that 39 is a, 40 is b, and x is c. NOTE: It doesn't really matter whether 39 is a or b. a & b are just the two legs of the right triangle.
So, if we say that 39 is a, 40 is b, and x is c. We can plug it into the Pythagorean Theorem.