Set intersection (source code)

= Set intersection
{title2=$\bigcap$}
{wiki=Intersection_(set_theory)}

= Intersection
{synonym}

The intersection $A\cap B$ keeps exactly the <set elements> common to both <sets>:
$$
A\cap B=\{x:x\in A\text{ and }x\in B\},\qquad x\in A\cap B\iff(x\in A)\wedge(x\in B).
$$
Membership in an <intersection> therefore uses <logical conjunction> (AND). For $A=\{1,2,3\}$ and $B=\{3,4\}$, the only shared member is $3$, so $A\cap B=\{3\}$. The <Venn diagram> in <set union> shades only the overlap for this operation.

An <intersection> is useful when every requirement must hold. If $A$ and $B$ are the <sets> of database records passing two separate conditions, their <intersection> gives the records passing both. Similarly, satisfying two <equations> requires belonging to the <intersection> of their <solution sets>. The same membership rule applies even when the objects have entirely different meanings.

For a family of <sets>, the <intersection> $\bigcap_{i\in I}A_i$ contains exactly the <set elements> belonging to every <set> $A_i$:
$$
x\in\bigcap_{i\in I}A_i\iff\forall i\in I:\ x\in A_i.
$$
Here <universal quantification> expresses “every”. If all the <sets> lie within a fixed <universal set> $U$, the <intersection> over no indexing members is defined to be $U$: there are no requirements to fail. This convention depends on specifying $U$. By contrast, intersecting with the <empty set> always gives $A\cap\varnothing=\varnothing$.