# Understanding concept of an operation being well defined for an equivalence relation

Let $I$ be an ideal in a ring $R$.

Define the relation (congruence modulo $I$) by

$a \equiv b$ if $b - a \in I$

Denotes the equivalence class containing $a$ by $\bar{a}$.

Define $$\bar{a} + \bar{b} = \overline{a+b}$$

This operation is well defined because of the following:

Suppose $a_1 \equiv a_2$ and $b_1 \equiv b_2$, so that $a_2 - a_1 = r \in I$, and $b_2 - b_1 = s \in I$, then

$$(a_2 + b_2) - (a_1 + b_1) = (a_2 - a_1) + (b_2 - b_1) = r + s \in I$$

Question

I do not understand how this shows that $$\bar{a} + \bar{b} = \overline{a+b}$$ is well defined. Where did the first part of the equality, $(a_2 + b_2) - (a_1 + b_1)$, come from. How does showing it equals $r + s \in I$ make it well-defined?

Aside: What is an intuitive way to think of the process of showing an operation is well-defined as this often seems unclear to me when it pops up in various situations.

## In general

The "well-defined" you see here is exactly the same term used in the definition of a function. Recalling that, for a function $f$ the property is "If $x=y$, then $f(x)=f(y)$."

Some beginners don't realize that this is important to say until they see an example like this: on the set of rational numbers, the 'map' $f(\frac{a}{b})=a$ is not a function. You can see that $\frac{1}{2}=\frac{2}{4}$, but of course the images are $1\neq 2$ and aren't equal.

A binary operation is no different, it is just a function from $X\times X\to X$. So you could come up with a similar example of an ill-defined operation on the rationals: Consider $B(\frac{a}{b},\frac{c}{d})=ac$. Again you can check that $B(\frac{1}{2},\frac{1}{1})\neq B(\frac{2}{4},\frac{2}{2})$, for example. You can compute $B(,)$ for any pair of rational numbers, but $B$ simply doesn't treat equal fractions equally: it's not well-defined and gives different answers for equal inputs.

So we would like to define $\bar{a}+\bar{b}:=\overline{a+b}$, but the devil's advocate will point out that if you chose different $a$ and $b$, maybe you would get something different than you got with this $a$ and $b$. That is, in principle I might be able to pick $\bar{c}=\bar{a}$ and $\bar{d}=\bar{b}$ such that $\overline{c+d}\neq\overline{a+b}$, and that would be bad for our proposed operation, because it says equal inputs might produce unequal outputs.
But fortunately the axioms of ideals come to the rescue and in fact prove that this can't happen. By definition of $\bar{c}=\bar{a}$ and $\bar{d}=\bar{b}$, you have that $a-c\in I$ and $b-d\in I$. Since $I$ is additively closed, $a-c+b-d\in I$. But this means that $\overline{a+b}=\overline{c+d}$. Thus, you've shown that no matter how you pick $a$ and $b$, you'll get consistent results out of the proposed operation.
You'll need to use the other parts of the definition of an ideal to show that multiplication given by $\bar{a}\bar{b}:=\overline{ab}$ is well defined... good luck!
A map $f\colon X\to Y$ is well-defined if we have maps $\pi\colon Z\to X$ and $h\colon Z\to Y$ and (try to) define $f(x)$ per "pick $z\in Z$ with $\pi(z)=x$ and let $f(x)=h(z)$". In order for this to actually defined'a map $X\to Y$, we must make sure that the "picking" of $z\in Z$ does not influence the value obtained for $f(x)$. That is, we must show that whenever $\pi(z_1)=\pi(z_2)=x$, then also $h(z_1)=h(z_2)$.
In this example, we have $\pi(a_1)=\pi(a_2)\iff a_1-a_2\in I$, whence the calculation.