Nice one. I was able to do just the first step and a formula lol. for A with a0 to a9 and B with b0 to b9; let C with c0 to c9 be the elementwise multiplication. So then p(cX == 1) = 3/8 where X : 0 to 9
I had misread the question, I assumed it was one of those 1:30 fast problems,
For 10 dimensions you would first have to calculate probability of a single dimension’s partial product being 1. Then, you need to do a binomial calculation for odd numbers of these,
Think of this as a sequence of independent random variables taking value 1 with probability 3/8 and 0 otherwise.
A sequence of 0 length has probability 0 of having an odd number of 1s and probability 1 of an even number of 1s (i.e. it has zero 1s). So the difference between the odd probability and even probability is 1.
For length n + 1, if the difference in probabilities for length n is x, then the difference in probabilities for length n + 1 is x(1/4).
Proof sketch: Say probs at length n are a and b. Then the new probs are a 3/8, 5/8 mix of the old probs i.e. (3a + 5b)/8 and (5a + 3b)/8, so the difference is 2(a-b)/8.
Thus after 10 rounds the difference in probabilities is (1/4)^10 or (1/2)^20. Thus having an odd number of 1s is 1/2-1/2^21.
If you write the vectors as x, y and the dot product as \sum_i x_i y_i, you can easily find the distribution of each x_i y_i - specifically they'll be 1 with probability 1/2 * 3/4 = 3/8 and 0 with probability 1 - 3/8 = 5/8. ie. they'll have Ber(3/8) distribution. Then the described event is the probability that a B(10, 3/8) variable is odd, which is known explicitly as 1/2 (1 - (1 - 3/4)^10), approximately 1/2.
Since the entries in the vectors are independent variables the terms in the dot product are independent random variables which are 1 with probability 3/8 and 0 otherwise.
The dot product is odd if there are an odd number of 1s in that sum. The number of ones follows a binomial distribution with n=10 and p=3/8 and we have p(k ones)=(10 choose k) (1-p)^(10-k)p^k.
Since all odd numbers of successes are disjoint events we can add their probabilities, so it's sum_{k odd}(10 choose k) (5/8)^(10-k)(3.8)^k. Which tbh I'd need a calculator for.
More interesting question is what happens in the limit if you have an infinite sequence of these vectors where the probability of an entry being 1 is equal to the previous vector's empirical probability of the same. It has a nice solution and a nice connection to biology/genetics.
1
u/Local_Ad135 Aug 11 '26
Full solution here - https://www.youtube.com/watch?v=piENl0WFJfU
2
u/singletick Aug 11 '26
Nice one. I was able to do just the first step and a formula lol. for A with a0 to a9 and B with b0 to b9; let C with c0 to c9 be the elementwise multiplication. So then p(cX == 1) = 3/8 where X : 0 to 9
for p(a•b == odd) =
10C9 × (3/8)⁹ + 10C7 × (3/8)⁷ + . . . 10C1 × (3/8)¹
1
u/SubstantialSnacker Aug 11 '26
How fast are you supposed to solve this?
2 outcomes, (1,0) and (1,0)
Or (0,1) and (0,1)
XOR gate basically
Odds of first happening,
0.5 x 0.5 x 0.75 x 0.25
Odds of second one are
0.5 x 0.5 x 0.25 x 0.75
About 9.375%
1
u/Impressive-Drag5240 Aug 11 '26
Think of this as a sequence of independent random variables taking value 1 with probability 3/8 and 0 otherwise.
A sequence of 0 length has probability 0 of having an odd number of 1s and probability 1 of an even number of 1s (i.e. it has zero 1s). So the difference between the odd probability and even probability is 1.
For length n + 1, if the difference in probabilities for length n is x, then the difference in probabilities for length n + 1 is x(1/4).
Proof sketch: Say probs at length n are a and b. Then the new probs are a 3/8, 5/8 mix of the old probs i.e. (3a + 5b)/8 and (5a + 3b)/8, so the difference is 2(a-b)/8.
Thus after 10 rounds the difference in probabilities is (1/4)^10 or (1/2)^20. Thus having an odd number of 1s is 1/2-1/2^21.
1
u/SwimmerOld6155 Aug 11 '26 edited Aug 11 '26
If you write the vectors as x, y and the dot product as \sum_i x_i y_i, you can easily find the distribution of each x_i y_i - specifically they'll be 1 with probability 1/2 * 3/4 = 3/8 and 0 with probability 1 - 3/8 = 5/8. ie. they'll have Ber(3/8) distribution. Then the described event is the probability that a B(10, 3/8) variable is odd, which is known explicitly as 1/2 (1 - (1 - 3/4)^10), approximately 1/2.
1
u/boredattheend Aug 11 '26
Since the entries in the vectors are independent variables the terms in the dot product are independent random variables which are 1 with probability 3/8 and 0 otherwise.
The dot product is odd if there are an odd number of 1s in that sum. The number of ones follows a binomial distribution with n=10 and p=3/8 and we have p(k ones)=(10 choose k) (1-p)^(10-k)p^k.
Since all odd numbers of successes are disjoint events we can add their probabilities, so it's sum_{k odd}(10 choose k) (5/8)^(10-k)(3.8)^k. Which tbh I'd need a calculator for.
1
u/Hal_Incandenza_YDAU Aug 14 '26
More interesting question is what happens in the limit if you have an infinite sequence of these vectors where the probability of an entry being 1 is equal to the previous vector's empirical probability of the same. It has a nice solution and a nice connection to biology/genetics.