0

Problem statement:

In a binary code, each code word has 6 bits, each of which is 0 or 1. What is the probability that a random code word (a) has three 0’s and three 1’s?

Approach: number of distinct nonnegative integer solutions is given by ${n+k-1 \choose {k-1}}$ which gives us ${8 \choose 5}$ when n=3, so the probability is $\frac{{8 \choose 5}}{2^6}$

This is probably wrong since a linear equation can have coefficients > 1 as well.

I am probably overcomplicating this problem. I found it difficult to determine what to choose and what to choose out of, when trying to calculate the number of combinations of three 1's and three 0's.

  • 3
    There are $6$ positions, choose (exactly) $3$ of them to set to $0$. – peterwhy Jul 19 '22 at 01:54
  • the part Im struggling with is "to be 0." How do I make sure that the digits I am choosing are 0? – a6i09per5f Jul 19 '22 at 01:55
  • 2
    More clearly: starting from the code word $111111$ with all bits set, choose $3$ positions to set to $0$. This will reach any code word that has three 0's and three 1's. – peterwhy Jul 19 '22 at 02:04
  • so ${2^3 \choose 3}$ because there are $2^3$ combinations if three digits are set. – a6i09per5f Jul 19 '22 at 02:07
  • 3
    No, there are $6$ bit positions where you choose $3$ of them, so the numerator is $\binom 63$. – peterwhy Jul 19 '22 at 02:11

1 Answers1

1

As other responses have indicated, the correct computation of the numerator is $~\displaystyle \binom{6}{3} = 20$, since that represents the number of ways of selecting which three positions will be $(0)$'s, rather than $(1)$'s.

The original poster (i.e. OP) chose an unusual approach that is feasible, but more difficult.

The original poster computed the number of non-negative solutions to

$$x_1 + x_2 + x_3 + x_4 + x_5 + x_6 = 3. \tag1 $$

I regard this approach as flawed, but very creative.

It is true that the number of non-negative solutions to (1) above is in fact $~\displaystyle \binom{8}{5} = 56~$, just as the OP indicated.

The flaw is that included in the $(56)$ solutions to (1) above, are instances where one or more of the variables is greater than $(1)$, which makes the solution off-limits.

The remedy is to attach the constraint that none of the variables $x_1, x_2, \cdots, x_6$ can be greater than $(1)$.

For a general approach on how to add an upper bound on variables, in what becomes an [Inclusion-Exclusion : Stars and Bars] problem, see the theory in this answer.

user2661923
  • 42,303
  • 3
  • 21
  • 46