Easier to see why the hypotenuse = a - b, if you imagine the vertex corresponding to the right angle as the origin, O.

Therefore, the other two vertices will be represented by their position vectors,

OA = a

OB = b

And the hypotenuse, AB becomes,

BO + OA =

(-OB) + OA =

-b + a =

a - b