You are looking for the difference in perimeters, or

.

or

. Factoring yields

.

To get the

out of the equation, you can use the fact that areas are the same. The perimeter of the square is

, which means the length of a side is

, making the area

. The area of the rectangle is

or

. The relationship is then

and

.

Plugging this into the formula for the rectangle perimeter, you can see that

.

The differences in perimeters (the answer to the original part b question) is then

. You can rationalize this, factor it, distribute, or whatever other simplification you want. The form I kinda like is

.

Using this final version of the formula to solve part a (plugging in 4 for x and 160 for L), I get 520 mm. If that's the right answer to part a then I'm pretty comfortable with it.