Can there be an onto homomorphism from a ring without unity to a ring with unity?

I'm surprised nobody suggested this obvious construction yet:

Let $R_1$ be a ring without identity, and $R_2$ be a ring with identity. Then $R=R_1\times R_2$ is a ring without identity, and $(r_1,r_2)\mapsto r_2$ is a surjective ring homomorphism of $R\to R_2$.


Let $R$ be the set of even integers. This is a ring without unity.

Let $R'$ be the ring of integers modulo $3$. This is a ring with unity.

Let $\phi:R\to R'$ be the "reduction modulo $3$" map. This is a surjective homomorphism of rings.


Algebras of functions are a source of examples. Consider the restriction homomorphism from $C_0(\mathbb R)$ onto $C[0,1]$

Remark All of the examples given up to now, maybe with exception of that of Jendrik Stelzner, have the same feel to me. E.g., the example of Lord Shark: associate to an integer $n$ a "function" on the primes whose value at $p$ is $[n]_p$. Lord Shark takes the subring of the integers whose value at $p = 2$ is zero, and evaluates at $p = 3$. It's easy (but probably pointless) to fit rschweib's example into this rubric. My other example with irreducible representations of a compact group also fits the pattern: associate to an element $f$ of the convolution algebra a "function" $\hat f$ on the set of irreducible representations, defined by $\hat f(\pi) = \pi(f)$. This is a sort of Fourier transform. The set of functions you get will satisfy a $c_0$ condition, and in any case has no identity element. Now the homomorphism evaluates these functions at a finite point to produce a ring with identity.


Another rather different source of examples in analysis would be the algebras of continuous functions on a (continous) compact group, under convolution. These algebras don't have an identity (since the identity wants to be the point mass at the group identity). But the groups, and therefore the convolution algebras have finite dimensional irreducible representations; i.e. there are homomorphisms onto full matrix algebras. (In fact all irreducible representations are finite dimensional, see https://mathoverflow.net/questions/119402/why-all-irreducible-representations-of-compact-groups-are-finite-dimensional.)


For every $S \subseteq R$ denote by $\langle S \rangle$ the two-sided ideal generated by $S$, i.e. the smallest two-sided ideal containing $S$. Then for every $x \in R$ one can consider the quotient ring $$ R'_x = R/\langle rx-r, xr-r \mid r \in R \rangle \,, $$ for which $\overline{x} \in R'_x$ is a unit element.

Note that every unital ring $R'$ for which there exists a surjective ring homomorphism $\phi \colon R \to R'$ is a quotient of such a ring $R'_x$ (e.g. for $x \in R$ with $\phi(x) = 1_{R'}$). Also note that for $x = 0$ we get the example $R'_x = 0$, which hasn’t been mentioned so far.