I recently came across the following characterization of unit regular elements of an endomorphism ring (Corollary to Theorem 1 in [this article](https://www.ams.org/journals/tran/1976-216-00/S0002-9947-1976-0387340-0/S0002-9947-1976-0387340-0.pdf)).



> 
> Let $M$ be a vector space over the division ring $D$, and let $R = \text{End}(M)$. If $a \in R$, then $a$ is unit regular if and only if $\text{dim}(\ker a) = \text{dim}(\text{coker}\, a)$
> 
> 
> 


Is Ehrlich implicity assuming that the dimension of $M$ is countable and the dimensions of the kernel and cokernel are finite, or is there an example of a unit regular endomorphism with infinite kernel or cokernel?



Ehrlich's Characterization of Unit Regular Elements
Manny's answer is absolutely correct. I wanted to add that Ehrlich's argument, which in its original formulation requires the endomorphism ring to be von Neumann regular, actually characterizes unit-regular elements in the endomorphism ring of *arbitrary* modules, as noted by T. Y. Lam and others (in numerous places, but perhaps most prominently in his "Exercises in Classical Ring Theory" book). The characterization is as follows:


Let $k$ be a ring, let $M\_k$ be any right $k$-module, and let $R={\rm End}(M\_k)$.


An element $a\in R$ is (von Neumann) regular if and only if ${\rm ker}(a)$ and ${\rm im}(a)$ are direct summands of $M$. Moreover, in this case, $a$ is unit-regular if and only if ${\rm ker}(a)\cong {\rm coker}(a)$.


