sometimes there are puzzles where you have to give the number of squares you see in a picture, typically an intersection of squares. Is there a fast method to find it based on the number of corners and intersections?
quick method to count the number of square
3
$\begingroup$
combinatorics
puzzle
-
0I don't have a solution, but here's a simple algorithm if you wanna do every single one by hand: First you have to partition the set of lines into subsets such that in each set the lines are all parallel or perpendicular, and that two lines from two different sets are neither. Then for each of these sets, you take corners one by one and count the number of squares which have that corner as top left corner. – 2011-10-10
2 Answers
0
In a $m \times n$ grid, $m,n \in \mathbb{N}$ and $m>n$,number of squares of all possible dimensions is given by $ \sum _{i=1}^{n} (m-i+1) \times (n-i+1)$ so it is obvious of the case when $m=n$.
If you also want to know the number of rectangles in the same grid,then it is given by $\binom{m+1}{2} \times \binom{n+1}{2}$ Since there are $(m+1)$ and $(n+1)$ horizontal and vertical lines respectively and by selecting any two vertical and any two horizontal line we will get a rectangle.
1
This is not an answer (complete), but if you are given $n\times n$ chess-board type figure, total number of squares is $\sum_{k=1}^nk^2=\frac{n(n+1)(2n+1)}{6}$