Leo’s first theorem

I learnt the following from my son Léo: the teacher asks to compute 9+9; that’s easy
9\ +\ 9\ =\ 18.
But no! The actual question is to compute 9 times 9! We must correct this! But it’s just as easy without starting from scratch: we turn the “plus” cross a quarter turn on the left-hand side:
9\ \times\ 9
and then switch the digits on the right-hand side:
9\ \times\ 9\ =\ 81.

This is a fun little random fact about integers and decimal expansions, certainly.

But there’s a bit more to it than that: it is in fact independent of the choice of base 10, in the sense that if we pick any other integer b\geq 2, and consider base b expansions, then we also have

(b-1)\ +\ (b-1)\ =\ 2b-2\ =\ b+(b-2)= \underline{1}\,\underline{b-2}

as well as

(b-1)\ \times\ (b-1)\ =\ (b-1)^2=b(b-2)+1= \underline{b-2}\,\underline{1},

(where we underline individual digits in base b expansion.)

At this point it is natural to ask if there are any other Léo-pairs (x,y) to base b, i.e., pairs of digits in base b such that the base b expansions of the sum and the product of x and y are related by switching the two digits (where we always get two digits in the result by viewing a one-digit result z as \underline{0}\, \underline{z}).

It turns out that, whatever the base b, the only such pairs are (b-1,b-1) and the “degenerate” case (0,0).

To see this, there are two cases: either the addition x+y leads to a carry, or not.

If it does, this means that y=b-z where x>z. The sum is then

x+y=b+(x-z)=\underline{1}\,\underline{x-z}.

So this is a Léo-pair if and only if

xy=\underline{x-z}\,\underline{1}.

This equation, in terms of x and z, becomes

x(b-z)=b(x-z)+1,

which holds if and only if z(b-x)=1. Since the factors are integers and non-negative, this is only possible if z=b-x=1, which means x=y=b-1, the solution found by Léo.

Now suppose there is no carry. This means that we have 0\leq x,y\leq b-1 and x+y\leq b-1. Then
x+y=\underline{0}\,\underline{x+y},
and we have a Léo-pair if and only if
xy=\underline{x+y}\,\underline{0},
i.e., if and only if xy=b(x+y).

This is not an uninteresting little equation! For a fixed b (which could now be any non-zero rational), this defines a simple quadratic curve. Without the restrictions on the size of the solution (x,y), there is always a point on this curve, namely
(x_0,y_0)=(2b,2b).
This does not fit our conditions, of course. But we can use it to find all other integral solutions, as usual for quadratic curves. First, any line through (x_0,y_0) intersects the curve in a a second point, which has rational coordinates if the line is also defined by rational coefficients, and conversely.

Doing this, some re-arranging and checking leads to the parameterization

\begin{cases} x=b+k\\  y=b+\frac{b^2}{k}\end{cases}

of the rational solutions to xy=b(x+y), where k is an arbitrary non-zero rational number. In this case, this can also be found more easily by simply writing the equation in the form
0=xy-bx-by=(x-b)(y-b)-b^2\ldots

Now assume that b\geq 2 is an integer, and we want (x,y) to be integers. This holds if and only if k is an integer such that k\mid b^2.

Such solutions certainly exist, but do they satisfy the digit condition? The answer is yes if and only if k=-b, which means x=y=0, giving the expected degenerate pair. Indeed, to have x<b, the parameter k must be a negative divisor of k^2. We write k=-d with d\mid k^2 positive. Then to have non-negative digits, we must have
\begin{cases} x=b-d\geq 0\\ y=b-\frac{b^2}{d}\geq 0\end{cases},
the first one of these inequalities means b\geq d, while the second means that b\leq d

Published by

Kowalski

I am a professor of mathematics at ETH Zürich since 2008.