52 lines
1.8 KiB
Markdown
52 lines
1.8 KiB
Markdown
## Inclusion-Exclusion Principle
|
|
Principle that dictates that when combining / overlapping sets, you have to make sure to not include elements that occur in multiple sets multiple times.
|
|
|
|
### Example:
|
|
How many integers between $1$ and $10^6$ are of the form $x^2$ or $x^5$ for some $x in NN$?
|
|
#### How many $x^2$?
|
|
$sqrt(10^6) = 10^3 = 1.000$
|
|
#### How many $x^5$?
|
|
By estimation:
|
|
$$
|
|
&15^5 = 759,375 && "--- in the range / below" 10^6 \
|
|
&16^5 = 1,048,576 && "--- outside the range / above" 10^6 \
|
|
&=> 15 "numbers in the form "x^5"exist" &&
|
|
$$
|
|
> [!warning]
|
|
> Now, we can't add $1,000$ and $15$, since there are numbers that match both, so we need to subtract these duplicates.
|
|
|
|
#### How many $x^2$ and $x^5$ / $x^10$?
|
|
$$
|
|
& 3^10 = 59,049 \
|
|
& 4^10 = 1,048,576 \
|
|
& => 3 "numbers that are both" x^2 "and" x^5 "exist"
|
|
$$
|
|
#### Final calculation:
|
|
Formula: $"Elements that are" x^2 + "Elements that are" x^5 - "Elements that are both"$
|
|
$==> 1,000 + 15 - 3 = 1,012$
|
|
|
|
### For two sets
|
|
$|"Total possibilities"| - |"Avoid 1"| - |"Avoid 2"| + |"Avoid Both"|$
|
|
Where
|
|
- $"Avoid 1"$ are all elements *not matching* condition 1
|
|
- $"Avoid 2"$ are all elements *not matching* condition 2
|
|
- $"Avoid Both"$ are all elements *not matching* condition 1 **and** 2
|
|
|
|
## Type of Task: Boolean Lattice
|
|
Find the amount of upper bounds in ${0, 1}^5$ for the set of vectors $S = {x, y, z}$
|
|
$$
|
|
& x = (0, 1, 0, 0, 0) \
|
|
& y = (0, 0, 1, 0, 1) \
|
|
& z = (0, 1, 1, 0, 0) \
|
|
$$
|
|
> [!INFO]
|
|
> Method used is called **All-Zero Column Method**
|
|
|
|
We look for columns that have $0$'s in all three vectors: Column $1$ and $4$, that's $2$ columns, so we define $k = 2$.
|
|
To get our result we calculate $2^k$ since there are only two possible states for each value $(0, 1)$:
|
|
$2^2 = 4$.
|
|
So we have **4** upper bounds in total.
|
|
|
|
> [!INFO]
|
|
> For the amount of lower bounds we'd check for all-ones columns
|