Discrete-math 15

Discrete-math 15

Basic counting problems

Addition rule #lemma

Let A,B be finite sets such thatAB=Then |AB|=|A|+|B|C,DU:|CD|=|CD|+|D|

Multiplication rule #lemma

A,BU:|A×B|=|A||B|

Extensions of the multiplication rule

For any n setsA1,A2,,An|A1×A2×A3××An|=|A1||A2||An|

Example

Let A,B be finite sets|A|=n,|B|=mHow many functions f:AB is there?Solution:A={a1,,an}Let sequence Sf=(f(a1),f(a2),,f(an))f1=f2Sf1=Sf2f1f2Sf1Sf2|BA|=|{Sf|f:AB}|=|B×B×B××Bn times|=mn

Number of permutations/combinations #definition

How many ways there is to choose k elements from the set{1,2,,n}=[n]Solution:(Order is importantOrder is not importantWith repetitionsAnk=nkCn+k1k=(n+k1)!(n1)!k!Without repetitionsPnk=n!(nk)!Cnk=n!(nk)!k!)

With repetitions, order is important

Each chosen element can be one of n elementsNumber of ways to choose k elements:nk

Without repetitions, order is important (permutations)

First chosen element can be one of n elementsi-th chosen element can be one of ni elementsi[0,k1]Pnk=(n0)(n1)(n2)(nk+1)=n!(nk)!

Without repetitions, order is not important (combinations)

Number of permutations of a binary string of length k is: k!Number of ways to choose k non-repeating elements with disregard to order is:Cnk=(nk)=n!(nk)!k!