Log in Sign up
Back to Discover
🔢

Inclusion–exclusion principle

math Maturity 7-9

We can count things in groups. Sometimes we count the same thing twice. That is not right. We must take away the extra ones. This helps us get the right total. It is like a puzzle. Can you count your toys?

41 words

Imagine you are counting toys. You have a group of cars. You also have a group of red toys. Some toys are both cars and red.

Венов дијаграм.svg
Венов дијаграм.svg

If you count both groups, you might count those red cars twice. That makes your total too high. To fix this, you must take away the extra ones.

Inclusion-exclusion.svg
Inclusion-exclusion.svg

This is a way to find a true total. You add the groups together. Then you subtract the ones that overlap. This helps you count everything just once. It is a smart way to solve counting puzzles.

94 words

Imagine you are counting groups of items. You have a group of red toys. You also have a group of cars. Some toys are both red and cars.

Венов дијаграм.svg
Венов дијаграм.svg

If you add the two groups together, you might count the red cars twice. This makes your total too high. To fix this, you must subtract the items that overlap. This is called the inclusion-exclusion principle.

Inclusion-exclusion.svg
Inclusion-exclusion.svg

This rule works for even more groups. If you have three groups, you might subtract too much. You have to add some items back in to get the right count.

inclusion-exclusion-3sets.png
inclusion-exclusion-3sets.png

To find the true total, you follow a pattern. First, you add the sizes of all groups. Next, you subtract the items in two groups. Then, you add back the items in three groups. You keep going by switching between adding and subtracting. This way, every single item is counted exactly once. This method helps solve hard puzzles in math. It can even help you find the chance of things happening. For example, it helps find the chance of a card being in the wrong spot in a deck.

187 words

Imagine you are counting items in different groups. You might have a group of red toys and a group of cars. Some items belong to both groups, like a red car. If you simply add the number of red toys to the number of cars, you will count those red cars twice. This makes your total number too large. To fix this, you must subtract the items that belong to both groups. This simple way of correcting your count is the inclusion-exclusion principle.

Венов дијаграм.svg
Венов дијаграм.svg

This idea works for many groups, not just two. When you have three groups, the math gets a bit trickier. If you subtract the overlaps between two groups, you might subtract the middle part too many times. To fix that, you have to add the middle part back in.

Inclusion-exclusion.svg
Inclusion-exclusion.svg
The principle follows a steady pattern to keep the count perfect. First, you include the sizes of all individual sets. Next, you exclude the items found in any two sets. Then, you include the items found in three sets. You keep switching between adding and subtracting until every item is counted exactly once.
inclusion-exclusion-3sets.png
inclusion-exclusion-3sets.png

People have used these counting ideas for a very long time. The concept is often linked to Abraham de Moivre in the year 1718. Later, a scientist named Daniel da Silva wrote about it in 1854. Another writer named J. J. Sylvester also wrote about it in 1883. Because of these people, some call it the Da Silva formula or the Sylvester formula. These thinkers helped turn a simple counting trick into a major part of math.

Inclusion-exclusion.svg
Inclusion-exclusion.svg

This principle is very useful for solving hard puzzles. One famous puzzle is called the hatcheck problem. It asks how many ways you can shuffle a deck of cards so that no card is in its correct spot. These special shuffles are called derangements. Using this math, we can find that the chance of every card being in the wrong spot is about 37 percent. This is related to a special number called e.

inclusion-exclusion-3sets.png
inclusion-exclusion-3sets.png

Math experts use this principle in many different areas. It is used in a field called combinatorics, which is the study of counting. It is also used in probability to find the chance of things happening. You can even use it in measure theory or number theory. It is like a sieve that catches the right numbers while letting the mistakes fall away. This makes it a very powerful tool for mathematicians everywhere.

Dirichlet hyperbola example 4.svg
Dirichlet hyperbola example 4.svg

418 words

The inclusion–exclusion principle is a fundamental counting technique used in combinatorics. It provides a systematic way to calculate the cardinality, or the number of elements, in the union of several finite sets. When we want to find the total size of multiple groups combined, we cannot simply add their individual sizes together if those groups overlap. If we did, we would count the elements in the overlaps multiple times. This principle offers a mathematical way to correct those errors. It ensures that every single element is counted exactly once, regardless of how many sets it belongs to.

