Leo’s first theorem

I learnt the following from my son Léo: the teacher asks to compute $latex 9+9$; that’s easy
$latex 9\ +\ 9\ =\ 18.$
But no! The actual question is to compute $latex 9$ times $latex 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:
$latex 9\ \times\ 9$
and then switch the digits on the right-hand side:
$latex 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 $latex 10$, in the sense that if we pick any other integer $latex b\geq 2$, and consider base $latex b$ expansions, then we also have

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

as well as

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

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

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

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

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

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

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

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

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

This equation, in terms of $latex x$ and $latex z$, becomes

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

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

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

This is not an uninteresting little equation! For a fixed $latex b$ (which could now be any non-zero rational), this defines a simple quadratic curve. Without the restrictions on the size of the solution $latex (x,y)$, there is always a point on this curve, namely
$latex (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 $latex (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

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

of the rational solutions to $latex xy=b(x+y)$, where $latex 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
$latex 0=xy-bx-by=(x-b)(y-b)-b^2\ldots$

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

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

Published by

Kowalski

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