The formula for a square of matches, where there are n small squares along each side, is calculated thus:
There are n horizontal matches and n+1 vertical matches to form each row of open squares, where the squares have no base. There are n such rows. The last row is closed (all the squares are given a base) by adding n matches. The formula for the number of matches is N=n(n+n+1)+n=2n^2+2n=2n(n+1). When N=24, 2n(n+1)=24, n(n+1)=12, so n=3. Therefore, you need 24 matches to make a 3X3 square (9 small squares), and 40 to make a 4X4 square, as shown in the table:
n |
n^2 |
The number of matches, N=2n(n+1) (n>0) |
1 |
1 |
4 |
2 |
4 |
12 |
3 |
9 |
24 |
4 |
16 |
40 |
5 |
25 |
60 |
6 |
36 |
84 |
To make a rectangle of aXb squares, that is, a columns and b rows, you need a horizontal matches for each row and a+1 vertical matches. They form a row of a open squares. So you have b(a+a+1) matches for b rows and another a matches to close the last row: N=b(2a+1)+a=2ab+a+b. When a=b, N=2a^2+2a=2a(a+1), as expected. If a=4 and b=10, N=94. Note that if a=10 and b=4, the answer is still the same, N=94, so it doesn't matter which of a and b represents the row and column, because they're interchangeable.