Counting squares of NxM lattice

In summary, the conversation discusses a method for counting the total number of squares in a lattice of NxM points, with a specific example provided for a 3x4 lattice. The suggested method involves counting the possible positions for the lower-left corner of each square, with a formula provided for this process. The conversation also mentions the possibility of simplifying this formula further.
  • #1
Medicol
223
54
This is not a quiz but I am thinking how to write down a simple math formula to count the total number of squares present in a lattice of NxM points for my 12 year old nephew ? He'll sure be happy if I could turn this into, say, a common sense for pupils like him. :biggrin:

For example,
In a 3x4 lattice there are 20 squares.
I first check 3x3 one (by omitting the last column 3x1) on the right and have
12+22+32 = 14 squares
then I check 3x3 one (after omitting the first column) on the right to obtain
12+22+32 = 14 squares

So there are 28 squares. But I have 2 columns overlapped between the two squares I have just checked. And I have no clue how to reason to leave out the overlapped part to acquire the correct result.
 
Mathematics news on Phys.org
  • #2
Medicol said:
This is not a quiz but I am thinking how to write down a simple math formula to count the total number of squares present in a lattice of NxM points for my 12 year old nephew ? He'll sure be happy if I could turn this into, say, a common sense for pupils like him.
Without loss of generality, assume that M >= N.

Count how many 1x1 squares, how many 2x2 squares and so on up to how many NxN squares. Count those by counting the possible positions for their lower-left corner. For the 3x4 case...

There are 3x4 = 12 possible positions for the lower left corner of a 1x1 square
There are 2x3 = 6 possible positions for the lower left corner of a 2x2 square
There are 1x2 = 2 possible positions for the lower left corner of a 3x3 square.

##\sum_{k=0}^{N-1} (N-k)(M-k)##

But possibly you're way ahead of me and are trying to reduce that to closed form.
 
  • Like
Likes 1 person

1. How do you count the number of squares in a NxM lattice?

The number of squares in a NxM lattice can be counted by taking the product of the number of rows (N) and the number of columns (M), and then adding the sum of the squared values of N and M. This formula can be represented as (N x M) + (N^2 + M^2).

2. Can the number of squares in a NxM lattice be calculated without using a formula?

Yes, the number of squares in a NxM lattice can also be calculated by visualizing the lattice and counting the squares manually. However, this method may become more challenging as the size of the lattice increases.

3. Are there any shortcuts to counting the squares in a NxM lattice?

Yes, there are a few shortcuts that can be used to count the squares in a NxM lattice. One method is to divide the lattice into smaller sections and count the squares in each section, then add all the counts together. Another method is to use symmetry and count the number of squares on one side of the lattice, and then multiply by 4 to account for the other sides.

4. Can the number of squares in a NxM lattice be negative?

No, the number of squares in a NxM lattice cannot be negative. This is because the number of squares is calculated by adding positive values (N, M, and squared values of N and M) together, which will always result in a positive number.

5. How does the number of squares in a NxM lattice change if the lattice is rotated or reflected?

The number of squares in a NxM lattice remains the same regardless of rotation or reflection. This is because the number of squares is dependent on the dimensions of the lattice (N and M), which do not change when the lattice is rotated or reflected.

Similar threads

  • General Math
Replies
2
Views
1K
Replies
2
Views
630
Replies
68
Views
9K
  • Advanced Physics Homework Help
Replies
11
Views
1K
Replies
6
Views
3K
  • Programming and Computer Science
Replies
19
Views
978
  • Introductory Physics Homework Help
Replies
1
Views
3K
  • Engineering and Comp Sci Homework Help
Replies
12
Views
2K
Replies
2
Views
2K
  • Programming and Computer Science
Replies
3
Views
1K
Back
Top