Low Lying Island

(math) Alternating Binary Expansions are Unique

It is an undeniable truth of the universe that every natural number n can be expressed uniquely as a sum of decreasing powers of 2. This decomposition is known as the binary expansion of n. For instance, the number 45 can be written as 25+23+22+20 which is 32+8+4+1. We can write this snugly using binary notation as 45=(101101)2.

A natural number can can also be decomposed using an alternate binary expansion, which is an alternating sum of decreasing powers of 2. The word alternating here means that you add the first term, subtract the second, then add the third, then subtract the fourth and so on. The number 45 has the alternating binary expansion 2625+2422+2120 which in numbers is 6432+164+21. In alternating binary notation, we write 45=[1110111]2 My emphasis on the in the previous sentence should convey that even this alternate binary expansion is unique. Let's see why. Take this time to think about the above example and if you can figure out what I did to come up with the expansion. We also pose the constraint that an alternating sum must contain at least two terms otherwise something like 2k=2k+12k messes up with uniqueness.

The following is due to my friend, C. Consider a section of repeating 1s in the binary expansion which begins with a 0 to the left. Note that the first chunk of 1s begins with an implicit 0. We replace each chunk of 011 (containing n 1s) by 1001 (containing n1 0s). This is the same as replacing 2k+2k1++2l by 2k+12l. To show that this indeed works, we add 2l to the long expression, and the rightmost entry becomes 2l+1 which then adds to the adjacent 2l+1 to give 2l+2 and so on. Much like the game 2048, all the terms collapse into each other leaving us with 2k+1. So, in the following example

(110011110110001)2 maps to [1010100011010011]2

Let us now show that the alternating binary expansions are unique using induction on the natural number n for which we are finding the expansion. The base case of n=1 is trivial as 1=21, and we assume uniqueness for all k<n. What can the leading power of 2 in the expansion of n be? If we begin with 2k, then by the alternating condition it is not possible for us to bring the sum down below 2k1. This constraint means that 2k must be the binary power closest to n and bigger than n. Once we have that sorted, let m=2kn. As n is bigger than 2k1, we have m<2k1<n. By the induction hypothesis, the alternating binary expansion of m is unique! Let m=2r02r1++(1)k2rk, which means that n=2km has a unique alternating binary expansion given by n=2k2r0+2r1+(1)k+12rk.

And that shows our result! I don't think this statement is true for other bases. For instance in ternary, we have 5=[21]3=[122]3 as 2×31=1×92×3+2. Maybe there is an analog of alternating that is true in these bases, but that remains to be seen!