# Understanding Weird Relationship Between Hamming Weights

I have two binary "mapping" matrices $$\delta_0$$ and $$\delta_1$$

$$\delta_0 = \begin{bmatrix} 1 0 1 0 0 0 0 0\\ 1 1 0 1 1 1 1 0\\ 0 0 0 0 1 1 0 0\\ 0 1 1 1 0 0 0 0\\ 0 1 1 0 1 0 0 0\\ 1 0 0 1 1 1 0 0\\ 0 0 1 1 0 1 0 0\\ 0 0 0 0 0 0 1 1\\ \end{bmatrix}$$

$$\delta_1 = \begin{bmatrix} 1 0 1 0 0 0 1 0\\ 1 1 0 1 0 0 0 0\\ 0 0 0 0 0 0 1 0\\ 1 0 1 0 1 1 1 0\\ 0 0 0 1 0 1 0 0\\ 1 0 0 0 0 1 0 0\\ 0 0 0 1 0 0 1 0\\ 0 1 1 1 0 1 1 1 \end{bmatrix}$$

The least significant bit is in the bottom right. The most significant bit is in the top left.

Their purpose is to map binary values in a finite field GF($$2^8$$) into another. This involves multiplying each possible element by each matrix.

I map the elements 0-255 for both matrices. Computed using $$\delta_i\times x$$ mod 2 for $$x$$ 0-255 in binary. I know have two matrices which contain 256 "mapped" values.

I take the a hamming weight of each mapped value. This computes the number of '1' bits in each mapped entry. I keep it in order.

I then take the co-variance of the hamming weights and I find it equals zero.

Ok, that particular order results in a covariance zero.

But now I keep the hamming weight array of $$\delta_0 \times x$$ mod 2 the same. And for the second mapping I do $$\delta_1 \times (x\oplus c)$$ mod 2. Where $$c$$ is a constant 8 bit value and $$\oplus$$ is the XOR operator. I take the hamming weight of these mapped values.

I calculate the co-variance of the hamming weight arrays and it is zero again. For every possible 8 bit value of $$c$$ I find the co-variance is zero.

Adding a constant $$r$$ doesn't change the distribution of the hamming weights but I would expect the co-variance to change now that the order is different.

I am kind of lost why the co-variance remains zero. I believe that co-variance is heavily dependent on order, so I assume that add $$c$$ would change the order enough to cause the co-variance to fluctuate. Is there something I m missing?

• Elements of finite fields don't have least significant or most significant bits. And I don't understand how $GF(256)$ fits into this scheme at all. All I see is two 8x8 matrices with entries in $GF(2)$. Sure you can multiply (from the left) 8x1 column vectors of bits with those matrices, and calculate some correlations. But what does any of that to do with $GF(256)$? You lost me somewhere. – Jyrki Lahtonen Mar 12 at 7:41
• If the matrices are invertible, then going through all the numbers $0-255$ will simply shuffle them; adding $c$ will not make any difference. The covariance is the sum of products over all the numbers, hence it is the same in both cases. – Chrystomath Mar 12 at 11:02
• Sorry they are elements in $GF(2^8)$ I edited my question – jackana3 Mar 12 at 12:07
{"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 14, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "url": "https://math.stackexchange.com/questions/3144438/understanding-weird-relationship-between-hamming-weights", "fetch_time": 1556157451000000000, "content_mime_type": "text/html", "warc_filename": "crawl-data/CC-MAIN-2019-18/segments/1555578678807.71/warc/CC-MAIN-20190425014322-20190425040322-00147.warc.gz", "warc_record_offset": 482729096, "warc_record_length": 32530, "token_count": 934, "char_count": 2798, "score": 3.5625, "int_score": 4, "crawl": "CC-MAIN-2019-18", "snapshot_type": "latest", "language": "en", "language_score": 0.849143385887146, "file_path": "/sailhome/yjruan/project/latent-lm/data/processed/finemath-4plus/finemath-4plus/train-00050-of-00064.parquet"}