184k views
4 votes
Let a "binary code" be the set of all binary words, each consisting of 7 bits (i.e., 0 or 1 digits). For example, 0110110 is a codeword in this code.

a) How many different codewords are there?
b) How many codewords contain exactly four 1’s? c) How many codewords contain at most two 1’s?

2 Answers

4 votes

Answer:

a) 128 Code words

b) 35 Code words

c) 29 Code words

Explanation:

There are 7 bits and each of the bit can either be 0 or 1.

so the first bit can be any of the 2 choices.

The second bit can be any of the 2 choices independent of the first one.

and so on.

a) so total number of different code words is 2*2*2*2*2*2*2 =2⁷ =128 Code words

b) a code word containing exactly 4 1's implies the code word has 4 1's and 3 0's

Therefore, out of 7 bits 4 are of same kind and 3 are of another kind

hence total number of such code words = 7!/(4!*3!) = 35 Code words

c) number of code words containing at most 2 1's

=words containing 0 1's + words containing 1 1's + words containing 2 1's

words containing 0 1's =0000000 so 1 word

words containing 1 1's=1000000,0100000,0010000,0001000,0000100,0000010,0000001 so 7 words

words containing 2 1's means word containing 2 1's and 5 0's so out of 7 2 are of one kind and 5 are of another kind

so total number of such words=7!/(2!*5!)=21

hence words having at most 2 1's=21+7+1= 29 Code words

User Netvope
by
5.7k points
0 votes

Answer:

a) 128 codewords

b) 35 codewords

c) 29 codewords

Explanation:

a) Each 7 bits consist of 0 or 1 digits. Therefore the first bit is two choices (0 or 1), the second bit is also two choices (0 or 1), continues this way till the last bit.

So total number of different code words in 7 bits is 2×2×2×2×2×2×2 = 2⁷ = 128

There are 128 different codewords.

b) A code word contains exactly four 1's this means that it has four 1's and three 0's . Therefore, in 7 bits, we have four of the same kind and three of the same kind. Hence, total number of code words containing exactly four 1's =7!/(4!*3!) = 35 codewords

c) number of code words containing at most two 1's = codewords containing zero 1's + words containing one 1's + words containing two 1's

Now codewords containing zero 1's = 0000000 so 1 word

Codewords containing one 1's = 1000000,0100000,0010000,0001000,0000100,0000010,0000001. That's seven words

Codewords containing two 1's means word containing two 1's and five 0's. So out of seven, two are of one kind and five are of another kind

Therefore, the total number of such words=7!/(2!*5!)=21

Hence, codewords having at most two 1's = 21+7+1 =29 codewords

User Hgiasac
by
5.5k points