N is a 3x3 square grid which is constituted by using each of the digits from 1 to 9 exactly once.
Determine the probability that the first digit minus the second digit plus the third digit in each row (reading left to right), each column (reading top to bottom), and each main diagonal (reading top to bottom) of N is the same.
Let the grid be
a b c
d e f
g h i
and the constant for all rows, columns and diagonals = x
1) Let's calculate x and e
Well, x = a - b + c
x = d - e + f
x = g - h + i
2x = 2(b - e + h)
Summing the equations gives
5x = a + b + c + d - 3e + f + g + h + i
= (a + b + c + d + e + f + g + h + i) - 4e
= 45 - 4e
x = 9 - (4e/5)
x is integral only if e = 5, in which case x is also = 5.
2) Let's consider the parity of the numbers.
Assume a is odd.
Then i needs to be odd also, because a + i = x + e = 10.
o) Can c be odd if a is odd?
No it, cannot, because then g is also odd.
But if a and c and g and i are all odd, then
considering the 1st and 3rd rows and columns,
we see that b and d and e and f also need to be odd.
Thus, all 9 numbers need to be odd, which is not possible.
o) Can c be even if a is odd?
No it, cannot, because then g is also even.
But if a and i are odd, and c and g are all even, then
considering the 1st and 3rd rows and columns,
we see that b and d and e and f also need to be even.
Thus, 6 of the 9 numbers need to be even,
which is not possible.
Therefore, a must be even.
Similarly, all of the other corners must be even.
3) So how many different valid arrangements are there, given that we know that e = 5, the constant = 5, and the corners must all be even?
2 can be one of 4 values (a or c or g or i).
8 must be the opposite corner.
4 can be either of the 2 remaining corners.
Having placed 2 and 4, the "magic grid" is completely determined.
There are only 2 x 4 = 8 combinations, which agrees with the computer solutions.
4) And what is the probability of a valid arrangement?
As previously noted, total combinations = 9!
Probability 8/9! = 1/45360