MHB How many bytes contain exactly two 1's?

  • Thread starter Thread starter find_the_fun
  • Start date Start date
  • Tags Tags
    bytes
Click For Summary
SUMMARY

The discussion centers on calculating the number of 8-bit binary sequences containing exactly two 1's. The correct calculation is given by the binomial coefficient \binom{8}{2}, which equals 28. This is derived from selecting 2 positions for the 1's out of 8, while the order of selection does not matter. The confusion arises from misunderstanding the arrangement of the remaining 6 bits, which must all be 0's, leading to a single valid configuration for those bits.

PREREQUISITES
  • Understanding of binary representation and bit manipulation
  • Familiarity with combinatorial mathematics, specifically binomial coefficients
  • Knowledge of basic probability concepts
  • Ability to interpret mathematical notation and expressions
NEXT STEPS
  • Study the concept of binomial coefficients in combinatorics
  • Learn about permutations and combinations in probability theory
  • Explore binary encoding and its applications in computer science
  • Investigate the implications of bit manipulation in programming languages
USEFUL FOR

Mathematicians, computer scientists, and students studying combinatorics or binary systems will benefit from this discussion, particularly those interested in bit manipulation and probability calculations.

find_the_fun
Messages
147
Reaction score
0
How many bytes contain exactly two 1's?

The answer key give [math]\binom{8}{2}[/math] and I don't get why. Even if two bytes have been taken there are still [math]2^6[/math] ways to arrange the other bytes, which is much larger than 28.
 
Physics news on Phys.org
You could look at it this way:

There are 8 bit positions you could choose for the first 1 and that leaves 7 for the second bit position. But, order does not matter, so you want to divide by 2 so that you do not count each possible permutation twice. For example, suppose you chose the third bit the first time and the fifth bit the second time. This is equivalent to choosing the fifth bit the first time and the third bit the second time. So, we find:

$$N=\frac{8\cdot7}{2}=28$$
 
MarkFL said:
You could look at it this way:

There are 8 bit positions you could choose for the first 1 and that leaves 7 for the second bit position. But, order does not matter, so you want to divide by 2 so that you do not count each possible permutation twice. For example, suppose you chose the third bit the first time and the fifth bit the second time. This is equivalent to choosing the fifth bit the first time and the third bit the second time. So, we find:

$$N=\frac{8\cdot7}{2}=28$$

What I don't see is why the way I was looking at it was wrong.
 
If you have already chosen the two bits that are 1, then the remaining 6 bits must be zeroes, and there is only 1 way this can be.
 
MarkFL said:
If you have already chosen the two bits that are 1, then the remaining 6 bits must be zeroes, and there is only 1 way this can be.

That's what I was waiting for someone to say! I don't know what's wrong with me I need more sleep.
 

Similar threads

Replies
2
Views
2K
  • · Replies 9 ·
Replies
9
Views
2K
Replies
1
Views
3K
  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 7 ·
Replies
7
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
Replies
3
Views
2K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 3 ·
Replies
3
Views
862
  • · Replies 3 ·
Replies
3
Views
2K