COMP 2711H: Lecture 6

Date: 2024-09-11 04:36:04

Reviewed:

Topic / Chapter: Counting

summary

❓Questions

Notes

Counting
  • Counting

    • how many ways is there to do something?
  • PA: principle of addition

    • there are 2 points,
      • there exists 2 roads, 2 ferry routes, and 1 flight route
      • how many ways?
    • i.e. dividing big set's size into sum of smaller sets' size
  • PM: principle of multiplication

    • when noe event is independent of another
    • same city
      • but intermediate also exists
      • a-c-d-b in linear order
      • a-c: 2; c-d: 3; d-b: 2 ways
      • total ways of a-b, without going back:
        • ways
    • as long as no. of later choices (not individual cases of later choices) are independent of previous choices, we can simply multiply
    • another way to divide a large set
  • Counting permutations

    • prof's notation:
    • permutations of :
      • 6 ways!
    • how many permutation for numbers?
      • e.g. how many different (linear) queues?
        • use notation to denote permutation ways of
        • i.e. inserting -th person into queue of people
        • slots to insert!
      • definition: can be either multiplication / permutation of
        • as there is 1 way of aligning 10 people
    • or, different approach:
      • for objects
        • how many choices do I have for 1st place?:
        • how many choices do I have for 2nd place?:
        • ...
        • how many choices do I have for last place?:
        • total:
      • 👨‍🏫 note that no. of later choices are independent of previous choices
  • Permutations

    • how many queue of length can we form from people?
      • or:
      • 👨‍🏫: double counting: we consider and as different queue
        • order matters here!
    • or, think of other way
      • it's still -length queue, but the last elements do not matter
        • thus:
  • Permutations of non-distinct items

    • how many permutations does each word have
      • not necessarily meaningful
      • : all letters are distinct
        • ways to order
      • simple:
        • there are ways to simply display
          • if it was
        • but order of 2 As and 2 Bs doesn't matter
          • so ways of double count
        • distinct ways
      • : some letters appear more than once!
        • 5 A, 2 B, 2 R, 1 C, 1 D
        • all permutations:
    • general way
      • there are alphabets in a word
      • where each letter appears times
      • total no. of permutations:
    • one of the ways we show that a fraction is an integer
      • claim that it is answer to some counting problem
        • all counting problem: has integer solution
    • 👨‍🏫 I'll fail you if you say there are 9.5 ways of counting!!!
  • Combinations

    • 👨‍🏫 what if we don't care about the order?
      • e.g. how many subsets of have size
      • notation:
    • equivalent: how many binary seq. of length have ones?
    • or, a different way
      • : no. of different permutation of length from
        • then divide it by : no. of different ordering of length
      • thus:
Practice Problems (Permutations)
  • Idea

    • has subsets
    • old method we used:
    • : false; : true
    • and we can assign for each elements
      • to assign: whether it's included in subset / not
    • or, using counting:
      • there are 2 choices for first element
      • and so on for all elements, independent of previous choices
      • thus ways total
  • Problem 1

    • how many subsets are there of , including no. ?
      • consider: first element must be 1
        • only single way for first element
        • for the rest elements: ways
  • Problem 2

    • how many no. of subsets of even size?
      • answer: ways
        • 👨‍🏫 it doesn't apply for (not natural number)
      • if
      • how many seq. have no 1s (= true)?
        • way:
      • how many seq.. have exactly 2 1s?
        • i.e. different permutation of word:
      • how many seq. have exactly 4 1s?
        • (same combination, just 0s and 1s in worst change)
      • how many seq. have exactly 6 1s?
        • way:
      • answer: sum of all
  • Problem 3

    • how about for general ? (PA)
      • i.e. how many seq. of length have ones?
        • ones, zeros
      • total sum:
        • 👨‍🏫 more complicated than thought :p
        • can we show that those two are same?
          • e.g. using induction, etc.
  • Problem 4

    • for general (PM)
      • how many ways to assign fill in to elements
        • for first elements: we have freedom of choice
        • for the last element: we can only make choice
          • dependent on others
        • thus,
Practice Problems (Combination)
  • Problem 5

    • prove
      • 👨‍🏫 disclaimer: I don't expect you to be able to do any algebra
      • it's just different way of counting all subsets, so
  • Problem 6

    • prove
      • as there is a pair for each size
    • 👨‍🏫 same number of even & odd subsets!
  • Problem 7

    • prove
    • show it in combinatorial proof
      • recruiting captain & team, total of people, from
      • choosing 1 captain from people & choosing the rest from people
      • = choosing people from people & choosing a captain from people
  • Problem 8

    • prove
    • somewhat the same
      • no. of all teams
      • = no. of teams excluding a person A + no. of teams including a person A
  • Problem 9

    • prove
    • RHS: 3 possibilities for a person
      • and all possible subsets
    • LHS: for all group, where
      • people are in group
      • and people are in group
    • also:
      • among people, there are total of ways to divide them between group
      • thus same
  • Problem 10

    • how many solutions does
      • have if ?
    • if : 1 solution
    • if : w/ unique value
    • what if ?
      • 👨‍🏫 can we reduce the problem into permutation / combinations?
      • e.g. same as dividing balls with 2 bars
        • w/ 11 slots
        • or: aligning 10 balls and 2 bars
        • and the 10 balls & 2 bars are indistinguishable within them
    • for general problem,
      • where
      • there are
      • as we have bars
    • or, the other way:
      • choosing slots for bars from slots
      • i.e.
  • Problem 11

    • prove
    • where
    • choosing people from people:
      • same as choosing people from whom you will exclude