What does mod and congruence mean in algebra. I have sometimes seen notations like $a\equiv b\pmod c$. How do we define the notation? Have I understood correctly that $c$ must be an element of some ring or does the notation work in magmas in general?
 A: In a commutative ring $\,R,\, $ $\, a\equiv b\pmod c\,$ means $\,c\mid a-b,\ $ i.e. $\,a-b = cr\,$ for some $\,r \in R,\,$ i.e. $\,a-b\in cR.\,$ More generally, $\,a\equiv b\pmod{ c_1,\ldots, c_n}\,$ means that $\,a-b\in (c_1,\ldots c_n)R := c_1 R+\cdots+ c_n R,\,$ the sum of the principal ideals $\,c_i R,\,$ i.e $\,a-b = c_1 r_1 + \cdots + c_n r_n\,$ for some $\,r_i\in R.\,$  If $\,S\subset R\,$ then $\,a\equiv b\pmod{\! S}$ means $\,a-b\in SR\,$ where $\,SR\,$ is the ideal generated by $S$ in $R$.
Congruence arithmetic provides an "element-ary" way of working in quotient (residue) rings. See here for the general correspondence between congruences, ideals, & $R$-subalgebras of a square $R^2$.
Similarly for groups (and ideal-determined algebras) we can normalize all equations $\,a = b\,$ to the form $\,a\!-\!b = \color{#c00}0,\,$ so a congruence is determined by a $\rm\color{#c00}{single}$ congruence class: all elements $\color{#c00}{\equiv 0}$ (as above for ideals in rings). In more general types of algebras we need to work directly with congruence (equivalence) relation operations.
As for magmas, or any other algebraic structure defined by purely equational axioms, the notion of ring-congruence generalizes in a straightforward way to that of an equivalence relation that is compatible with all of the operations of the structure, e.g. $\, A\equiv a,\ B\equiv b\,\Rightarrow\, A\oplus B = a\oplus b\,$ for all binary operations $\,\oplus\,$ of the algebra, and similarly for all other $\,n$-ary operations of the structure. Just as for rings, there is a quotient algebra that reifies the (modular) congruence  arithmetic within an algebraic structure of the same type, just like even/odd parity arthmetic of integers mod $\,2\,$  is ring-theoretically reified as arithmetic in the quotient/residue ring $\,\Bbb Z/2.$
A: You certainly need a ring since a magma has only one binary operation while the modulus expression involves two:
$$a\equiv b\pmod{c}:\iff a=b+k\cdot c$$
