I have a piece of graph paper, where the graph itself measures 18cm by 28cm, it is divided in lines, making a hue grid of tiny squares, each 1mm by 1mm, meaning there are $50400=180\times 280$ of the tiny squares.

However, there can be different sizes of square, up to 18cm side length. Including overlapping squares, how many are there in total?

I think that it has something to do with factorials and or powers, I could list out the amount of squares by size, but there has to be an easier way.

  • $\begingroup$ The number of squares in a n×n grid is n(n+1)(2n+1)/6 $\endgroup$ – Angad May 3 '17 at 11:16
  • $\begingroup$ I think it will be 5605 $\endgroup$ – Angad May 3 '17 at 11:18
  • 1
    $\begingroup$ @Angad there are 50400 of the smallest squares... how are there 5606 in total $\endgroup$ – Cursed May 3 '17 at 11:21
  • $\begingroup$ Wolfram Alpha gives this answer: wolframalpha.com/input/?i=50400(50400%2B1)(50400*2%2B1)%2F6 $\endgroup$ – Toby Mak May 3 '17 at 11:27
  • $\begingroup$ Sorry that was a mistake I did not realised that the units were changed correct answer will be 5396350 $\endgroup$ – Angad May 3 '17 at 11:30

There are $180\times 280$ places you can put the bottom left corner of a 1mm square (anywhere except on the top or right edge). What about 2mm squares? You now can't use the row 1mm below the top, or 1mm to the left of the right-hand edge, so there are $179\times 279$ remaining places. Similarly the number of $k~\text{mm}$ by $k~\text{mm}$ squares is $(181-k)(281-k)$, or for a general $x$ by $y$ rectangle with $x\leq y$, $(x+1-k)(y+1-k)$.

So your answer is $\sum_{k=1}^{x}(x+1-k)(y+1-k)=\sum_{k=1}^{x}((x+1)(y+1)-(x+y+2)k+k^2)$. You can substitute in the formulae for the sum of the first $x$ positive integers and the sum of their squares to get $$x(x+1)(y+1)-\frac{x(x+1)}2(x+y+2)+\frac{x(x+1)(2x+1)}6,$$ which simplifies to $$\frac{x(x+1)(y-x)}2+\frac{x(x+1)(2x+1)}6.$$

[Note: are you sure there are that many small squares? Graph paper normally has 2mm squares IIRC.]

  • $\begingroup$ Thanks for helping me understand this, and yes i am sure they are 1mm, i sat there with a ruler and counted and measured lol $\endgroup$ – Cursed May 3 '17 at 18:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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