Thursday, January 11, 2018

logical deduction - How many squares can you make with equal ranged points?



This question is directly related to How Many Squares on the Peg Solitaire.


Is it possible to formulate with a given dimension of equal ranged points $m\times n$ where $m,n\geqslant 2$?


For example;



$2\times2$ there is only $1$ square possible:



enter image description here



$3\times2$ there are only $2$ squares possible and $3\times3$ there are $6$ squares shown as below:




enter image description here enter image description here enter image description here



Answer



For the general case, let's assume that 2 ≤ nm.


Every possible square has an axis-aligned boundary box that is a square of edge length a. Such a square can fit into the n × m grid at


  P(a) = (ma) (na)


positions, see illustration below (left). If we define each square by the edge of its north-west corner (dx, dy), dx > 0, dy ≥ 0; the edge length of the bounding box is


  a = dx + dy .


There are a possibilities to split each a into dx and dy as shown below (right). (Note that dx can't be zero, because such a square would be a 90° rotation of an axis-aligned square that has already been accounted for by the case where dy is zero.)


   possible bounding-box positions and possible squares in bounding box


Possible edge lengths of bounding boxes are 0 < a < n. Therefore, the number of squares that fit into a grid of n × m nodes is:



  N = ∑a a · (ma) (na);    a = 1,..., n − 1
   = ∑a (a³ − (m + n) a² + m n a)


Using the well-known (i.e. easily googleable) Faulhaber formulas, we get:


  N= ¹/₄ (n − 1)² n²   − ¹/₆ (n − 1) (n (2n − 1) (m + n)   + ¹/₂ (n − 1) n² m


and after a bit of rearranging and simplifying:


  N(n, m) = ¹/₁₂ (n − 1) n (n + 1) (2 mn)


My approach is different from (and perhaps less elegant than) Wen1now's, but it arrives at the same solution. There's a difference in nomenclature; k is the edge length of the grid, m and n are the numbers of pegs along the edge as in the question. If we set n = m = k + 1, we get:


  N(k) = ¹/₁₂ k (k + 1)² (k + 2)


No comments:

Post a Comment

classical mechanics - Moment of a force about a given axis (Torque) - Scalar or vectorial?

I am studying Statics and saw that: The moment of a force about a given axis (or Torque) is defined by the equation: $M_X = (\vec r \times \...