Add second year

This commit is contained in:
2023-12-07 01:19:12 +00:00
parent 3291e5c79e
commit 3d12031ab8
1168 changed files with 431409 additions and 0 deletions

View File

@ -0,0 +1,156 @@
- #[[MA284 - Discrete Mathematics]]
- **Previous Topic:** [[Principle of Inclusion-Exclusion]]
- **Next Topic:** [[Combinatorial Proofs]]
- **Relevant Slides:** ![MA284-Week03.pdf](../assets/MA284-Week03_1663699934644_0.pdf)
-
- # Binary Strings & Lattice Paths
collapsed:: true
- ## Binary Strings
- A **bit** is a "binary digit", e.g., 1 or 0.
- A **bit string** is a string (list) of bits, e.g., 1011010.
- What is the **length** of a string? #card
card-last-interval:: -1
card-repeats:: 1
card-ease-factor:: 2.5
card-next-schedule:: 2022-09-26T23:00:00.000Z
card-last-reviewed:: 2022-09-26T12:13:43.295Z
card-last-score:: 1
- The **length** of the string is the number of bits.
- An $n$-bit string has length $n$.
- The set of all $n$-bit strings (for given $n$) is denoted $B^n$.
- What is the **weight** of a string? #card
card-last-interval:: 4
card-repeats:: 1
card-ease-factor:: 2.6
card-next-schedule:: 2022-09-30T12:12:45.309Z
card-last-reviewed:: 2022-09-26T12:12:45.310Z
card-last-score:: 5
- The **weight** of the string is the number of 1s.
- The set of all $n$-bit strings of weight $k$ is denoted $B^n_k$.
- ## Lattice Paths
- What is a **lattice**? #card
card-last-interval:: 4
card-repeats:: 1
card-ease-factor:: 2.36
card-next-schedule:: 2022-09-30T12:15:21.865Z
card-last-reviewed:: 2022-09-26T12:15:21.865Z
card-last-score:: 3
- The (integer) **lattice** is the set of all points in the Cartesian plane for which both the $x$ & $y$ coordinates are integers.
- What is a **lattice path**? #card
card-last-interval:: -1
card-repeats:: 1
card-ease-factor:: 2.5
card-next-schedule:: 2022-09-26T23:00:00.000Z
card-last-reviewed:: 2022-09-26T12:15:00.437Z
card-last-score:: 1
- A **lattice path** is the ^^shortest possible path^^ connecting two points on the lattice, moving only horizontally & vertically.
- There can be multiple lattice paths, so long as they are of equally short length.
- ![image.png](../assets/image_1663745526135_0.png)
- The number of lattice paths from $(0,0)$ to $(3,2)$ is the same as $|B_3^5|$.
- The number of lattice paths from $(0,0)$ to $(3,2)$ is the same as the number from $(0,0)$ to $(2,2)$, plus the number from $(0,0)$ to $(3,1)$.
-
- # Binomial Coefficients
- What is the coefficient of say, $x^3y^2$ in $(x+y)^5$?
- $$(x+y)^0=1
\newline
(x+y)^1=x+y
\newline
(x+y)^2=x^2+2xy+y^2
\newline
(x+y)^3=x^3+3x^2y+3xy^2+y^3
\newline
(x+y)^4=x^4+4x^3y+6x^2y^2+4xy^3+y^4
\newline
(x+y)^5=x^5+5x^4y+10x^3y^2+10x^2y^3+5xy^4+y^5
$$
- So, by doing a lot of multiplication, we have worked out that the coefficient of $x^3y^2$ is $10$.
- But, there is a more systematic way of answering this problem.
-
- $$(x+y)^5=(x+y)(x+y)(x+y)(x+y)(x+y)$$
- We can work out the coefficient of $x^3y^2$ in the expansion of $(x+y)^5$ by counting the number of ways we can **choose** $3$ $x$s & $2$ $y$s in
- $$(x+y)(x+y)(x+y)(x+y)(x+y)$$
-
- The numbers that occurred in all of our examples are called **binomial coefficients**, and are denoted
- $$\binom{n}{k}$$
- What are **Binomial Coefficients**? #card
card-last-interval:: 4
card-repeats:: 1
card-ease-factor:: 2.36
card-next-schedule:: 2022-09-30T12:13:19.107Z
card-last-reviewed:: 2022-09-26T12:13:19.108Z
card-last-score:: 3
- For each integer $n \geq 0$, and integer $k$ such that $0 \leq k \leq n$, there is a number $\binom{n}{k}$, read as "$n$ *choose* $k$".
- $\binom{n}{k} = |B^n_k|$, the number of $n$-bit strings of weight $k$.
- $\binom{n}{k}$ is the number of subsets of a set of size $n$, each with cardinality $k$.
- $\binom{n}{k}$ is the number of lattice paths of length $n$ containing $k$ steps to the right.
- $\binom{n}{k}$ is the coefficient of $x^k y^{n-k}$ in the expansion of $(x+y)^n$.
- $\binom{n}{k}$ is the number of ways to select $k$ objects from a total of $n$ objects.
- If we were to skip ahead, we would learn that there is a formula for $\binom{n}{k}$ (that is, "$n$ choose $k$") that is expressed in terms of **factorials**.
- Recall that the **factorial** of a natural number $n$ is:
- $$n! = n \times (n-1) \times (n-2) \times (n-4) \times ... \times 2 \times 1$$
- We will eventually learn that
- $$\binom{n}{k} = \frac{n!}{k!(n-k)!}$$
- However, the formula $\binom{n}{k} = \frac{n!}{k!(n-k)!}$ is not very useful in practice.
-
-
- # Pascal's Triangle
collapsed:: true
- ![image.png](../assets/image_1663751328603_0.png)
- Earlier, we learned that if the set of all $n$-bit strings with weight $k$ is written $B^n_k$, then
- $$|b^n_k| = |B^{n-1}_{k-1}| + |B^{n-1}_k$$
- Similarly, we find that:
- #### Pascal's Identity: A recurrence relation for $\binom{n}{k}$ #card
card-last-interval:: -1
card-repeats:: 1
card-ease-factor:: 2.5
card-next-schedule:: 2022-09-26T23:00:00.000Z
card-last-reviewed:: 2022-09-26T12:14:13.327Z
card-last-score:: 1
- $$\binom{n}{k} = \binom{n-1}{k-1} + \binom{n-1}{k}$$
- This is often presented as **Pascal's Triangle**
- ![image.png](../assets/image_1663751709631_0.png)
-
-
- # Permutations
- What is a **permutation**? #card
card-last-interval:: 4
card-repeats:: 1
card-ease-factor:: 2.6
card-next-schedule:: 2022-09-30T12:14:28.732Z
card-last-reviewed:: 2022-09-26T12:14:28.732Z
card-last-score:: 5
- A **permutation** is an arrangement of objects. Changing the order of the objects gives a different permutation.
- Important: order matters!
- ### Number of Permutations
- How many **permutations** are there of $n$ objects? #card
card-last-interval:: -1
card-repeats:: 1
card-ease-factor:: 2.5
card-next-schedule:: 2022-09-22T23:00:00.000Z
card-last-reviewed:: 2022-09-22T20:27:24.238Z
card-last-score:: 1
- There are $n!$ (i.e., $n$ *factorial*) permutations of $n$ (distinct) objects.
- How many permutations are there of $k$ objects from $n$? #card
card-last-interval:: -1
card-repeats:: 1
card-ease-factor:: 2.5
card-next-schedule:: 2022-09-26T23:00:00.000Z
card-last-reviewed:: 2022-09-26T12:13:06.669Z
card-last-score:: 1
- The number of permutations of $k$ objects out of $n$, $P(n,k)$ is
- $$P(n,k) = n \times (n-1) \times ... \times (n - k + 1) = \frac{n!}{(n-k)!}$$
-
- ## The Binomial Coefficient Formula
- (1) We know that there are $P(n,k)$ permutations of $k$ objects out of $n$.
- (2) We know that
- $$P(n,k) = \frac{n!}{(n-k)!}$$
- (3) Another way of making a permutation of $k$ objects out of $n$ is to
- (a) Choose $k$ from $n$ without order. There $\binom{n}{k}$ ways of doing this.
- (b) Then count all the ways of ordering these $k$ objects. There are $k!$ ways of doing this.
- (c) By the Multiplicative Principle,
- $$P(n,k) = \binom{n}{k}k!$$
- (4) So now we know that
- $$\frac{n!}{(n-k)!} = \binom{n}{k}k!$$
- (5) This gives the formula
- $$\binom{n}{k} = \frac{n!}{(n-k)!k!}$$
-

