Representation of complex numbers in redundant numeration systems | w-NAF representations of complex integers

In Chapter 1, we extended the standard binary system by adding the digit βˆ’1, creating a system where a number can have multiple representations, then restricted it to NAF representations, which once again guaranteed uniqueness while also decreasing the average ratio of non-zero digits in a representation. In this chapter, we will show analogous systems for the Gaussian and Eisenstein integers.

Gaussian integers

We shall start by adding the digit βˆ’1 to the Penney system; that is, we use Ξ²=iβˆ’1,π’Ÿ={0,Β±1}. The natural question is whether every Gaussian integer has a NAF representation in this system. It is not hard to find that the answer is negative. For example, the number i is odd, so its representation would have to end in either 1 or βˆ’1, but after subtracting either digit and dividing by iβˆ’1, we are left with another odd number, forcing us to add another non-zero digit.

However, we can add two more digits without violating the useful property that the set of digits is closed under multiplication: i and βˆ’i. As with βˆ’1, we will denote βˆ’i as iβ€Ύ when used as a digit. The resulting system is the main subject of this project, so we shall give it a name.

Definition 2.1. The extended Penney system is the positional numeration system with Ξ²=iβˆ’1 and π’Ÿ={0,Β±1,Β±i}.

Obviously, most Gaussian integers can be represented in multiple ways in this system. However, they can even have multiple NAF representations, for example (1)iβˆ’1=(i01β€Ύ)iβˆ’1=1. This suggests that we could restrict the possible representations even further in order to possibly obtain even better results in terms of average weight. It turns out that a simple generalization of the NAF condition is sufficient.

Definition 2.2. Let wβˆˆβ„•+. A positional representation (xn,…,x0) is in w-non-adjacent form (w-NAF) if every contiguous subsequence of length at most w contains at most one non-zero digit, that is, βˆ€kβˆˆβ„•,W(xk+wβˆ’1,…,xk)≀1.
Note. If all non-zero digits have an absolute value of 1, Definition 2.2 can be equivalently written in a more compact, but also more obfuscated way: βˆ€kβˆˆβ„•,βˆ‘j=kk+wβˆ’1|xj|≀1.
Note. Trivially, every representation is 1-NAF and the 2-NAF condition is equivalent to the original NAF condition.
Lemma 2.3. Let x be an odd Gaussian integer. Then there exists exactly one x0∈{Β±1,Β±i} such that x≑x0(mod2+2i).
Proof. Notice that (2+2i)|4. Let x=a+bi,a,bβˆˆβ„€. Consider the possible congruence classes of a,b modulo 4, which cannot have the same parity since x is odd: This shows that x0 exists. It is also unique because none of {Β±1,Β±i} are congruent modulo 2+2i.
Theorem 2.4. Every xβˆˆβ„€[i] has exactly one reduced 3-NAF representation (xn,…,x0) in the extended Penney system.
Proof. Once again, we will use a modular algorithm to find the representation. If x is even, then the last digit has to be 0. If x is odd, we have a choice between four digits: Β±1 and Β±i, but in order to fulfill the 3-NAF constraint, we need the following two digits to be zeros, meaning that xβˆ’x0 has to be divisible by (iβˆ’1)3=2+2i. Lemma 2.3 ensures that there is precisely one choice. Either way, we continue by finding the representation of xβˆ’x0iβˆ’1. It remains to be proven that this procedure terminates. This can be done using the exact same argument as in the proof of Theorem [t-penney-uniq], except with different representations for small numbers: 0=()iβˆ’1,1=(1)iβˆ’1,i=(i)iβˆ’1,βˆ’1=(1β€Ύ)iβˆ’1,βˆ’i=(iβ€Ύ)iβˆ’1,1+i=(iβ€Ύ0)iβˆ’1,βˆ’1+i=(10)iβˆ’1,βˆ’1βˆ’i=(i0)iβˆ’1,1βˆ’i=(1β€Ύ0)iβˆ’1,2=(i00)iβˆ’1,2i=(1β€Ύ00)iβˆ’1,βˆ’2=(iβ€Ύ00)iβˆ’1,βˆ’2i=(100)iβˆ’1,2+i=(100iβ€Ύ)iβˆ’1,βˆ’1+2i=(i001)iβˆ’1,βˆ’2βˆ’i=(1β€Ύ00i)iβˆ’1,1βˆ’2i=(iβ€Ύ001β€Ύ)iβˆ’1,1+2i=(1001β€Ύ)iβˆ’1,βˆ’2+i=(i00iβ€Ύ)iβˆ’1,βˆ’1βˆ’2i=(1β€Ύ001)iβˆ’1,2βˆ’i=(iβ€Ύ00i)iβˆ’1.
Example. Let us find the 3-NAF representation of βˆ’3+11i in the extended Penney system. Because the number is even, we start by writing a 0 and dividing by iβˆ’1: βˆ’3+11iiβˆ’1=7βˆ’4i. This number is odd, so we have to find an x1∈{Β±1,Β±i} such that x1≑7βˆ’4i(mod2+2i). We choose x1=βˆ’1 because (7βˆ’4i)βˆ’(βˆ’1)=8βˆ’4i is divisible by 2+2i. Now, we could divide 8βˆ’4i by iβˆ’1 and continue. However, we know that the next two digits will be zeros, so we might as well write them immediately and divide by 2+2i directly: 8βˆ’4i2+2i=1βˆ’3i. We see that this is an even number, so we write another 0 and divide by iβˆ’1, yielding βˆ’2+i. This number is odd, so we need to find a digit which, when subtracted, gives a number divisible by 2+2i. Such a digit is βˆ’i, giving βˆ’2+2i. Again, we can write two zeros and directly divide by 2+2i, getting i. This is just a single digit, so we write it down and terminate, getting the result βˆ’3+11i=(i00iβ€Ύ0001β€Ύ0)iβˆ’1.

