contestada

A bit is a 0 or a 1. A bit string of length 9 is a sequence of 9 digits, all of which are either 0 and 1.
(a) How many bit strings of length 9 are there?
(b) How many bit strings of length 9 or less are there?

Respuesta :

(a) Each bit has 2 possible values, so a string of length 9 has 2⁹ = 512 possible values.

(b) Using the same reasoning, there are 2 possible strings of length n. So the number of strings of length 9 or less is the sum (denoted by S) of the first 9 powers of 2,

S = 2¹ + 2² + 2³ + ... + 2⁹

Then

2S = 2² + 2³ + 2⁴ + ... + 2¹⁰

Subtract S from 2S to get

2S - S = 2¹⁰ - 2¹

S = 1024 - 2

S = 1022