Is there a formula to evaluate the number of all squares in the \$m imes n\$ grid? Well, I"m just curious, I"ve seen the question like this somewhere at the university, to solve this they were dividing the grid with \$m - 1\$ and \$n - 1\$ lines...I don"t know what"s next.

You are watching: Number of squares in a grid  Suppose \$nge m\$.

Number of squares of size 1: \$mcdot n\$Number of squares of size 2: \$(m-1)cdot (n-1)\$...Number of squares of size m: \$1cdot (n-m+1)\$

Result: \$\$eginalignsum_k=1^m k cdot (n-m+k) & =(n-m)sum_k=1^m k +sum_k=1^m k^2 \& = (n-m) m(m+1)/2 + m(m+1)(2m+1)/6 \& = fracm(m+1) (3n-m+1)6endalign\$\$  Rectangles in rectangle\$\$frac(n^2+n)(m^2+m)4\$\$

Rectangles in square\$\$frac(n^2+n)^24\$\$

Squares in rectangle\$\$m≥ n-1,frac(n^2+n)2m-frac(n^3-n)6\$\$

Squares in square\$\$frac(n^2+n)(2n+1)6\$\$ Thanks for contributing an answer to barisalcity.orgematics Stack Exchange!

But avoid

Asking for help, clarification, or responding to other answers.Making statements based on opinion; back them up with references or personal experience.

Use barisalcity.orgJax to format equations. barisalcity.orgJax reference.

See more: Sears Roebuck And Co Pocket Watch 16, 2 Illinois Sears Roebuck Co

## Not the answer you're looking for? Browse other questions tagged combinatorics or ask your own question.

What is the number of squares in an \$N imes M\$ grid, if the squares don't have to be aligned with the grid's axes?
What is the number of squares in an \$N imes M\$ grid, if the squares don't have to be aligned with the grid's axes?
How many subsets of squares in a \$3 imes 3\$ grid, corners requiring both adjacent squares to be included?
site design / logo © 2021 Stack Exchange Inc; user contributions licensed under cc by-sa. rev2021.10.14.40450