Ok so Pythagoras's theorem is
a^2+b^2=c^2
a and b are the legs and c is the hypotenuse.
So let's just say b is the leg with the 4in (it doesn't really matter which one we choose for this specific theorem)
So we have
a^2 + 16 = 25
Simplifyyy
a^2 = 9
Square root it and you get
a = 3 inches
Voila!