The formula for the distance between two points is

Note that, if two points have one coordinate in common, this formula simplifies to

(the first if they share the y coordinate, the second if they share the x coordinate).
So, these are the lengths of the sides:

(because they share the y coordinate)

(standard formula)

(because they share the y coordinate)
