What is the math formula for determining the total number of different unique combinations?

107 Views Asked by At

(In Digital design), when I’ve a state diagram which has $5$ states I want to encode it using a $3$ bit number,( a binary number which has $n = 3$ bits and $S = 5$ states). What is the Math formula which tells me the total number of the different encoding arrangements? How do i find the numbers $140$, $420$, $840$ etc?

encoding samples: (edited: fixed erroneous number of states. i fixed it so as to be 5 states)

case 1: 000, 001, 010, 011, 100  (5 states, each number is 3 bits)
case 2: 111, 010, 011, 101, 001  (5 states, each number is 3 bits)
case 3: 010, 011, 101, 111, 110  (5 states, each number is 3 bits)
case N: ...
(since here we have 5 states we can get 140 unique different encoding 
schemes).

Some additional information i found in the book introduction to logic design:

For three or four states, there are only three such assignments, and it is fairly easy to do that. For five states, however, that number goes up to $140$, and this method is not practical. (It rises to $420$ for six states, to $840$ for seven or eight states, and to over 10 million for nine states)

3

There are 3 best solutions below

0
On

Three bits give you $2^3=8$ numbers to choose from. To choose $5$ of these there are $\frac {8!}{5!3!}=56$ combinations. I don't understand where your numbers $140,840$ come from.

0
On

I get some weird calculation to match up the numbers in the book. But cannot understand why that way.

As @Ross Millikan just said,

5 states : $140 = \frac{{8\choose5}*5!}{48}$

6 states : $420 = \frac{{8\choose6}*6!}{48}$

7 states : $840 = \frac{{8\choose7}*7!}{48}$

But why divide by 48 for all, only as a circuit designer, you should know.

0
On

I think there is some piece of information missing ...

There are $2^3=8$ possible 3-bit numbers. So, we have $8$ such numbers to encode state 1, leaving $7$ possibilities for state $2$, etc.

So, with $5$ states, there should be $8 \cdot 7 \cdot 6 \cdot 5 \cdot 4=6720$ ways to decode $5$ states with $3$ bits .... so ... not sure where the $140$ comes from.

What does make sense:

When you move to $6$ states, you have $3$ possible numbers left to decode the $6$-th number, so you get $3$ times the number of possibilitites for encoding $6$ states as you have for encoding $5$ states ... and indeed $3 \cdot 140 =420$. And, with $7$ states, you have $2$ options left for the $7$-th, so twice that, and indeed $2 \cdot 420 = 840$. With $8$ states, there is only $1$ option left for the $8$-th state, so that doesn't change, again in accordance with the numbers given.

Also, when you have only $3$ or $4$ states, you of course only use $2$ bits. So, for $3$ states, you'd have $4 \cdot 3 \cdot 2=24$ possibilities ... again, not sure why they say there are $3$ possibilities ... but it does make sense that the number is the same for $4$ states.

And, once you move to $9$ states, you need to start using $4$ bits, so now you get far more possibilities, and you see that jump in numbers reported by the book as well.

So ... it all makes sense, except that the numbers are divided by some factor. Like I said, we are missing something here ...