I have some trouble understanding the following proof. After doing some research, I realized that this is (probably) the Fundamental Theorem of equivalence relations. I didn't understand the proofs I found online and I struggled specifically with the following proof:
Theorem: Let $R$ be an equivalence relation on the set $X$. Then every element $a \in X$ belongs to exactly one equivalence class and for any two equivalence classes $A, A'$ we either have $A=A'$ or $A \cap A' = \emptyset$.
Proof: For a fixed $a \in X$ we define $A := \{x \in X : x \sim a\}$. We show that $A$ is an equivalence class that contains $a$. Because of $a \sim a$, we have $a \in A$ and therefore $A \neq \emptyset$. For $x,y \in A$, we have $x \sim a$ and $y \sim a$ and therfore also $x \sim y$.
If $x \in A, y \in X$ and $x \sim y$, then we have $x \sim a$ and $y \sim a$ and therefore $y \in A$. Now we have shown that $a$ is contained in at least one equivalence class[*].
Now we need to show that two equivalence classes $A$ and $A'$ are either the same or disjoint. Let $A \cap A' \neq \emptyset$ and $a \in A \cap A'$. If $x\in A$, then we have $x \sim a$ and because of $a \in A'$ we also have $x \in A'$. Therefore, we have $A \subset A'$. We can prove $A' \subset A$ analougsly. Therefore, $A = A'$.
[*] This is the step I am having trouble with. Why did we assume that $y \in X$ and not $y \in A$ as we have done before? First we let $x,y \in A$ to show that $x \sim y$ and then we set $y \in X$ to show that $y \in A$? Don't we use $x \sim y$ to show that point and $x \sim y$ dependes on $x,y \in A$? And why does it follow that $a$ is contained in at least one equivalence class?
Let $\sim$ denote an equivalence relation on set $X$.
That means that the relation is reflexive, symmetric and transitive.
If we define for every $a\in X$ the set:$$[a]:=\{x\in X\mid a\sim x\}$$ then the reflexivity of $\sim$ tells us immediately that $a\in[a]$.
Transitivity tells us that:$$c\in[a]\text{ and }x\in[c]\implies x\in[a]$$ or equivalently:$$c\in[a]\implies[c]\subseteq[a]\tag1$$
By symmetry we find:$$c\in[a]\iff a\sim c\iff c\sim a\iff a\in[c]$$This tells us that $(1)$ can be replaced by the stronger statement:$$c\in[a]\iff[c]=[a]\tag2$$
So if $[a]$ and $[b]$ have an element $c$ in common then $(2)$ tells us immediately that $[a]=[c]=[b]$.
This shows that for sets $[a]$ and $[b]$ there are only two options: they are disjoint or they coincide.
The sets of form $[a]$ are by definition the equivalence classes induced by $\sim$.
If $A\subseteq X$ is such an equivalence class then $A=[a]$ for every $a\in A$ and an element of $A$ is a so-called representative of the class.
As shown above these sets form a partition of $X$.