Counting Squares in a Square
How many grid squares are there in a grid square of size N×N?
Obviously, there is the N×N square itself and N² small, 1×1 squares. But, for N, say equal to 5, there are also 2×2, 3×3, and 4×4 squares. In general, for the N×N square there are smaller squares of all possible sizes, starting with 1×1 all through N×N. How do you count those?
The applet bellow suggests a way of counting M×M squares contained in an N×N square, N ≥ M. In the applet, the M×M square is draggable. Try it and see what happens. Imagine the 1×1 square in the upper left corner of the moveable square is filled with paint which leaks when the square moves, but only if it remain within the borders of the N×N square.
| |
|
Explanation
Copyright © 1996-2009 Alexander Bogomolny
The position of an M×M square is fully determined by its upper left 1×1 piece. (The upper left corner is chosen for convenience. Any other small square inside a bigger one determines uniquely the position of the latter.) Inside the N×N square this 1×1 piece may occupy a limited number of positions. These form a square of side (N - M + 1) in the upper right corner of the N×N square. It follows that the number of M×M squares inside the N×N square equals (N - M + 1)×(N - M + 1).
| |
|
The total number T of grid squares within the N×N grid is the sum:
| | T | = ∑Nn = 1 (N - n + 1)² |
| | | = ∑Nn = 1 n², |
the sum of the first N squares. This we know to be
| |
| T | = | N(N + 1)(2N + 1)
 6 |
|
|
Copyright © 1996-2009 Alexander Bogomolny
|