View File

@ -0,0 +1,156 @@
- #[[MA284 - Discrete Mathematics]]
- **Previous Topic:** [[Principle of Inclusion-Exclusion]]
- **Next Topic:** [[Combinatorial Proofs]]
- **Relevant Slides:** ![MA284-Week03.pdf](../assets/MA284-Week03_1663699934644_0.pdf)
-
- # Binary Strings & Lattice Paths
collapsed:: true
- ## Binary Strings
- A **bit** is a "binary digit", e.g., 1 or 0.
- A **bit string** is a string (list) of bits, e.g., 1011010.
- What is the **length** of a string? #card
card-last-interval:: -1
card-repeats:: 1
card-ease-factor:: 2.5
card-next-schedule:: 2022-09-26T23:00:00.000Z
card-last-reviewed:: 2022-09-26T12:13:43.295Z
card-last-score:: 1
- The **length** of the string is the number of bits.
- An $n$-bit string has length $n$.
- The set of all $n$-bit strings (for given $n$) is denoted $B^n$.
- What is the **weight** of a string? #card
card-last-interval:: 4
card-repeats:: 1
card-ease-factor:: 2.6
card-next-schedule:: 2022-09-30T12:12:45.309Z
card-last-reviewed:: 2022-09-26T12:12:45.310Z
card-last-score:: 5
- The **weight** of the string is the number of 1s.
- The set of all $n$-bit strings of weight $k$ is denoted $B^n_k$.
- ## Lattice Paths
- What is a **lattice**? #card
card-last-interval:: 4
card-repeats:: 1
card-ease-factor:: 2.36
card-next-schedule:: 2022-09-30T12:15:21.865Z
card-last-reviewed:: 2022-09-26T12:15:21.865Z
card-last-score:: 3
- The (integer) **lattice** is the set of all points in the Cartesian plane for which both the $x$ & $y$ coordinates are integers.
- What is a **lattice path**? #card
card-last-interval:: -1
card-repeats:: 1
card-ease-factor:: 2.5
card-next-schedule:: 2022-09-26T23:00:00.000Z
card-last-reviewed:: 2022-09-26T12:15:00.437Z
card-last-score:: 1
- A **lattice path** is the ^^shortest possible path^^ connecting two points on the lattice, moving only horizontally & vertically.
- There can be multiple lattice paths, so long as they are of equally short length.
- ![image.png](../assets/image_1663745526135_0.png)
- The number of lattice paths from $(0,0)$ to $(3,2)$ is the same as $|B_3^5|$.
- The number of lattice paths from $(0,0)$ to $(3,2)$ is the same as the number from $(0,0)$ to $(2,2)$, plus the number from $(0,0)$ to $(3,1)$.
-
- # Binomial Coefficients
- What is the coefficient of say, $x^3y^2$ in $(x+y)^5$?
- $$(x+y)^0=1
\newline
(x+y)^1=x+y
\newline
(x+y)^2=x^2+2xy+y^2
\newline
(x+y)^3=x^3+3x^2y+3xy^2+y^3
\newline
(x+y)^4=x^4+4x^3y+6x^2y^2+4xy^3+y^4
\newline
(x+y)^5=x^5+5x^4y+10x^3y^2+10x^2y^3+5xy^4+y^5
$$
- So, by doing a lot of multiplication, we have worked out that the coefficient of $x^3y^2$ is $10$.
- But, there is a more systematic way of answering this problem.
-
- $$(x+y)^5=(x+y)(x+y)(x+y)(x+y)(x+y)$$
- We can work out the coefficient of $x^3y^2$ in the expansion of $(x+y)^5$ by counting the number of ways we can **choose** $3$ $x$s & $2$ $y$s in
- $$(x+y)(x+y)(x+y)(x+y)(x+y)$$
-
- The numbers that occurred in all of our examples are called **binomial coefficients**, and are denoted
- $$\binom{n}{k}$$
- What are **Binomial Coefficients**? #card
card-last-interval:: 4
card-repeats:: 1
card-ease-factor:: 2.36
card-next-schedule:: 2022-09-30T12:13:19.107Z
card-last-reviewed:: 2022-09-26T12:13:19.108Z
card-last-score:: 3
- For each integer $n \geq 0$, and integer $k$ such that $0 \leq k \leq n$, there is a number $\binom{n}{k}$, read as "$n$ *choose* $k$".
- $\binom{n}{k} = |B^n_k|$, the number of $n$-bit strings of weight $k$.
- $\binom{n}{k}$ is the number of subsets of a set of size $n$, each with cardinality $k$.
- $\binom{n}{k}$ is the number of lattice paths of length $n$ containing $k$ steps to the right.
- $\binom{n}{k}$ is the coefficient of $x^k y^{n-k}$ in the expansion of $(x+y)^n$.
- $\binom{n}{k}$ is the number of ways to select $k$ objects from a total of $n$ objects.
- If we were to skip ahead, we would learn that there is a formula for $\binom{n}{k}$ (that is, "$n$ choose $k$") that is expressed in terms of **factorials**.
- Recall that the **factorial** of a natural number $n$ is:
- $$n! = n \times (n-1) \times (n-2) \times (n-4) \times ... \times 2 \times 1$$
- We will eventually learn that
- $$\binom{n}{k} = \frac{n!}{k!(n-k)!}$$
- However, the formula $\binom{n}{k} = \frac{n!}{k!(n-k)!}$ is not very useful in practice.
-
-
- # Pascal's Triangle
collapsed:: true
- ![image.png](../assets/image_1663751328603_0.png)
- Earlier, we learned that if the set of all $n$-bit strings with weight $k$ is written $B^n_k$, then
- $$|b^n_k| = |B^{n-1}_{k-1}| + |B^{n-1}_k$$
- Similarly, we find that:
- #### Pascal's Identity: A recurrence relation for $\binom{n}{k}$ #card
card-last-interval:: -1
card-repeats:: 1
card-ease-factor:: 2.5
card-next-schedule:: 2022-09-26T23:00:00.000Z
card-last-reviewed:: 2022-09-26T12:14:13.327Z
card-last-score:: 1
- $$\binom{n}{k} = \binom{n-1}{k-1} + \binom{n-1}{k}$$
- This is often presented as **Pascal's Triangle**
- ![image.png](../assets/image_1663751709631_0.png)
-
-
- # Permutations
- What is a **permutation**? #card
card-last-interval:: 4
card-repeats:: 1
card-ease-factor:: 2.6
card-next-schedule:: 2022-09-30T12:14:28.732Z
card-last-reviewed:: 2022-09-26T12:14:28.732Z
card-last-score:: 5
- A **permutation** is an arrangement of objects. Changing the order of the objects gives a different permutation.
- Important: order matters!
- ### Number of Permutations
- How many **permutations** are there of $n$ objects? #card
card-last-interval:: -1
card-repeats:: 1
card-ease-factor:: 2.5
card-next-schedule:: 2022-09-22T23:00:00.000Z
card-last-reviewed:: 2022-09-22T20:27:24.238Z
card-last-score:: 1
- There are $n!$ (i.e., $n$ *factorial*) permutations of $n$ (distinct) objects.
- How many permutations are there of $k$ objects from $n$? #card
card-last-interval:: -1
card-repeats:: 1
card-ease-factor:: 2.5
card-next-schedule:: 2022-09-26T23:00:00.000Z
card-last-reviewed:: 2022-09-26T12:13:06.669Z
card-last-score:: 1
- The number of permutations of $k$ objects out of $n$, $P(n,k)$ is
- $$P(n,k) = n \times (n-1) \times ... \times (n - k + 1) = \frac{n!}{(n-k)!}$$
-
- ## The Binomial Coefficient Formula
- (1) We know that there are $P(n,k)$ permutations of $k$ objects out of $n$.
- (2) We know that
- $$P(n,k) = \frac{n!}{(n-k)!}$$
- (3) Another way of making a permutation of $k$ objects out of $n$ is to
- (a) Choose $k$ from $n$ without order. There $\binom{n}{k}$ ways of doing this.
- (b) Then count all the ways of ordering these $k$ objects. There are $k!$ ways of doing this.
- (c) By the Multiplicative Principle,
- $$P(n,k) = \binom{n}{k}k!$$
- (4) So now we know that
- $$\frac{n!}{(n-k)!} = \binom{n}{k}k!$$
- (5) This gives the formula
- $$\binom{n}{k} = \frac{n!}{(n-k)!k!}$$
-

