In mathematics, a cofinite subset of a set X is a subset Y whose complement in X is a finite set. In other words, Y contains all but finitely many elements of X.
Boolean algebras The set of all subsets of X that are either finite or cofinite forms a Boolean algebra, i.e., it is closed under the operations of union, intersection, and complementation. This Boolean algebra is the finite_cofinite algebra on X. A Boolean algebra A has a unique non_principal ultrafilter (i.e. a maximal filter not generated by a singleton set) if and only if there is an infinite set X such that A is isomorphic to the finite_cofinite algebra on X. In this case, the non_principal ultrafilter is the set of all cofinite sets.
Topology The cofinite topology on any set X consists of the empty set and all cofinite subsets of X. In the cofinite topology, the only closed subsets are finite sets, or the whole of X. Then X is automatically compact in this topology, since every open set only omits finitely many points of X. Also, the cofinite topology is the smallest topology satisfying the T_{1} axiom; i.e. it is the smallest topology for which every singleton set is closed. In fact, an arbitrary topology on X satisfies the T_{1} axiom if and only if it contains the cofinite topology. One place where this concept occurs naturally is in the context of the Zariski topology. Since polynomials over a field K are zero on finite sets, or the whole of K, the Zariski topology on K (considered as affine line) is the cofinite topology. The same is true for any irreducible algebraic curve; it is not true, for example, for XY = 0 in the plane.