Венов дијаграм.svg
Венов дијаграм.svg

To understand how the mechanism works, consider the simplest case involving two finite sets, A and B. If you add the size of set A to the size of set B, you have included the intersection—the elements that belong to both—twice. To fix this, you must subtract the size of the intersection once. For three sets, A, B, and C, the process becomes more complex. You first sum the sizes of the three individual sets. Next, you subtract the sizes of all pairwise intersections, such as A and B, B and C, and A and C. However, by doing this, you have subtracted the elements that exist in all three sets too many times. To correct this, you must add the size of the triple intersection back into the total.

Inclusion-exclusion.svg
Inclusion-exclusion.svg

This alternating process continues for any number of sets. The principle follows a strict sequence of inclusion and exclusion. First, you include the cardinalities of all individual sets. Second, you exclude the cardinalities of all pairwise intersections. Third, you include the cardinalities of the triple-wise intersections. Fourth, you exclude the quadruple-wise intersections. This pattern of adding and subtracting continues until you reach the intersection of all sets in the collection. If the number of sets in an intersection is odd, you include it; if it is even, you exclude it. This ensures that every region in a Venn diagram is accounted for correctly.

inclusion-exclusion-3sets.png
inclusion-exclusion-3sets.png

The history of this concept involves several important mathematicians. The idea is often attributed to Abraham de Moivre in 1718. Later, the principle appeared in a paper by Daniel da Silva in 1854. In 1883, J. J. Sylvester published a paper on the subject. Because of these contributions, the principle is sometimes called the Da Silva formula or the Sylvester formula. It is also closely related to the sieve method used extensively in number theory. This connection is why the principle is sometimes referred to as the sieve formula.

inclusion-exclusion-3sets.png
inclusion-exclusion-3sets.png

One significant application of this principle is counting derangements. A derangement is a specific type of permutation where no element appears in its original or correct position. This is often illustrated by the "hatcheck problem." Imagine a deck of $n$ cards numbered from 1 to $n$. If you shuffle the deck, a derangement occurs if no card $m$ is in the $m$th position. Using the inclusion–exclusion principle, mathematicians can determine the probability of this happening. As the number of cards increases, the probability that a random shuffle is a derangement approaches $1/e$, which is approximately 37 percent.

inclusion-exclusion-3sets.png
inclusion-exclusion-3sets.png

Beyond simple counting, the principle is highly versatile in advanced mathematics. In the field of probability, the formula remains valid when set sizes are replaced by finite probabilities. This allows mathematicians to calculate the probability of the union of several events. The principle also fits under the broader umbrella of measure theory. In very abstract mathematical settings, the principle can be expressed as the calculation of the inverse of a specific matrix. This matrix has a special structure that makes the principle an extremely valuable technique in combinatorial theory.

Dirichlet hyperbola example 4.svg
Dirichlet hyperbola example 4.svg

Finally, the principle can be viewed through different mathematical lenses. It can be expressed in a complementary form using De Morgan's laws. This version helps calculate the number of elements that possess none of a specific list of properties. It also relates to the Möbius inversion formula for square-free natural numbers. In more complex cases, the principle can be generalized to calculate how many elements belong to exactly a certain number of sets. Whether used in discrete probability or number theory, the inclusion–exclusion principle remains one of the most useful tools for enumeration.

Dirichlet hyperbola example 4.svg
Dirichlet hyperbola example 4.svg

710 words
🖼️ Images & Media (4)
File:Венов дијаграм.svg
Венов дијаграм.svg
File:Inclusion-exclusion.svg
Inclusion-exclusion.svg
File:inclusion-exclusion-3sets.png
inclusion-exclusion-3sets.png
File:Dirichlet hyperbola example_4.svg
Dirichlet hyperbola example_4.svg
Up Next
🔢
Addition principle
Math
More to explore

What is Nepedia?

A free, ad-free encyclopedia for children. Every article is written at five reading levels, so the same page works for a five-year-old and a fifteen-year-old — use the level switcher above to see this one change. No account needed to read.