I have come across this fact a very long time ago, but I still can't tell why is this happening.

Given the standard calculators numpad:

7 8 9
4 5 6
1 2 3

if you dial any rectangular shape, going only in right angles and each shape consisting of 4 points, then the dialed number is always divisible by 11 without a remainder.

Examples of the shapes: 1254, 3179, 2893, 8569, 2871, and so on. It is not allowed to use zero, only digits 1..9.

UPDATE: The part of the question below proved to be an error on my part because I did not double-check what the Programmers calculator was showing, and it turned out that it was rounding the results. !!! See the accepted answer for an interesting follow-up to this, which actually expands the usecase to a working hexadecimal "keypad", and the other answers for even more various interesting approaches, discovering different aspects of this problem !!!

The same rule also works even for the Programmer calculator layout on MS Windows 10 which looks like this:

A B 7 8 9
C D 4 5 6
E F 1 2 3

All valid rectangular shapes, for example, A85C, E25C, 39BF, and so on, being divided by 11 still give an integer result!

Initially I was thinking that it's just somehow tied to picking digits from the triplets and being just another peculiarity of the decimal base and number 11 and started looking this way, but discovering that it works for the hexidecimal base and even with the hex part of the keyboard layout not obeying exactly the pattern of the decimal part layout, I'm lost.

What law is this fun rule based on?

  • 14
    A number is divisible by 11 iff the alternating sum of its digits is divisible by 11. Alternating sum means a-b+c-d+... – Matthew Towers Sep 19 at 12:50
  • 1
    @m_t_ indeed, all these numbers give 0 according to this rule! So, probably the answer then lies in congruency of how the digits get arranged on the keypad, that following the mentioned shape cancels out the sum, collapsing it to zero! – noncom Sep 19 at 12:59
  • 3
    @noncom There is a different layout, other than the MS layout, which will lead to your "rectangle property" holding for that layout, for any non-prime base. You can see my edit below. – астон вілла олоф мэллбэрг Sep 19 at 13:56
  • 2
    I'm intrigued to see if the proofs below address the diagonal samples too like 2486 and the full circle set like 47896321 – Eric Kigathi Sep 19 at 18:42
  • 2
    @EricKigathi check out one of the answers by Fred vdP, he covers the diagonal case! – noncom Sep 19 at 20:25
up vote 53 down vote accepted

Since you are concerned only with rectangular patterns, you have four digit numbers in a certain base $l$, and you want to check divisibility by $11$, where $11 = l+1$.


When you have a four digit number in base $l$, write it as $al^3 + bl^2 + cl + d$, where $0 \leq a,b,c,d < l$. (This represents the $l$-base number $\overline{abcd}$). Now, we have a cute fact : $l^3 + 1$ is a multiple of $l+1$, since $l^3+1 = (l^2 - l + 1)(l+1)$. Furthermore, $l^2 - 1 = (l-1)(l+1)$. Therefore, we make the following rewrite : $$ al^3 + bl^2 + cl + d = a(l^3 + 1) + b(l^2 - 1) + c(l+1) - (a - b + c - d) \\ = (l+1)(...) + ((b+d)-(a+c)) $$

where $l+1 = 11$ in base $l$.

Therefore, the remainder when $\overline{abcd}$ is divided by $11$ is $(b+d) - (a+c)$.


When you consider four numbers ($1 \to 9$, since I found problems in the letters for hex) in a rectangle and form a four digit number out of them now, can you see why this number $(b+d) - (a+c)$ is in fact zero, therefore giving your desired result?


Now that we have pointed out this rectangular pattern, I noted above that some counterexamples did exist for the MS - layout of hexadecimal numbers. The issue there was a fairly simple one : the "matrix" of entries did not satisfy the property that $a+d = b+c$ for $a,b,c,d$ going CW/CCW around any $2\times 2$ subrectangle of entries of the matrix.

If $l-1$ is not a prime, then we can actually arrange a "matrix" of $l$ entries which is not strictly column or row, but satisfies this "rectangle property" as we can call it. For this, write $l-1 = ab$ where $a,b \neq 1$, and arrange an $a \times b$ matrix of entries, which we fill in the following fashion : start with $1$ in the bottom corner, proceed towards right filling $2,3,...$ until you hit the end, then return to the left of the row above, and fill the next number, now repeat till you fill the whole matrix.

