ece108: combinatorics 1

This commit is contained in:
eggy 2023-03-22 16:46:14 -04:00
parent 36e02fb3df
commit 838b6d52cc

View File

@ -734,3 +734,115 @@ Where $x,y,z$ are elements in $X$, and $p,q,r$ are arbitrary proposition results
- Asymmetric relations must be oppositely symmetrical across the main diagonal. The main diagonal also must be false.
- Antisymmetric relations must be false only if there is a true.
### Transitivity
A **transitive** relation links related terms. For example, $a<b$ and $b<c$ implies $a<c$.
$$\forall x,y,z\in X,\left<x,y\right>\in R\wedge\left<y,z\right>\in R\implies\left<x,z\right>\in R$$
## Orders
!!! definition
- A **partial order** is reflextive, antisymmetric, and transitive.
A **partially ordered set (poset)** is a set $S$ partially ordered with relation $R$.
$$\left<S,R\right>\text{ on } P=R_{S,P}$$
!!! example
$R_{\mathbb Z,\geq}$ is a poset. $\left<\mathcal P(A),\subseteq\right>$ on $A$ is also a poset.
A **strict poset** is irreflexive, asymmetric, and transitive.
A **total order** is a strict poset such that the relation is defined between every possible pair on the set.
$$\forall x,y\in S,xPy\wedge yPx\in\left<S,P\right>$$
### Equivalence relations
An **equivalence class** is a criterion that determines whether two objects are equivalent. The original set must be the union of all equivalence classes.
!!! example
The following are all in the equivalence class $=_1$: $\{1,\frac 2 2,\frac 3 3,\frac 4 4,...\right}$
## Combinatorics
!!! definition
- **and** usually requires you to multiply sets together.
- **or** usually requires you to add then subtract unions.
The number of ways to choose exactly one element from finite sets is the product of their dimensions.
$$|A_1||A_2|...|A_n|$$
!!! example
The number of unique combinations (including order) from four dice is $|6|^4$.
### Ordered with replacement
These problems count order as separate permutations and replace an item after it is taken for the future. If there are $n$ outcomes, and $m$ events that take one of those outcomes:
$$P=n^m$$
To pick $m$ items out of $n$ elements:
$$P(n,m)=\frac{n!}{(n-m!)}$$
If there are duplicates that would otherwise result in an identical string, divide the result by $m!$, where $m$ is the number of repetitions for each duplicate $n_1,n_2,...$.
$${n\choose n_1!n_2!n_k!}=\frac{n!}{n_1!n_2!...n_k!}$$
!!! example
The number of permutations of "ECE119" has two characters that have duplicates. Therefore, the number of possibilities is:
$$\frac{6!}{2!2!}$$
### Unordered with replacement
To rearrange $n$ unique items, the number of possibilities is:
$$n!$$
To choose $n$ items $m$ times, regardless of order, the number of possibilities is:
$${n\choose m}=\frac{n!}{(n-m)!m!}={n\choose(n-m),m}$$
Clearly ${n\choose m}=0$ if $m>n$ or $m<0$.
To choose $k$ out of $n$ items one time, multichoose can be used:
$$\left({n\choose k}\right)={n+k-1\choose k}={n-1+k\choose n-1,k}$$
### Binomial coefficients
A **slack variable** is used to change inequalities into equalities.
!!! example
If solving $x+y\leq 7$, setting $z=7-(x+y)$ to make everything the same domain ($\mathbb Z^+_0$) to use choose.
**Pascal's identity** defines the choose operator recursively.
$${n\choose m}={n-1\choose m-1}+{n-1\choose m}$$
The **binomial theorem** expands a binomial.
$$\forall a,b\in\mathbb R,(a+b)^n=\sum^n_{i=0}{n\choose i}a^{n-i}b^i$$
The sum of choosing integers is its power to 2. Therefore, a finite set with dimension $n$ must have exactly $2^n$ possible subsets.
$$\forall n\in\mathbb Z^+_0,\sum^n_{k=0}{n\choose k}=2^n$$
### Inclusion-exclusion
The inclusion-exclusion principle removes duplicate counting.
$$|A\cup B|=|A|+|B|-|A\cap B|$$
This can be extended to 3+ sets, proven by a bijection to $\mathbb N_{|A| + |B|+|A\cap B|}$:
$$|A\cup B\cup C|=|A| + |B| + |C| - (|A\cap B| + |A\cap C| + |B\cap C|)-|A\cap B\cap C|$$
If $B$ is a subset of $A$, the dimension of $B$ is related to that of $A$.
$$B\subseteq A\implies|B|=|A|-|\overline B|$$