Drexel dragonThe Math ForumDonate to the Math Forum

Ask Dr. Math - Questions and Answers from our Archives
_____________________________________________
Associated Topics || Dr. Math Home || Search Dr. Math
_____________________________________________

Number of Squares in an NxN Square


Date: 7/29/96 at 7:57:25
From: Anonymous
Subject: How Many Squares in an N by N square? 

How many squares are there in a 8 x 8 square?
How many rectangles are there?
Find an equation that will find out the number of squares simply by 
knowing the size of the square. 

I can't find out the equation. Can you help? This equation has to 
apply to both squares and rectangles.


Date: 7/30/96 at 15:52:27
From: Doctor Robert
Subject: Re: How Many Squares in an N by N square?

There are quite a few!  This is an interesting problem.  Let's tackle 
the one about the squares first.  There is only ONE 8x8 square.  There 
are FOUR 7x7 squares.  There are NINE 6x6 squares, and so on.  You can 
see this by taking a square (say 6 by 6) and seeing how many squares 
you can move it horizontally and how many vertically and multiplying 
these two numbers together).  If you see the pattern above, the answer 
to the question as to how many squares there are is 

1^2 + 2^2 + 3^2 + 4^2 + 5^2 + 6^2 + 7^2 + 8^2 = 204

The "equation" you want is  N = (9-s)^2 where N is the number of 
squares of side s.  That is, for a square of N sides, the total number 
of squares = 1^2 + 2^2 + 3^2 + ... + N^2.]

For rectangles, it's just a bit harder to see.  Consider a rectangle 
1 by 2, that is, 1 unit high and 2 units long.  How many units can fit 
in the top row?  Seven! How many rows are there?  Eight.  So there 
must be 56 1 by 2 rectangles.  Of course, there are also 56  2 by 1 
rectangles.  

If you proceed this way to count the possible number of rectangles of 
different sizes you can generate the following table.  Across the top 
are the possible lengths of the rectangles.  Down the side are 
possible heights of the rectangles.  In the table are the number of 
possible rectangles with these dimensions.

1   2   3   4   5   6   7   8

1  64  56  48  40  32  24  16  8

2  56  49  42  35  28  21  14  7

3  48  42  36  30  24  18  12  6

4  40  35  30  25  20  15  10  5

5  32  28  24  20  16  12   8  4

6  24  21  18  15  12   9   6  3

7  16  14  12  10   8   6   4  2

8   8   7   6   5   4   3   2  1 

There are quite a few interesting things about this table.  Notice 
that the elements along the major diagonal represent the squares.  The 
sum of all the numbers is 1296, so there must be 1296-204 = 1092 
rectangles that are not squares.  The "equation" must be  
N = (9-m)(9-n) where N is the number of rectangles, m is the height of 
the rectangle and n is the width of the rectangle. 

I hope that this helps.

-Doctor Robert,  The Math Forum
 Check out our web site!  http://mathforum.org/dr.math/   


Date: 10/02/98 at 11:24:31
From: John Pinkerton
Subject: Re: Comment on Number of Squares in NxN Square

Dear Dr. Math:

Here's a quick derivation for the number of rectangles in an NxN
chessboard. Each rectangle is defined by selecting two of the N + 1 vertical
lines and two of the N + 1 horizontal lines that are the edges of the
squares. So, the number of rectangles is the square of N + 1 "choose" 2,
which is the square of (N + 1)*N/2.

For an 8x8 square, you have ((8 + 1)*8/2)^2, or 36 squared, which is the 1296
that Dr. Robert gets by adding up his interesting table.

Keep up the good medicine,
John Pinkerton

P.S. on "choose": Recall that the number of ways to choose 2 objects out of
K is K "choose" 2, or (K)*(K - 1)/2. There are K choices for the first
object and K - 1 choices for the second, so there are (K)*(K - 1) ordered
pairs. But, order doesn't matter. So, we divide by 2 since you don't want
to double count for the two orders you might choose a given pair of
objects. In the above chessboard problem, K is N + 1.
    
Associated Topics:
High School Permutations and Combinations
High School Puzzles
Middle School Puzzles

Search the Dr. Math Library:


Find items containing (put spaces between keywords):
 
Click only once for faster results:

[ Choose "whole words" when searching for a word like age.]

all keywords, in any order at least one, that exact phrase
parts of words whole words

Submit your own question to Dr. Math

[Privacy Policy] [Terms of Use]

_____________________________________
Math Forum Home || Math Library || Quick Reference || Math Forum Search
_____________________________________

Ask Dr. MathTM
© 1994-2013 The Math Forum
http://mathforum.org/dr.math/