For $10$, this procedure yields the conventional keyboard pattern. For $15 = 5 \times 3$, it would yield $$ \begin{pmatrix} B&C &D & E& F\\ 6&7&8&9&A\\ 1&2&3&4&5 \\ \end{pmatrix} $$

which indeed will satisfy the property that any rectangle has $11$ in that base as a divisor. For example, $A8DF$, $1496$ and $CE97$ are all multiples of $11$.

Note that more is true : in fact, every parallellogram , read CW or CCW, leads to a multiple of eleven.

  • 1
    Also for the 15 entry example a 3x5 might be nicer if I understand correctly. It would have the 1-9 entries would be in the same positions, just adding A-F above them. To me this feels a little nicer as it doesn't require rearranging the numbers we started with. – Chris Sep 19 at 14:59
  • 1
    That is also true : I just thought that the MS layout(now cancelled out) was $3$ rows and $5$ columns, so I wanted to match it. – астон вілла олоф мэллбэрг Sep 19 at 15:01

Start at the degenerate rectangle 1111, a multiple of 11.

Each time you move a side of your rectangle by one step in one of the 4 directions (leaving the other side in place), you add or remove one of these numbers (leading zeroes added for clarity):

  • 0011 (horizontally) or 0033 (vertically)
  • 0110 (horz.) or 0330 (vert.)
  • 1100 or 3300
  • 1001 or 3003

which are all multiples of 11 (obviously for the first three lines; 1001 = 11 * 91).

Adding such a number preserves being a multiple of 11.

This way from the degenerate rectangle 1111 you can reach any other rectangle (aligned to the numpad orientation), which prove they're all multiple of 11.

  • 3
    Hey, nice explanation! Just thinking about it, I can see that you don't necessarily have to start at 1254. Instead, you can start at 1111, which is clearly a multiple of 11. (I wouldn't be surprised if you already noticed this yourself but decided to leave it out for the sake of brevity.) – J-L Sep 19 at 18:25
  • Well I did not read the question properly that's why :-/ It's much more general than I first understood it. Will need to rework my answer... – Fred vdP Sep 19 at 18:31
  • 2
    I've completely rewritten my answer following J-L's suggestion and my widened understanding of the question. – Fred vdP Sep 19 at 19:21
  • 1
    This answer doesn't cover 2684, which is also laid out in a rectangle, and is also a multiple of 11. – Dawood ibn Kareem Sep 20 at 8:46
  • Actually, it does cover 2684, if you chose your moves cleverly enough: 1111 -> 2222 -> 2332 -> 2365 -> 2695 -> 2684. – Fred vdP Sep 20 at 14:36

Let's denote:

  • $d_1$: the left-bottom digit of such a rectangle
  • $h$: the horizontal distance (difference) to the next digit to the right
  • $v$: the vertical distance (difference) to the digit above $d_1$

Then, the entered number $n$ starting at bottom-left going counterclockwise has the digits $$n = d_1d_2d_3d_4$$

with

  • $d_2 = d_1 + h$
  • $d_3 = d_1 + h + v$
  • $d_4 = d_1 + v$

Now, we use the fact that an integer is divisible by $11$ ($n \equiv 0 \mbox{ mod } 11$) if and only if it's alternating digit sum is equal to $0$: $$d_1 - (d_1+h) + (d_1+h+v) - (d_1+v) = 0 \Rightarrow n \equiv 0 \mbox{ mod } 11$$

Note that the alternating digit sum does not change with cyclic permutations of the digits or with reverting the order of the digits (which means going clockwise along the rectangle on the number pad).

  • 3
    I think you probably need to note why we care about the alternating sum (ie "A number is divisible by 11 iff the alternating sum of its digits is divisible by 11."). Its in a comment on the question but this answer feels incomplete without it. – Chris Sep 19 at 15:02
  • @Chris Thank you. I was wondering if I missed an entire paragraph somewhere. – user1717828 Sep 19 at 19:50
  • 1
    @Chris : Thank you for this comment. I added it to my answer. I somehow thought this would be too trivial a fact to mention on this math board. But you convinced me of the opposite. – trancelocation Sep 20 at 1:17

