Discrete Math for Data Science

DSCI 220, 2025 W1

November 18, 2025

Announcements

Exploration 1: Partitions

Summary

Each way of sharing is one arrangement of 5 stars and 2 bars.

Or equivalently:

 

\[ \text{# ways} = \binom{5 + 3 - 1}{3 - 1} = \binom{7}{2} = 21 \]

Counting Partitions

Scenario Interpretation Whatโ€™s being partitioned?
๐Ÿช Cookie Counter Distributing identical items among labeled friends Items โ†’ People
๐ŸŽ Girl Guide Boxes Counting totals of each labelled flavour boxes โ†’ Flavours

Each arrangement of stars and bars corresponds to a unique configuration:

\[ \text{# ways} = \binom{j + k - 1}{k - 1} \]

Knights of the Round Table

 

After King Arthurโ€™s death, Guenevere always sits in the same seat. The 100 knights are arranged clockwise in increasing order of honor using 5 ranks. Knights of the same rank are indistinguishable, and each rank sits together (one contiguous block).

 

Question:
How many different seating configurations are possible?

 

Discussion:

  • are you counting permutations?
  • are you counting combinations?
  • are you counting partitions?

Back to Cookies

Suppose you have 10 cookies and 3 friends, and each friend must receive at least one cookie.

  • How many different ways are there to partition the cookies among your friends?

 

  • How does your answer change if Alex doesnโ€™t care if they get any cookies, and Casey must have at least 3.

Constrained Partitions

Suppose a set of \(n\) items is to be partitioned among \(k\) categories, \(C_1, \ldots, C_k\).
Also, suppose category \(C_i\) requires \(x_i\) items.

Then the number of partitions is:

\[ \binom{n - \sum_{i=1}^{k} x_i + k - 1}{k - 1} \]

Reasoning:

  1. Start with \(n\) identical items (stars).
  2. Pre-allocate the required \(x_i\) to each category \(C_i\). After this, \(n' = n - (x_1 + x_2 + \dots + x_k)\) remain unassigned.
  3. Distribute these remaining \(n'\) items freely (possibly zero) among the \(k\) labeled categories โ€” a stars and bars situation.

Exploration 2: Binomial Coefficients

Counting All Groupings

Among 10 students, each will choose either AI or Data Science for a class project.

Student Choice
1 ๐Ÿค–๐Ÿ“Š
2 ๐Ÿค–๐Ÿ“Š
โ‹ฎ โ‹ฎ
10 ๐Ÿค–๐Ÿ“Š

 

\[ \Rightarrow 2^{10} \text{ unique groups } \]

But notice that each of those choices has some number, \(k\), of DSci. How many ways are there to choose \(k\) students for DSci, from among the 10?

This is true for any \(k\), so we must have:

\[ \binom{10}{0} + \binom{10}{1} + \cdots + \binom{10}{10} = 2^{10}. \]

This is the sum of binomial coefficients identity โ€” each term counts the groupings with exactly \(k\) DSci projects, and the sum counts all possible configurations.

Exploration 3: Multinomials

Adding a Third Choice ๐Ÿค–๐Ÿ“Š๐Ÿ“ˆ

Our 10 students can now choose a project in AI, Data Science, or Statistics.

Question:
How many different ways can the classโ€™s choices be distributed?

Category Symbol Count
AI ๐Ÿค– \(x_1\)
DSci ๐Ÿ“Š \(x_2\)
Stat ๐Ÿ“ˆ \(x_3\)

Each student picks exactly one category, so:

\[ x_1 + x_2 + x_3 = 10 \]

Count as a sequence of combination steps:

  1. Choose \(x_1\) students for AI: \(\binom{10}{x_1}\)
  2. From the remaining \(10 - x_1\), choose \(x_2\) for DSci: \(\binom{10 - x_1}{x_2}\)
  3. The rest automatically do Stat.

๐Ÿค–๐Ÿ“Š๐Ÿ“ˆ continued

For each of the \(\binom{10}{x_1}\) choices of AI, there are \(\binom{10 - x_1}{x_2}\) choices of DSCI, and the rest are Stat.

\[ \text{Total} = \binom{10}{x_1} \binom{10 - x_1}{x_2} = \frac{10!}{x_1!x_2!(10 - x_1 - x_2)!} \]

Generalizing to \(k\) categories:

If \(n\) students choose among \(k\) labeled categories with counts \(x_1,\dots,x_k\):

\[ \binom{n}{x_1,x_2,\ldots,x_k} = \frac{n!}{x_1!x_2!\cdots x_k!} \]

Counting All Multinomial Outcomes

Weโ€™ve seen how two categories led to:

\[ \sum_{k=0}^{n} \binom{n}{k} = 2^n \]

Now each student chooses one of three project types: ๐Ÿค– AI, ๐Ÿ“Š Data Science, or ๐Ÿ“ˆ Statistics

For each possible triple \((x_1, x_2, x_3)\) with \(x_1 + x_2 + x_3 = n\), the number of ways to assign projects is:

\[ \binom{n}{x_1, x_2, x_3} = \frac{n!}{x_1!x_2!x_3!} \]

If we add them all up โ€” over every valid triple:

\[ \sum_{x_1+x_2+x_3=n} \binom{n}{x_1, x_2, x_3} = 3^n \]

Multinomials in General

What is the result if there are \(k\) choices?

  • Each student independently chooses one of \(k\) categories for \(k^n\) outcomes.
  • Each multinomial coefficient counts how many outcomes share the same totals \((x_1,x_2,\ldots x_k)\).
  • Summing across all possible totals reconstructs all outcomes.

\[ \sum_{x_1+x_2+\ldots x_k=n} \binom{n}{x_1, x_2, \ldots x_k} = k^n \]