View File

@ -0,0 +1,154 @@
- #[[MA284 - Discrete Mathematics]]
- **Previous Topic:** [[Principle of Inclusion-Exclusion]]
- **Next Topic:** [[Combinatorial Proofs]]
- **Relevant Slides:** ![MA284-Week03.pdf](../assets/MA284-Week03_1663699934644_0.pdf)
-
- # Binary Strings & Lattice Paths
- ## Binary Strings
- A **bit** is a "binary digit", e.g., 1 or 0.
- A **bit string** is a string (list) of bits, e.g., 1011010.
- What is the **length** of a string? #card
card-last-interval:: 3.58
card-repeats:: 2
card-ease-factor:: 2.6
card-next-schedule:: 2022-10-03T21:29:15.109Z
card-last-reviewed:: 2022-09-30T08:29:15.109Z
card-last-score:: 5
- The **length** of the string is the number of bits.
- An $n$-bit string has length $n$.
- The set of all $n$-bit strings (for given $n$) is denoted $B^n$.
- What is the **weight** of a string? #card
card-last-interval:: 4
card-repeats:: 2
card-ease-factor:: 2.7
card-next-schedule:: 2022-10-08T12:11:29.792Z
card-last-reviewed:: 2022-10-04T12:11:29.793Z
card-last-score:: 5
- The **weight** of the string is the number of 1s.
- The set of all $n$-bit strings of weight $k$ is denoted $B^n_k$.
- ## Lattice Paths
- What is a **lattice**? #card
card-last-interval:: 4
card-repeats:: 2
card-ease-factor:: 2.22
card-next-schedule:: 2022-10-08T12:15:35.955Z
card-last-reviewed:: 2022-10-04T12:15:35.956Z
card-last-score:: 3
- The (integer) **lattice** is the set of all points in the Cartesian plane for which both the $x$ & $y$ coordinates are integers.
- What is a **lattice path**? #card
card-last-interval:: 4.43
card-repeats:: 2
card-ease-factor:: 2.6
card-next-schedule:: 2022-10-08T00:33:48.083Z
card-last-reviewed:: 2022-10-03T14:33:48.083Z
card-last-score:: 5
- A **lattice path** is the ^^shortest possible path^^ connecting two points on the lattice, moving only horizontally & vertically.
- There can be multiple lattice paths, so long as they are of equally short length.
- ![image.png](../assets/image_1663745526135_0.png)
- The number of lattice paths from $(0,0)$ to $(3,2)$ is the same as $|B_3^5|$.
- The number of lattice paths from $(0,0)$ to $(3,2)$ is the same as the number from $(0,0)$ to $(2,2)$, plus the number from $(0,0)$ to $(3,1)$.
-
- # Binomial Coefficients
- What is the coefficient of say, $x^3y^2$ in $(x+y)^5$?
- $$(x+y)^0=1
\newline
(x+y)^1=x+y
\newline
(x+y)^2=x^2+2xy+y^2
\newline
(x+y)^3=x^3+3x^2y+3xy^2+y^3
\newline
(x+y)^4=x^4+4x^3y+6x^2y^2+4xy^3+y^4
\newline
(x+y)^5=x^5+5x^4y+10x^3y^2+10x^2y^3+5xy^4+y^5
$$
- So, by doing a lot of multiplication, we have worked out that the coefficient of $x^3y^2$ is $10$.
- But, there is a more systematic way of answering this problem.
-
- $$(x+y)^5=(x+y)(x+y)(x+y)(x+y)(x+y)$$
- We can work out the coefficient of $x^3y^2$ in the expansion of $(x+y)^5$ by counting the number of ways we can **choose** $3$ $x$s & $2$ $y$s in
- $$(x+y)(x+y)(x+y)(x+y)(x+y)$$
-
- The numbers that occurred in all of our examples are called **binomial coefficients**, and are denoted
- $$\binom{n}{k}$$
- What are **Binomial Coefficients**? #card
card-last-interval:: -1
card-repeats:: 1
card-ease-factor:: 2.36
card-next-schedule:: 2022-10-04T23:00:00.000Z
card-last-reviewed:: 2022-10-04T12:13:14.754Z
card-last-score:: 1
- For each integer $n \geq 0$, and integer $k$ such that $0 \leq k \leq n$, there is a number $\binom{n}{k}$, read as "$n$ *choose* $k$".
- $\binom{n}{k} = |B^n_k|$, the number of $n$-bit strings of weight $k$.
- $\binom{n}{k}$ is the number of subsets of a set of size $n$, each with cardinality $k$.
- $\binom{n}{k}$ is the number of lattice paths of length $n$ containing $k$ steps to the right.
- $\binom{n}{k}$ is the coefficient of $x^k y^{n-k}$ in the expansion of $(x+y)^n$.
- $\binom{n}{k}$ is the number of ways to select $k$ objects from a total of $n$ objects.
- If we were to skip ahead, we would learn that there is a formula for $\binom{n}{k}$ (that is, "$n$ choose $k$") that is expressed in terms of **factorials**.
- Recall that the **factorial** of a natural number $n$ is:
- $$n! = n \times (n-1) \times (n-2) \times (n-4) \times ... \times 2 \times 1$$
- We will eventually learn that
- $$\binom{n}{k} = \frac{n!}{k!(n-k)!}$$
- However, the formula $\binom{n}{k} = \frac{n!}{k!(n-k)!}$ is not very useful in practice.
-
-
- # Pascal's Triangle
- ![image.png](../assets/image_1663751328603_0.png)
- Earlier, we learned that if the set of all $n$-bit strings with weight $k$ is written $B^n_k$, then
- $$|b^n_k| = |B^{n-1}_{k-1}| + |B^{n-1}_k$$
- Similarly, we find that:
- #### Pascal's Identity: A recurrence relation for $\binom{n}{k}$ #card
card-last-interval:: -1
card-repeats:: 1
card-ease-factor:: 2.5
card-next-schedule:: 2022-10-04T23:00:00.000Z
card-last-reviewed:: 2022-10-04T12:33:47.256Z
card-last-score:: 1
- $$\binom{n}{k} = \binom{n-1}{k-1} + \binom{n-1}{k}$$
- This is often presented as **Pascal's Triangle**
- ![image.png](../assets/image_1663751709631_0.png)
-
-
- # Permutations
- What is a **permutation**? #card
card-last-interval:: 4
card-repeats:: 2
card-ease-factor:: 2.7
card-next-schedule:: 2022-10-08T12:14:42.530Z
card-last-reviewed:: 2022-10-04T12:14:42.530Z
card-last-score:: 5
- A **permutation** is an arrangement of objects. Changing the order of the objects gives a different permutation.
- A permutation of a set must have the same cardinality as that set.
- Important: order matters!
- ### Number of Permutations
- How many **permutations** are there of $n$ objects? #card
card-last-interval:: -1
card-repeats:: 1
card-ease-factor:: 2.5
card-next-schedule:: 2022-10-03T23:00:00.000Z
card-last-reviewed:: 2022-10-03T11:41:35.217Z
card-last-score:: 1
- There are $n!$ (i.e., $n$ *factorial*) permutations of $n$ (distinct) objects.
- How many permutations are there of $k$ objects from $n$? #card
card-last-interval:: 4.43
card-repeats:: 2
card-ease-factor:: 2.6
card-next-schedule:: 2022-10-08T00:33:41.297Z
card-last-reviewed:: 2022-10-03T14:33:41.298Z
card-last-score:: 5
- The number of permutations of $k$ objects out of $n$, $P(n,k)$ is
- $$P(n,k) = \binom{n}{k} = n \times (n-1) \times ... \times (n - k + 1) = \frac{n!}{(n-k)!}$$
- ## The Binomial Coefficient Formula
- (1) We know that there are $P(n,k)$ permutations of $k$ objects out of $n$.
- (2) We know that
- $$P(n,k) = \frac{n!}{(n-k)!}$$
- (3) Another way of making a permutation of $k$ objects out of $n$ is to
- (a) Choose $k$ from $n$ without order. There $\binom{n}{k}$ ways of doing this.
- (b) Then count all the ways of ordering these $k$ objects. There are $k!$ ways of doing this.
- (c) By the Multiplicative Principle,
- $$P(n,k) = \binom{n}{k}k!$$
- (4) So now we know that
- $$\frac{n!}{(n-k)!} = \binom{n}{k}k!$$
- (5) This gives the formula
- $$\binom{n}{k} = \frac{n!}{(n-k)!k!}$$
-

