# Preserving the bitwise dot product distributive property

We can define the bitwise dot product as the dot product between the vectors of the binary bit representations of two numbers. E.g.

$$5\cdot 7 = (1,0,1)\cdot(1,1,1) = 2$$

But curiously, this dot product does not always obey the distributive property. For example,

$$8\cdot 7 = (1,0,0,0)\cdot(0,1,1,1) = 0$$

but

$$(6\cdot7) + (2\cdot7) = 2 + 1 = 3 \equiv 1 \;\text{mod}\;2$$

This dot product does distribute (mod 2) if you ignore the carry when adding (so that 6+2 = 4), so something about the carry breaks the property. How do you prove this mathematically?

• When you add, the value of a bit depends on all of the sums to its right. This is not true of your bitwise AND. – amd Nov 2 '18 at 0:18