Cokernel of a Composition. Supoose $U$, $V$ and $W$ are vector spaces. Let $f: U\to V$ and $g:V\to W$ are two linear transformations. Do we have any formulas expressing the dimension of $\operatorname{coker}(gf)$ in terms of dimensions of $\operatorname{coker}(f)$ and $\operatorname{coker}(g)$?
 A: There can be no such formula.  To see why, let $V = U \cong \mathbb{F}^2$, where $\mathbb{F}$ is the base field, and let $W = \mathbb{F}$.  Take a basis $\{e_1,e_2\}$ for $U$, and let $g : e_1 \mapsto 1, e_2 \mapsto 0$.  Now consider two different choices for $f$:


*

*$f_1 : e_1 \mapsto e_1, e_2 \mapsto 0$.

*$f_2 : e_1 \mapsto e_2, e_2 \mapsto 0$.


In each case, the cokernel of $f_i$ has dimension one, but the cokernel of $gf_1$ is $0$, whereas the cokernel of $gf_2$ is $\mathbb{F}$.
A: This is an old question but since I was thinking about the same question, let me give you a bit more positive answer:
More generally let $U,V,W$ be left modules over a ring $R$ with one and the maps are $R$-linear. Then there is a right exact sequence
$$ \operatorname{coker} f \longrightarrow \operatorname{coker}gf \longrightarrow \operatorname{coker} g \longrightarrow 0.$$
Under the additional hypothesis that $g$ is injective, we even get a short exact sequence
$$0 \longrightarrow \operatorname{coker} f \longrightarrow \operatorname{coker}gf \longrightarrow \operatorname{coker} g \longrightarrow 0.$$
In particular you get some information about the dimensions in the vector space case. In general
$$ \dim \operatorname{coker} g \le \dim\operatorname{coker} gf \le \dim \operatorname{coker} f + \dim\operatorname{coker} g.$$
When $g$ is injective, you get
$$\dim\operatorname{coker} gf = \dim \operatorname{coker} f + \dim\operatorname{coker} g.$$
One can even pin the dimension down further with the following information. One should note that
$$\ker( \operatorname{coker} f \to \operatorname{coker} gf) \cong (\operatorname{im} f +\ker g)/ \operatorname{im} f\cong \ker g/(\operatorname{im}f\cap \ker g).$$
Thus
$$\dim\operatorname{coker} gf = \dim \operatorname{coker} f + \dim\operatorname{coker} g-\dim (\operatorname{im}f+\ker g) + \dim \operatorname{im}f$$
and
$$\dim\operatorname{coker} gf = \dim \operatorname{coker} f + \dim\operatorname{coker} g-\dim \ker g + \dim (\operatorname{im}f\cap \ker g).$$
