Files
uni_notes/Counting.md
2026-03-09 18:11:18 +01:00

954 B

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