TITLE: Must this rng be a ring?
QUESTION [14 upvotes]: A rng is a ring without the assumption that the ring contains an identity. Consider a finite rng $\mathbf{R}$.
I am investigating conditions that get close forcing an identity but not quite. The closest condition I can think of is the following:

If $a\in \mathbf{R}$ is non-zero then there is $b\in\mathbf{R}$ such that $ab\neq
 0$

I am finding myself unable to prove that $\mathbf{R}$ must/need-not have a multiplicative identity i.e. be a ring. 
Are there well-known results/examples that deal with this sort of condition?

REPLY [9 votes]: In the commutative case (there are probably simple non-commutative counterexamples coming from matrix rings):
We say that a commutative rng $R$ has property $\mathcal{P}$ if, for all nonzero $a\in R$, there is some $b\in R$ with $ab\neq 0$.  The zero ring has property $\mathcal{P}$, and it has a unit.  Let $R$ be a finite nonzero commutative rng such that all smaller commutative rngs with property $\mathcal{P}$ have a unit.
Pick some $a\neq 0$.  Then there is some $b$ with $ab\neq 0$, some $c$ with $abc\neq 0$, and so on.  So there exist arbitrarily long nonzero products in $R$, which implies that there is some $x\in R$ that is not nilpotent.
Since $R$ is finite, there are $d,N$ such that $x^n = x^{n+d}$ for $n>N$.  Choosing $M$ so that $Md>N$, we have $(x^{Md})^2 = x^{2Md} = x^{Md}$, so there is some non-zero idempotent $e=x^{Md}$.
Let $I = \{r\in R \mid er = 0\}$.  $I$ has property $\mathcal{P}$: if $r\in I$ is nonzero, then there is some $s\in R$ with $rs\neq 0$.  Then $r(s-es)=s(r-er)=sr\neq 0$, and $s-es\in I$.
$I$ is strictly smaller than $R$ ($e\notin I$, because $e$ is nonzero), so, by choice of $R$, $I$ has a unit $u$.  But then $u+e$ is a unit of $R$: for any $t\in R$, $(u+e)t = ut + et=u(t-et) + et = (t-et) + et = t$.
By induction, we conclude that all finite commutative rngs with property $\mathcal{P}$ have a unit.

In retrospect, the idea here is not so difficult: As in Thomas Andrews' answer, we are trying to write $R\cong R_1\bigoplus R_2$ for subrngs $R_1,R_2$.  Direct summands inherit property $\mathcal{P}$, and $R$ has a unity if and only if both $R_1$ and $R_2$ do, so this lets us quickly reduce to the case of indecomposable rngs.
Furthermore, idempotents are one of the more natural ways to identify direct summands.  Given an idempotent $e$, we can write $R\cong eR \bigoplus \operatorname{ann}(e)$, and $eR$ always has unity $e$.  So the challenge is just to show that $R$ must contain a nonzero idempotent.