The Pythagorean theorem states that the sum of the squares of the two legs of a right triangle equals the square of the hypotenuse.
The question says that the shorter leg is 1 inch shorter than the longer leg. If we let X = the length of the longer leg, then X -1 is the length of the shorter leg.
Now let's plug into the formula --> X^2 + (X-1)^2 = 25
X^2 + X^2 - 2X + 1 = 25
2X^2 - 2X - 24 = 0
Divide everything by 2--> X^2 - X - 12 = 0
(X - 4) (X + 3) = 0
X = 4 . . . there can't be a negative length.
Then the shorter side is 3
Plug into the Pythagorean theorem to make sure that these numbers work.