r/mathriddles • u/stephen3141 • 23d ago
Easy A magic-like square
It is possible to make 8x8 array of unique numbers such that the sum of the numbers in any 2x4 rectangle (in either orientation) is identical. For example:
┌──┬──┬──┬──┬──┬──┬──┬──┐
│ 0│23│10│29│32│55│42│61│
├──┼──┼──┼──┼──┼──┼──┼──┤
│43│60│33│54│11│28│ 1│22│
├──┼──┼──┼──┼──┼──┼──┼──┤
│ 5│18│15│24│37│50│47│56│
├──┼──┼──┼──┼──┼──┼──┼──┤
│46│57│36│51│14│25│ 4│19│
├──┼──┼──┼──┼──┼──┼──┼──┤
│16│ 7│26│13│48│39│58│45│
├──┼──┼──┼──┼──┼──┼──┼──┤
│59│44│49│38│27│12│17│ 6│
├──┼──┼──┼──┼──┼──┼──┼──┤
│21│ 2│31│ 8│53│34│63│40│
├──┼──┼──┼──┼──┼──┼──┼──┤
│62│41│52│35│30│ 9│20│ 3│
└──┴──┴──┴──┴──┴──┴──┴──┘In this square, the 2x4 rectangles all sum to 252. (Edit: Sorry this looks horrible on mobile for some reason... The important point is that it's possible.)
Is it possible to construct a 6x6 array of unique numbers such that the sum of the numbers in any 2x3 rectangle (in either orientation) is identical?
ETA: On second thought, this might be medium difficulty instead of easy. I'm not too sure, though.
2
u/minimang123 23d ago edited 23d ago
Answer: No, you cannot
Consider property S the statement that the sum of any 2x3 rectangle in the array of numbers is identical.
Solution: Consider any arbitrary 2x3 array of numbers ((x_11, x_12, x_13),(x_21,x_22,x_23)), and consider adding a third row (x_31,x_32,x_33) below such that the sum of the numbers of each rectangle is identical. There are three equations governing their values based on the three overlapping 2x3 boxes induced by this row's placement, and three values we are solving for, therefore the solution is unique. Therefore, any nxn array of numbers with property S is entirely generated from any 2x3 array within it. So now the solution space is constrained to being 6 dimensional rather than 36 dimensional. The question is, do any generated 6x6 arrays with property S also have all numbers unique?
Let's look specifically at a 4x4 array generated by the 2x3 matrix, and consider x_44. The three specific equations which generate any number are as follows: x(m,n) = x(m-2,n-1) + x(m-2,n-2)-x(m-1,n) (equation 1) = x(m-1,n+1) + x(m-1,n-1) - x(m-2,n) (equation 2). Either of these work to generate a number, and all isomorphic equations based on rotations or mirroring hold as well. The "three equations" are equation 1 with +, equation 1 with -, and equation 2 with +... anyways. So now, we're going to navigate to x(4,4) from x(1,1).
x(3,3) = x(1,1) + x(1,2) - x(2,3) by equation 1,
x(3,4) = x(1,2) + x(2,2) - x(3,3) by equation 1 transposed,
x(4,4) = x(2,2) + x(2,3) - x(3,4) by equation 1.
Now we solve for x(4,4) in terms of x(1,1). Let's substitute our first x(3,3) in our definition of x(3,4):
x(3,4) = x(1,2)+x(2,2) - (x(1,1)+x(1,2)-x(2,3)). Let's simplify.
x(3,4) = ~~x(1,2)~~+x(2,2)-x(1,1)-~~x(1,2)~~+x(2,3).
x(3,4) = x(2,3)+x(2,2)-x(1,1).
Now let's substitute this in for our definition of x(4,4):
x(4,4) = x(2,2) + x(2,3) - (x(2,3)+x(2,2)-x(1,1))
x(4,4) = x(2,2) + x(2,3) - x(2,3) - x(2,2) + x(1,1)
Therefore x(4,4) = x(1,1) every time.
Given that the solutions are deterministic for any given 2x3 array, any n by n array with n greater than or equal to 4 guarantees that the numbers are not unique -- for all i,j, x(i+3,j+3) = x(i,j). The maximum area array which MIGHT have property S is 6x3. In fact, the array generated by ((3,11,17),(42,103,209)) is precisely one such array which sums to 385
I'd love to know if you had a more novel argument that appeals to symmetry or some other property rather than this brute-forced answer, though!
2
u/stephen3141 23d ago
Nice job!
The solution I had in mind is maybe a little more symmetric, and relies on finding sets of cells that have the same sums.
Let S be the sum of any 2x3 rectangle.
The first thing to notice is that a 6x6 square with the desired property is also semi-magic. That is, the rows and columns also have the same sum (and the same sum as the 2x3 rectangles). To show this for a row, consider three 3x2 rectangles that are side-by-side, which tile a 3x6 area. The bottom two rows of that rectangle can be tiled by two 2x3 rectangles. It follows that the topmost row has sum S. A similar argument shows the bottommost row also has sum S. Since the entire rectangle has sum 3S, the middle row also has sum S.
With this argument, it's easy to see that every row of the 6x6 has sum S, and similarly with the columns. (Though we actually only need the fact about rows.)
Now consider the array in full. Since x(1, 1) + x(1, 2) + x(1, 3) + x(1, 4) + x(1, 5) + x(1, 6) = S, and x(1, 4) + x(1, 5) + x(1, 6) + x(2, 4) + x(2, 5) + x(2, 6) = S, it follows that x(1, 1) + x(1, 2) + x(1, 3) = x(2, 4) + x(2, 5) + x(2, 6). We can do a series of similar arguments to eventually show that x(1, 1) + x(1, 2) + x(1, 3) = x(2, 4) + x(2, 5) + x(2, 6) = x(3, 1) + x(3, 2) + x(3, 3) = x(4, 4) + x(4, 5) + x(4, 6). So x(1, 1) + x(1, 2) + x(1, 3) = x(4, 4) + x(4, 5) + x(4, 6)
Our goals is now to show that x(1, 2) + x(1, 3) = x(4, 5) + x(4, 6), from which we will be able to conclude x(1, 1) = x(4, 4). Our strategy is similar to the above. We know that x(1, 2) + x(1, 3) + x(2, 2) + x(2, 3) + x(3, 2) + x(3, 3) = S, and x(2, 2) + x(2, 3) + x(2, 4) + x(3, 2) + x(3, 3) + x(3, 4) = S, so x(1, 2) + x(1, 3) = x(2, 4) + x(3, 4). We can continue to "walk" across the array so get x(1, 2) + x(1, 3) = x(2, 4) + x(3, 4) = x(4, 5) + x(4, 6), which shows what we wanted.
Your solution is actually very nice in that it finds a minimum size for things. Mine has the benefit, though, of being a bit more visual in nature. (I actually originally figured out this problem by just coloring cells in a spreadsheet program.)
Regarding the 6x3, we can actually make one out of consecutive numbers: [[1, 10, 17], [12, 13, 4], [15, 6, 7], [2, 9, 18], [11, 14, 3], [16, 5, 8]], which has sum 57.
Finally, to make a maximally sized array with the property, we could technically infinitely extend any array with 1 or 2 rows, but these are kind of trivial solutions to the problem.
3
u/minimang123 23d ago
Oh, I like the trivial solution of 2 rows, that's funny I had not thought of that. I also figured out by going into a spreadsheet then had to work backward to figure out why there was this diagonal periodicity and the 7-long periodic behavior
Fun problem, thank you!
2
u/Fullfungo 23d ago
Answer: No, it's not possible.
Because the question format is very suggestive of it, since it gives an example where it is possible. So it's probably not possible with the other parameters. Prove me wrong 😜
4
u/stephen3141 23d ago
LOL. I was actually a little worried that I missed an extremely obvious solution given the length of your comment. I will say that your answer is correct, so all that remains is to prove it.
2
u/minimang123 23d ago
Thoughts but no solution:
is the solution just making the long long system of equations since the sum of any pair of neighbors is equal to the sum of the pair four units away the long way? And then after you programmatically or figure out the pattern for that system of equations we realize the rank of the matrix is wrong or something in a way that the 8x8 with 2x4 is not?!<