Cokernel (source code)

= Cokernel
{title2=$\operatorname{coker}T=W/\operatorname{im}T$}
{wiki}

The <cokernel> records output information that a <linear map> cannot produce. For $T:V\to W$, it is the <quotient vector space>
$$
\operatorname{coker}T=W/\operatorname{im}T.
$$
Its elements are <cosets> $[b]=b+\operatorname{im}T$. Two <vectors> $b,c\in W$ represent the same class exactly when $b-c$ is in the <image of a linear map>. The zero class is the whole <image of a linear map>, so
$$
\boxed{T(x)=b\text{ is solvable}\iff[b]=0\text{ in }\operatorname{coker}T.}
$$
Changing $b$ by an attainable output does not change its obstruction. This is useful because one can test compatibility before trying to find an input. The <quotient vector space> construction is described in Axler's §3E. <Linear Algebra Done Right by Sheldon Axler (4th edition)>[Sheldon Axler, Linear Algebra Done Right, fourth edition, §3E: quotient spaces]{ref}

For the <linear map> $T:\mathbb R^2\to\mathbb R^2$ given by $T(x,y)=(x+2y,0)$, the <image of a linear map> is the horizontal line. All outputs $(b_1,b_2)$ with the same second coordinate have the same <cokernel> class, because their difference is horizontal. Thus this <cokernel> is <isomorphic> to $\mathbb R$ via $[(b_1,b_2)]\mapsto b_2$. In particular, $(3,0)$ has zero class and is attainable, while $(3,1)$ has nonzero class and is unattainable.

\Image[/cokernel-solvability-obstruction.png]
{title=The second output coordinate is a cokernel obstruction to solving $T(x,y)=b$}
{description=The horizontal axis is the <image of a linear map> $T(x,y)=(x+2y,0)$. The class of $b=(3,1)$ is the parallel line $b+\operatorname{im}T$, which never meets the image. The projection $(3,0)$ is attainable but has a different <cokernel> class.}

If $W$ is finite-dimensional, the dimension rule for a <quotient vector space> gives
$$
\dim W=\operatorname{rank}T+\dim\operatorname{coker}T.
$$
Compare this with the <rank-nullity theorem>, $\dim V=\operatorname{rank}T+\dim\ker T$. The <kernel> counts invisible inputs; the <cokernel> counts missing output directions. They need not have the same <dimension>: $B(x,y,z)=(x+2y,0)$ has a two-dimensional <kernel> and a one-dimensional <cokernel>. A <linear map> is <surjective> exactly when its <cokernel> is zero.

The <cokernel> is a quotient, rather than a chosen perpendicular <vector subspace>. With a finite-dimensional <inner product space> as output, one may represent each class by its unique component in the <orthogonal complement> of the <image of a linear map>. That representation depends on the chosen <inner product>. For <matrices> over the <complex numbers>, this complement is $\ker A^*$, leading to the <cokernel compatibility equations>.

The same quotient definition applies to a <group homomorphism> of <abelian groups>. For $T:\mathbb Z\to\mathbb Z$ given by $T(n)=2n$, the <cokernel> is $\mathbb Z/2\mathbb Z$. The equation $2n=b$ is solvable exactly when $b$ is an <even integer>; the two <cosets> record <integer parity>. A quotient captures the obstruction here just as it captures a missing output coordinate for a <linear map>.