View File

@ -0,0 +1,154 @@
- #[[MA284 - Discrete Mathematics]]
- **Previous Topic:** [[Principle of Inclusion-Exclusion]]
- **Next Topic:** [[Combinatorial Proofs]]
- **Relevant Slides:** ![MA284-Week03.pdf](../assets/MA284-Week03_1663699934644_0.pdf)
-
- # Binary Strings & Lattice Paths
- ## Binary Strings
- A **bit** is a "binary digit", e.g., 1 or 0.
- A **bit string** is a string (list) of bits, e.g., 1011010.
- What is the **length** of a string? #card
card-last-interval:: 11.55
card-repeats:: 3
card-ease-factor:: 2.7
card-next-schedule:: 2022-10-18T06:19:03.162Z
card-last-reviewed:: 2022-10-06T17:19:03.163Z
card-last-score:: 5
- The **length** of the string is the number of bits.
- An $n$-bit string has length $n$.
- The set of all $n$-bit strings (for given $n$) is denoted $B^n$.
- What is the **weight** of a string? #card
card-last-interval:: 11.2
card-repeats:: 3
card-ease-factor:: 2.8
card-next-schedule:: 2022-10-20T02:52:44.155Z
card-last-reviewed:: 2022-10-08T22:52:44.155Z
card-last-score:: 5
- The **weight** of the string is the number of 1s.
- The set of all $n$-bit strings of weight $k$ is denoted $B^n_k$.
- ## Lattice Paths
- What is a **lattice**? #card
card-last-interval:: 9.28
card-repeats:: 3
card-ease-factor:: 2.32
card-next-schedule:: 2022-10-18T04:54:49.128Z
card-last-reviewed:: 2022-10-08T22:54:49.129Z
card-last-score:: 5
- The (integer) **lattice** is the set of all points in the Cartesian plane for which both the $x$ & $y$ coordinates are integers.
- What is a **lattice path**? #card
card-last-interval:: 14.2
card-repeats:: 3
card-ease-factor:: 2.7
card-next-schedule:: 2022-10-23T02:49:59.194Z
card-last-reviewed:: 2022-10-08T22:49:59.194Z
card-last-score:: 5
- A **lattice path** is the ^^shortest possible path^^ connecting two points on the lattice, moving only horizontally & vertically.
- There can be multiple lattice paths, so long as they are of equally short length.
- ![image.png](../assets/image_1663745526135_0.png)
- The number of lattice paths from $(0,0)$ to $(3,2)$ is the same as $|B_3^5|$.
- The number of lattice paths from $(0,0)$ to $(3,2)$ is the same as the number from $(0,0)$ to $(2,2)$, plus the number from $(0,0)$ to $(3,1)$.
-
- # Binomial Coefficients
- What is the coefficient of say, $x^3y^2$ in $(x+y)^5$?
- $$(x+y)^0=1
\newline
(x+y)^1=x+y
\newline
(x+y)^2=x^2+2xy+y^2
\newline
(x+y)^3=x^3+3x^2y+3xy^2+y^3
\newline
(x+y)^4=x^4+4x^3y+6x^2y^2+4xy^3+y^4
\newline
(x+y)^5=x^5+5x^4y+10x^3y^2+10x^2y^3+5xy^4+y^5
$$
- So, by doing a lot of multiplication, we have worked out that the coefficient of $x^3y^2$ is $10$.
- But, there is a more systematic way of answering this problem.
-
- $$(x+y)^5=(x+y)(x+y)(x+y)(x+y)(x+y)$$
- We can work out the coefficient of $x^3y^2$ in the expansion of $(x+y)^5$ by counting the number of ways we can **choose** $3$ $x$s & $2$ $y$s in
- $$(x+y)(x+y)(x+y)(x+y)(x+y)$$
-
- The numbers that occurred in all of our examples are called **binomial coefficients**, and are denoted
- $$\binom{n}{k}$$
- What are **Binomial Coefficients**? #card
card-last-interval:: 3.45
card-repeats:: 2
card-ease-factor:: 2.46
card-next-schedule:: 2022-10-12T08:41:44.758Z
card-last-reviewed:: 2022-10-08T22:41:44.758Z
card-last-score:: 5
- For each integer $n \geq 0$, and integer $k$ such that $0 \leq k \leq n$, there is a number $\binom{n}{k}$, read as "$n$ *choose* $k$".
- $\binom{n}{k} = |B^n_k|$, the number of $n$-bit strings of weight $k$.
- $\binom{n}{k}$ is the number of subsets of a set of size $n$, each with cardinality $k$.
- $\binom{n}{k}$ is the number of lattice paths of length $n$ containing $k$ steps to the right.
- $\binom{n}{k}$ is the coefficient of $x^k y^{n-k}$ in the expansion of $(x+y)^n$.
- $\binom{n}{k}$ is the number of ways to select $k$ objects from a total of $n$ objects.
- If we were to skip ahead, we would learn that there is a formula for $\binom{n}{k}$ (that is, "$n$ choose $k$") that is expressed in terms of **factorials**.
- Recall that the **factorial** of a natural number $n$ is:
- $$n! = n \times (n-1) \times (n-2) \times (n-4) \times ... \times 2 \times 1$$
- We will eventually learn that
- $$\binom{n}{k} = \frac{n!}{k!(n-k)!}$$
- However, the formula $\displaystyle \binom{n}{k} = \frac{n!}{k!(n-k)!}$ is not very useful in practice.
-
-
- # Pascal's Triangle
- ![image.png](../assets/image_1663751328603_0.png)
- Earlier, we learned that if the set of all $n$-bit strings with weight $k$ is written $B^n_k$, then
- $$|b^n_k| = |B^{n-1}_{k-1}| + |B^{n-1}_k$$
- Similarly, we find that:
- #### Pascal's Identity: A recurrence relation for $\binom{n}{k}$ #card
card-last-interval:: 11.56
card-repeats:: 3
card-ease-factor:: 2.7
card-next-schedule:: 2022-10-18T23:22:56.816Z
card-last-reviewed:: 2022-10-07T10:22:56.817Z
card-last-score:: 5
- $$\binom{n}{k} = \binom{n-1}{k-1} + \binom{n-1}{k}$$
- This is often presented as **Pascal's Triangle**
- ![image.png](../assets/image_1663751709631_0.png)
-
-
- # Permutations
- What is a **permutation**? #card
card-last-interval:: 11.2
card-repeats:: 3
card-ease-factor:: 2.8
card-next-schedule:: 2022-10-20T02:53:38.455Z
card-last-reviewed:: 2022-10-08T22:53:38.455Z
card-last-score:: 5
- A **permutation** is an arrangement of objects. Changing the order of the objects gives a different permutation.
- A permutation of a set must have the same cardinality as that set.
- Important: order matters!
- ### Number of Permutations
- How many **permutations** are there of $n$ objects? #card
card-last-interval:: 4
card-repeats:: 2
card-ease-factor:: 2.6
card-next-schedule:: 2022-10-10T17:14:28.391Z
card-last-reviewed:: 2022-10-06T17:14:28.392Z
card-last-score:: 5
- There are $n!$ (i.e., $n$ *factorial*) permutations of $n$ (distinct) objects.
- How many permutations are there of $k$ objects from $n$? #card
card-last-interval:: 14.2
card-repeats:: 3
card-ease-factor:: 2.7
card-next-schedule:: 2022-10-23T02:49:51.823Z
card-last-reviewed:: 2022-10-08T22:49:51.823Z
card-last-score:: 5
- The number of permutations of $k$ objects out of $n$, $P(n,k)$ is
- $$P(n,k) = \binom{n}{k} = n \times (n-1) \times ... \times (n - k + 1) = \frac{n!}{(n-k)!}$$
- ## The Binomial Coefficient Formula
- (1) We know that there are $P(n,k)$ permutations of $k$ objects out of $n$.
- (2) We know that
- $$P(n,k) = \frac{n!}{(n-k)!}$$
- (3) Another way of making a permutation of $k$ objects out of $n$ is to
- (a) Choose $k$ from $n$ without order. There $\binom{n}{k}$ ways of doing this.
- (b) Then count all the ways of ordering these $k$ objects. There are $k!$ ways of doing this.
- (c) By the Multiplicative Principle,
- $$P(n,k) = \binom{n}{k}k!$$
- (4) So now we know that
- $$\frac{n!}{(n-k)!} = \binom{n}{k}k!$$
- (5) This gives the formula
- $$\binom{n}{k} = \frac{n!}{(n-k)!k!}$$
-