Videos
How do I calculate the intersection between three sets?
To calculate the intersection between three sets, A, B, and C, you can use the inclusion-exclusion principle. We assume you will know all the quantities mentioned.
- Find the cardinality of the union of all three sets (
|A βͺ B βͺ C|). - Subtract the cardinality of every single set(
|A|,|B|, and|C|). - Add the cardinality of the intersection of each pair of set (
|A β© B|,|A β© C|, and|B β© C|).
The result will be the cardinality of the intersection |A β© B β© C|.
What is the symmetric difference of two sets?
The symmetric difference of two sets, A and B, is the set that contains all the elements belonging exclusively to either A or B. The corresponding logical operation is the exclusive or: when both sets exist in a given portion of the diagram, we disregard it. With higher numbers of sets in your diagram, use sum modulo 2 of the overlaps of the sets. If the overlaps are even, exclude the subset. If the overlaps are odd, include the subset.
What is the inclusion-exclusion principle?
The inclusion-exclusion principle is a fundament of set theory, a formula that allows you to calculate the union or intersection of any number of sets. To calculate the union, follow these easy steps:
- Sum the cardinalities of the individual sets.
- Subtract the cardinality of the intersections of each pair of sets.
- Sum the cardinality of each intersection of three sets.
This alternate fashion of sum and difference repeats until you end up with possible intersections. This operation results in the cardinality of the union of the sets.
The distance between circles A, B must be the solution to the two-circle Venn problem with intersection area equal to (A+B) + (A+B+C) (or simply (A+B) if by your definition it includes (A+B+C)). Similarly for B, C the intersection is (B+C) + (A+B+C), and likewise for C, A.
Solve these independently with the algorithm you have found, and you get three distances equal to the side lengths of the triangle joining the centers of the three circles. Constructing the triangle and hence drawing the circles is then an easy task with some high-school trigonometry.
The solution is unique, and only valid if the intersection values themselves are valid.
There are 8 regions defined by a 3-circle Venn diagram. If we define set A as including binary numbers 0 though 7 that have the 1-bit set, B as those with the 2-bit set, and C ans those with the 4-bit set, we get
A = {1, 3, 5, 7}; B = {2, 3, 6, 7}; C = {4, 5, 6, 7}
Each one of those numbers defined a region in the diagram, with 0 representing the region outside the circles and inside the universal set: i.e. A' β© B' β© C'.
You know how to do the 2-circle problem. So solve that for A and B (using the sizes of A, B, and A β© B), B and C, and A and C. that gives you distances between the circle centers and the sizes of the circle. Use the three distances to draw a triangle for those circle centers, then draw the circles around those centers. If that makes the exterior region 0have the wrong size, you can shrink or expand the entire 3-circle setup to get that right as well.
That makes all regions correct--except for region 7, the intersection of all three sets. That size will be set from all the others--you have no choice here. Therefore, it will probably not have the size you desire. You will need to experiment to see if the size of that region is usually close enough to what you want. My brief research implies that there is no way to use circles in your diagram and always get the sizes of all eight regions. If you use ellipses or some other more-general shape instead, this should be possible, but you seem to want circles.
Note that if you solve the 2-circle problem correctly, the situation of disjoint circles and of subset circles will automatically be handled. For example, if A and B are disjoint, then regions 3 and 7 are empty, and your solution will make the two circles to not overlap. They will probably touch, if you use the obvious algorithm from your linked site, but without overlap. Similarly, if one set is a subset of another, one circle will be inside the other, though they will probably touch. If you do not want the touching, the algorithm to avoid that should be easy, unless of course you have the situation where two of your three sets are equal.