Are epimorphisms in the category of magmas surjective? The question says it all, but let me recall the definitions.

*

*A magma $(X, \cdot)$ is a set $X$ with a binary operation $\cdot \colon X \times X \to X$ (without any further assumptions like associativity).

*A morphism between two magmas $X$ and $Y$ is a map $f \colon X \to Y$ with $f(a \cdot b) = f(a) \cdot f(b)$ for all $a, b\in X$.

*A morphism $f$ is epi, respectively mono, if one can cancel it from the right, respectively left: $g \circ f = h \circ f \implies g=h$, respectively $f \circ g = f \circ h \implies g = h$.

Using free magmas with one generator shows that monomorphisms are injective.
The question is whether epimorphisms are always surjective (in many other categories this fails, e.g., in the category of monoids).

Yes. Suppose $f:X\to Y$ is not surjective, and let $Z$ be the complement of $f(X)$ in $Y$. Then the disjoint union $f(X)\cup Z\cup Z'$ of $f(X)$ and two copies of $Z$ can be given a magma structure so that the two obvious embeddings of $Y$ (as $f(X)\cup Z$ and $f(X)\cup Z'$) are inclusions of submagmas, and have the same composition with $f$. Products of elements of $Z$ with elements of $Z'$ can be defined arbitrarily.
