# Perimeter Algorithm

Shodor > Interactivate > Discussions > Perimeter Algorithm

 Student: Is there a way to calculate the perimeter of these random shapes without having to count everything? Mentor: Yes there is, let's look at an example. The first step is to "box" the object in. Then count the length and width of "the box." Student: For this example the length is 4 and the width is 5. Mentor: Now, lets find the perimeter of "the box." Perimeter is the distance around "the box," which is: Student: For this example the perimeter is two times four plus two times five. Mentor: Yes it is. Now remember that me must multiply first and then add according to the order of operations. So the perimeter of "the box" is eight plus ten, which equals eighteen. Student: Now we know what the perimeter of "the box" is, but what does that have to do with the perimeter of the object? Mentor: They are the same! Student: No way they are the same. That doesn't make any sense. Mentor: It makes sense if you look at the picture as the number of perimeter lines per row and column. Then numbers in blue are the perimeter lines of the object in that column or row and the red numbers are the number of perimeter lines of "the box". Now you can see that the perimeter of "the box" is actually the perimeter of the object. Student: Cool, does that trick work for all shapes? Mentor: No this trick does not work for shapes that fold back on themselves. Adding one block to our example makes the trick not work. Can anyone figure out what makes our trick fail? Student: Before you said that we should look at the picture as the number of perimeter lines per row and column. In this picture, the number of perimeter lines of the shape does not match the number of perimeter lines of "the box." Mentor: Great Job! In the first column there are four shape perimeter lines and the box only has two. So the perimeter of the object is two more than the perimeter of "the box." So the perimeter of the shape is eighteen plus two, which is twenty. Student: So when the picture folds on itself, we have to scan the columns and the rows to see how many extra perimeter lines there are. Then we just add that to the perimeter of the box. Mentor: Good job! Now lets play with the Perimeter Explorer applet and see how well our method works. 