Explanation:
a square has 4 identical sides.
so, when you have to "walk" around the perimeter of a square you have to go 4 times the same distance.
therefore
20 = 4×side length
side length = 20/4 = 5 in
it is a 5 in × 5 in square.
FYI a rectangle has 2 pairs of sides that are equally long inside their pair.
and so you have in this case a perimeter of
2×6 + 2×4 = 12 + 8 = 20 in