Princípio da Inclusão-Exclusão (2)
- Created by
- Renato Passos, Eng. de Software
- Reviewed by
- Renato Passos, Eng. de Software
Last updated: Apr 18, 2026
Formula
IE
About this calculator
The Inclusion-Exclusion Principle calculator for two sets solves counting problems where elements may belong to more than one category. It calculates the total number of elements in the union of two sets A and B, using the formula |A ∪ B| = |A| + |B| - |A ∩ B|. Simply input the sizes of A, B, and the intersection to get the result. It is useful for counting students who like math or physics, or items with two characteristics.
The operation is straightforward: subtract the intersection to avoid double counting. For example, if 10 students like math, 8 like physics, and 3 like both, the union is 10 + 8 - 3 = 15. The calculator automates this calculation, preventing errors. It is suitable for basic combinatorics problems, Venn diagrams, and probability. Note: the formula applies only to two sets; for three or more, an extended version with more terms is needed.
Use this tool when you need to count elements satisfying at least one of two conditions, such as in surveys, inventories, or data analysis. Remember that the intersection must be known or estimated. If the sets are disjoint (zero intersection), the union is simply the sum. The calculator helps avoid the common mistake of adding without subtracting the overlap.
Frequently asked questions
How do I calculate the union of three sets with this principle?
For three sets, the formula is |A∪B∪C| = |A|+|B|+|C| - |A∩B| - |A∩C| - |B∩C| + |A∩B∩C|. This calculator only handles two sets.
Do I need to know the intersection value to use the calculator?
Yes, the intersection is required. If unknown but you have other information, it might be deduced.
What if the sets are disjoint?
If the intersection is zero, the union is simply the sum of the sizes. Enter 0 in the intersection field.
Does this formula work for probabilities?
Yes, the principle holds for probabilities: P(A∪B) = P(A) + P(B) - P(A∩B). Just input values as decimals or percentages.