Now that we have proven that the 3-NAF extended Penney system is usable for uniquely (up to leading zeros) representing Gaussian integers, the next step is to find out how it performs in terms of the Hamming weight. Like in Lemma [t-naf-subst], it can be proven that every possible extended-Penney representation can be converted into an equivalent 3-NAF representation using a set of substitutions that never increase the Hamming weight. However, this set consists of a total of 312 substitutions and requires temporarily switching to a larger set of digits. Therefore, we are going to avoid this method of proving the optimality of the representations and leave it for the next chapter, which is going to introduce a transducer for converting any representation to 3-NAF. What we can prove right now, however, is a result analogous to Theorem [t-naf-ratio]: the asymptotic behavior of the ratio of non-zero digits to all digits.

Theorem 2.5. Let an be the number of all (not necessarily reduced) 3-NAF extended Penney system representations of length n and bn the sum of the Hamming weights of these representations. Then limnβ†’βˆžβ‘bnnan=14. That is, for an average sufficiently long 3-NAF extended Penney system representation, about 14 of its digits are non-zeros.
Proof. Let us find an explicit formula for an and bn. We can think of 3-NAF extended Penney system representations as consisting of five kinds of β€œblocks”: 0,00i,001,001β€ΎΒ andΒ 0iβ€Ύ. Note that these blocks can only be used to construct representations starting with two zeros, so we are actually expressing anβˆ’2 and bnβˆ’2, but this does not matter when nβ†’βˆž. Analougously as in the proof of Theorem [t-naf-ratio], we derive an=βˆ‘k=0∞4k(nβˆ’2kk), bn=βˆ‘k=0∞k4k(nβˆ’2kk) and find a recurrence relation for an: an=βˆ‘k=0∞4k(nβˆ’2kk)=βˆ‘k=0∞4k(nβˆ’2kβˆ’1k)+βˆ‘k=0∞4k(nβˆ’2kβˆ’1kβˆ’1)=βˆ‘k=0∞4k(nβˆ’2kβˆ’1k)+βˆ‘k=βˆ’1∞4k+1(nβˆ’2kβˆ’3k)=βˆ‘k=0∞4k(nβˆ’2kβˆ’1k)+4βˆ‘k=0∞4k(nβˆ’2kβˆ’3k)=anβˆ’1+4anβˆ’3. Solving this recurrence using its characteristic polynomial Ξ»3βˆ’Ξ»2βˆ’4=(Ξ»βˆ’2)(Ξ»2+Ξ»+2)=(Ξ»βˆ’2)(Ξ»βˆ’ΞΊ)(Ξ»βˆ’ΞΊβ€Ύ), where ΞΊ=βˆ’1+7i2, we get an=Ξ±2n+Ξ²ΞΊn+Ξ³ΞΊβ€Ύn for some Ξ±,Ξ²,Ξ³βˆˆβ„‚. Finding a recurrence for bn: bn=βˆ‘k=0∞k4k(nβˆ’2kk)=βˆ‘k=0∞k4k(nβˆ’2kβˆ’1k)+βˆ‘k=0∞k4k(nβˆ’2kβˆ’1kβˆ’1)=βˆ‘k=0∞k4k(nβˆ’2kβˆ’1k)+βˆ‘k=βˆ’1∞(k+1)4k+1(nβˆ’2kβˆ’3k)=βˆ‘k=0∞k4k(nβˆ’2kβˆ’1k)+4βˆ‘k=0∞k4k(nβˆ’2kβˆ’3k)+4βˆ‘k=0∞4k(nβˆ’2kβˆ’3k)=bnβˆ’1+4bnβˆ’3+4anβˆ’3=bnβˆ’1+4bnβˆ’3+4Ξ±2nβˆ’3+4Ξ²ΞΊnβˆ’3+4Ξ³ΞΊβ€Ύnβˆ’3 Homogenous solution: bnhom=Ξ±~2n+Ξ²~ΞΊn+Ξ³~ΞΊβ€Ύn Particular solution: bnpar=ΞΌn2n+Ξ½nΞΊn+Ο‰nΞΊβ€Ύn It is evident from the proof of Theorem [t-naf-ratio] that we only need to find the value of ΞΌ, since |ΞΊ|=2<2. Therefore, when substituting in the recurrence, we only consider terms with 2n: ΞΌn2nβˆ’ΞΌ(nβˆ’1)2nβˆ’1βˆ’4ΞΌ(nβˆ’3)2nβˆ’3=4Ξ±2nβˆ’3 ΞΌ(nβˆ’nβˆ’12βˆ’nβˆ’32)=Ξ±2 ΞΌ=Ξ±4β‰ 0 Substituting into the limit: limnβ†’βˆžβ‘bnnan=limnβ†’βˆžβ‘Ξ±~2n+Ξ²~ΞΊn+Ξ³~ΞΊβ€Ύn+Ξ±4n2n+Ξ½nΞΊn+Ο‰nΞΊβ€ΎnΞ±n2n+Ξ²nΞΊn+Ξ³nΞΊβ€Ύn=14

Notice that this is more efficient in terms of the non-zero digits ratio than if we were to represent Gaussian integers by representing the real and imaginary parts separately using the binary NAF system, which would yield a ratio of 13 as shown in Theorem [t-naf-ratio].

Eisenstein integers

Just like we extended the Penney system to allow for NAF representations of Gaussian integers, we can try to extend the system for representing Eisenstein integers with Ξ²=Ο‰βˆ’1,π’Ÿ={0,1,Ο‰+1}.