# Zhegalkin matrix

 ANF   matrix   twins noble   gentle smallest Zhegalkin index

The Zhegalkin matrix is an infinite binary matrix.

It is closely related to the infinite integer matrix of Gray code permutation powers () and to the algebraic normal form (ANF) of Boolean functions.
(Ivan Zhegalkin was the inventor of the ANF. The naming choices made here are new.)

Its colums are the truth tables of all Boolean functions. The column index is the Zhegalkin index of the respective Boolean function.

Its rows are a subset of the Walsh functions, namely the XORs of atoms forming a Sierpiński triangle ().

## Zhegalkin permutation

 ${\displaystyle n}$ ${\displaystyle 2^{n}\times 2^{2^{n}}}$ 0 1 2 3 4 1×2 2×4 4×16 8×256 16×65536

For arity ${\displaystyle n}$ the map from ANFs to truth tables gives a finite Zhegalkin matrix of size ${\displaystyle 2^{n}\times 2^{2^{n}}}$. (It is the top left corner of the infinite matrix.)

It can be interpreted as a permutation of the integers ${\displaystyle 0~...~2^{2^{n}}-1}$, which shall be called Zhegalkin permutation ${\displaystyle \Pi _{n}}$.
Keys and values in Πn shall be called Zhegalkin twins — e.g. 7 and 9 are Zhegalkin twins for arity 2.

It is a self-inverse Walsh permutation of degree 2n. The corresponding element of GL(2n, 2) is the lower Sierpiński triangle.
Π2 is a Walsh permutation of degree 4, and permutes the integers 0 ... 15. The corresponding element of GL(4, 2) is the 4×4 lower Sierpiński triangle.

${\displaystyle \Pi }$

Fixed points are in parentheses.

     k   0   1   2   3   4   5   6   7   8   9  10  11  12  13  14  15
n
0       (0) (1)
1       (0)  3  (2)  1
2       (0) 15  10   5  12   3  (6)  9  (8)  7   2  13   4  11 (14)  1


In a finite Zhegalkin matrix, the columns with even/odd weight are in the left/right half.   (A truth table has a Zhegalkin twin with odd weight, iff its last digit is true.)
Boolean functions whose Zhegalkin index has even/odd weight shall be called evil/odious, which shall be called its depravity.

### fixed points

 ${\displaystyle n}$ ${\displaystyle 2^{2^{n-1}}}$ 1 2 3 4 5 2 4 16 256 65536

The fixed points of Zhegalkin permutations correspond to noble Boolean functions.

${\displaystyle \Phi _{n}~~=~~\{i\mid \Pi _{n,~i}=i\}}$
     k  0   1   2   3   4   5   6    7    8    9   10   11   12   13   14   15
n
0       0
1       0   2
2       0   6   8  14
3       0  30  40  54  72  86  96  126  128  158  168  182  200  214  224  254