How many ternary strings with at most k ones and k minus ones Consider for n , k &#x22

Nicholas Cruz

Nicholas Cruz

Answered question

2022-05-21

How many ternary strings with at most k ones and k minus ones
Consider for n , k N with k n the following set
S k , n := { z { 1 , 0 , 1 } n : # { i : z i = 1 } k   and   # { i : z i = 1 } k } .
I want to determine the cardinality of S. I know that there are ( n k ) 2 n k number of strings with exactly k ones and likewise ( n k ) 2 n k number of strings with exactly k ones and likewise ( n k ) 2 n k number of strings with exactly k minus ones. But I have to remove the strings where we have for example k one's and more than k minus ones. I think I have to use the Principle of Inclusion and Exclusion. I'm REALLY stuck on this problem. Hope someone can help me.
Example: let n = 3 and k = 1. Then we have
S 3 , 1 = { ( 0 , 0 , 0 ) , ( 1 , 1 , 0 ) , ( 1 , 0 , 1 ) , ( 0 , 1 , 1 ) , ( 1 , 1 , 0 ) , ( 1 , 0 , 1 ) , ( 0 , 1 , 1 ) , ( 0 , 0 , 1 ) , ( 0 , 1 , 0 ) , ( 1 , 0 , 0 ) , ( 0 , 0 , 1 ) , ( 0 , 1 , 0 ) , ( 1 , 0 , 0 ) }
and so we have # S 3 , 1 = 13.

Answer & Explanation

Danube2w

Danube2w

Beginner2022-05-22Added 7 answers

Step 1
To obtain a sequence of length n in which the number of 1 is i and the number of -1 is j, you can choose among ( n i ) possibilities for the positions of the 1's. Next in the remaining n i slots, you have ( n i j ) possibilities to choose the positions of the -1. The remaining n i j slots will be filled with 0's. This gives
( n i ) ( n i j ) = n ! i ! ( n i ) ! ( n i ) ! j ! ( n i j ) ! = n ! i ! j ! ( n i j ) !
Step 2
It remains to sum these values to get
S k , n = 0 i , j k n ! i ! j ! ( n i j ) !

Do you have a similar question?

Recalculate according to your conditions!

New Questions in Discrete math

Ask your question.
Get an expert answer.

Let our experts help you. Answer in as fast as 15 minutes.

Didn't find what you were looking for?