In mathematics, the cokernel of a linear mapping of vector spaces f : X → Y is the quotient space Y/im(f) of the codomain of f by the image of f. The dimension of the cokernel is called the corank of f.
Cokernels are dual to the kernels of category theory, hence the name: the kernel is a subobject of the domain (it maps to the domain), while the cokernel is a quotient object of the codomain (it maps from the codomain).
Intuitively, given an equation f(x) = y that one is seeking to solve, the cokernel measures the constraints that y must satisfy for this equation to have a solution – the obstructions to a solution – while the kernel measures the degrees of freedom in a solution, if one exists. This is elaborated in intuition, below.
More generally, the cokernel of a morphism f : X → Y in some category (e.g. a homomorphism between groups or a bounded linear operator between Hilbert spaces) is an object Q and a morphism q : Y → Q such that the composition q f is the zero morphism of the category, and furthermore q is universal with respect to this property. Often the map q is understood, and Q itself is called the cokernel of f.
In many situations in abstract algebra, such as for abelian groups, vector spaces or modules, the cokernel of the homomorphism f : X → Y is the quotient of Y by the image of f. In topological settings, such as with bounded linear operators between Hilbert spaces, one typically has to take the closure of the image before passing to the quotient.