Respuesta :

Given

  • a rectangle x units wide and y units high divided into unit squares

Find

  • The total perimeter of the unit squares, counting each line segment once

Solution

For each of the y rows of squares, there are x segments at the top, plus another x segments at the bottom. The total number of horizontal segments is then

... horizontal segment count = (y +1)x

Likewise, for each of the x columns of squares, there are y segments to the left, plus another y segments to the right of the entire area. Then the total number of vertical segments is

... vertical segment count = (x+1)y

The total segment count is ...

... total segments = horizontal segments + vertical segments

.. = (y+1)x +(x+1)y

... total segments = 2xy +x +y

_____

Check

We know a square (1×1) has 4 segments surrounding it.

... count = 2·1·1 +1 +1 = 4 . . . . (correct)

We know the 3×3 window in the problem statement has 24 segments.

... count = 2·3·3 +3 +3 = 18 +3 + 3 = 24 . . . . (correct)

We know a 1×3 row of panes will have 10 frame elements.

... count = 2·1·3 +1 +3 = 6 +1 +3 = 10

It looks like our formula works well.