I'll prove a little more:

If A B C D is any (possibly degenerate) parallelogram drawn in the numpad (e.g. all aligned rectangles as above like 1254 or 1364, but also non-aligned ones like 2684 and other parallelograms like 1298....) then the number ABCD is a multiple of 11.

Proof:

If digit A has coordinates $(a1, a2)$ on the numpad, B has $(b1, b2)$, C has $(c1, c2)$, D has $(d1, d2)$ then the value of A is A = $1 + a1 + 3 a2$, and similarly for B, C, D.

The parallelogram condition implies that vector AB = vector DC: $$(b1, b2) - (a1, a2) = (c1, c2) - (d1, d2)$$ that is $b1 - a1 = c1 - d1$ and $b2 - a2 = c2 - d2$.

Therefore $$(1 + b1 + 3 b2) - (1 + a1 + 3 a2) = (1 + c1 + 3 c2) - (1 + d1 + 3 d2)$$ which exacly means in term of digit values that

B - A = C + D,

equivalently D - C + B - A = 0.

Since the remainder of ABCD divided by 11 is the same as the remainder of D - C + B - A divided by 11 (rule of the alternate sums proved below), this proves that 11 divides ABCD.

(The rule of the alternate sums comes from the fact that $10 \equiv -1$ mod 11; hence $10^n \equiv (-1)^n$ mod 11 and "ABCD" = 1000 A + 100 B + 10 C + D $\equiv$ - A + B - C + D mod 11.)

Note that any four digit number made from rectangular shape can be expressed in the $2\times 2$ matrix form: $$\begin{pmatrix} a&b\\ c&d\end{pmatrix}, \\ a=\{4,5,7,8\}; b=\{5,6,8,9\};c=\{1,2,4,5\}; d=\{2,3,5,6\}.$$ Divisibility of $\overline{xyzw}$ by $11$ is: $$\overline{xyzw}\equiv (x+z)-(y+w)\equiv 0 \pmod{11}.$$ Note that for all suitable numbers: $$(a+d)-(b+c)=0.$$ The result follows.

One way to treat this is by induction. The base case 1245 is divisible by 11.

Now, given a number

XY
WZ

(that is divisible by 11 and rectangular) there are only certain operations we can do to it to keep it rectangular.

  • We can add or subtract 1 to both Y and Z to move the right edge of the rectangle. That's the same as adding or subtracting 110. Note that 110 is divisible by 11, so that transformation keeps the number divisible by 11.

  • We can increment or decrement both X and W by 1. But that's the same as adding or subtracting 1001, which is divisible by 11.

  • If we move the XY edge, that correponds to a step size of 1100, again divisible by 11.

  • And if we move the WZ edge, why that is 11.

With these four edge-moving rules, we can obtain any rectangle and thus any rectangular number, and we see that if we start from 1245, all the rectangular numbers that we can reach are reached by adding or subtracting multiples of 11.

Q.E.D.

But, okay wait, so why does the base case exist? This 1245 seems rather arbitrary; we can't be satisfied with a weird base case. We want induction base cases in math proofs to be nice specimens like 0 or 1, or other simple objects for which the sought-after proposition is obvious, not merely true. Why is this 1245 divisible by 11 in the first place, like those edge-movement rules?

To investigate further, what if we allow 1x1 rectangles with repeated digits, as well as 2x2 rectangles? We can then make the base case 1111 where the rectangle is just the digit 1. That is obviously divisible by 11, of course! It's just 11 * 100 + 11. Just like 7373 is divisible by 73, and 232323 is divisible by 23 (23 * 10000 + 23 * 100 + 23). The colloquial "no brainer": that reasonably elementary base case that placates our curiosity.

Starting with that 1111 rectangular number, we can move the edges according to the four rules above. The divisibility holds accordingly because nowhere in our edge-moving rules have we encoded any prohibition against X, Y, Z and W being the same integer.

And so all the other 1x1 rectangles are also divisible by 11: 2222, 3333, 4444, 5555, 6666, 7777 and 9999. Of course: these integers are multiples of 1111, which is a multiple of 11.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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