Definition and test: Suppose that we are given a set S with operations of addition and multiplication, and we are asked to prove that it is a ring. In general, we have to check all the axioms. But there is a situation in which things are much simpler: this is when S is a subset of a set R which we already know to be a ring, and the addition and multiplication in S are just the restrictions of the operations in R (that is, to add two elements of S, we regard them as elements of R and use the addition in R).
Definition Let R be a ring. A subring of R is a subset S of R which is a ring in its own right with respect to the restrictions of the operations in R. What do we have to do to show that S is a subring?
• The associative law (A1) holds in S. For, if a,b,c ∈ S, then we have a,b,c ∈ R (since S ⊆ R), and so
(a b) c = a (b c) since R satisfies (A1) (as we are given that it is a ring).
• Exactly the same argument shows that the commutative law for addition (A4), the associative law for multiplication (M1), and the distributive laws (D), all hold in S.
• This leaves only (A0), (A2), (A3) and (M0) to check.

Even here we can make a simplification, if S ≠ 0. For suppose that (A0) and (A3) hold in S. Given a ∈ S, the additive inverse −a belongs to S (since we are assuming (A3)), and so 0 = a (−a) belongs to S (since we are assuming (A0)). Thus (A2) follows from (A0) and (A3). We state this as a theorem:

Theorem 2.9 (First Subring Test) Let R be a ring, and let S be a non-empty subset of R. Then S is a subring of R if the following condition holds: for all a,b 2 S, we have a b,ab,−a ∈ S.

Example We show that the set S of even integers is a ring. Clearly it is a nonempty subset of the ring Z of integers. Now, if a,b 2 S, say a = 2c and b = 2d, we have
a b = 2(c d) ∈ S,    ab = 2(2cd) ∈ S,     −a = 2(−c) ∈ S,
and so S is a subring of Z, and hence is a ring.
The theorem gives us three things to check. But we can reduce the number from three to two. We use a−b as shorthand for a (−b). In the next proof we need to know that −(−b) = b. This holds for the following reason. We have, by (A3),
b (−b) = (−b) b = 0,
so that b is an additive inverse of −b. Also, of course, −(−b) is an additive inverse of −b. By the uniqueness of additive inverse, −(−b) = b, as required. In particular, a−(−b) = a (−(−b)) = a b.
Theorem 2.10 (Second Subring Test) Let R be a ring, and let S be a non-empty subset of R. Then S is a subring of R if the following condition holds:
for all a,b ∈ S, we have a−b,ab ∈ S.
Proof Let S satisfy this condition: that is, S is closed under subtraction and multiplication. We have to verify that it satisfies the conditions of the First Subring
Test. Choose any element a ∈ S (this is possible since S is non-empty). Then the hypothesis of the theorem shows that 0 = a−a ∈ S. Applying the hypothesis
again shows that −a = 0−a ∈ S. Finally, if a,b 2∈ S, then −b ∈ S (by what has just been proved), and so a b = a−(−b) ∈ S. So we are done.

Cosets: Suppose that S is a subring of R. We now define a partition of R, one of whose parts is S. Remember that, by the Equivalence Relation Theorem, in order to specify a partition of R, we must give an equivalence relation on R. Let S be the relation on R defined by the rule a ≡S b if and only if b−a ∈ S.
We claim that S is an equivalence relation.
Reflexive: for any a ∈ R, a−a = 0 ∈ S, so a ≡s a.
Symmetric: take a,b ∈ R with a ≡S b, so that b−a ∈ S. Then a−b = −(b−a) ∈ S, so b ≡S a.

Transitive: take a,b,c ∈ R with a ≡S b and b ≡S c. Then b−a,c−b ∈ S. So
c−a = (c−b) (b−a) ∈ S, so a ≡S c.
So ≡S is an equivalence relation. Its equivalence classes are called the cosets of S in R.

Example Let n be a positive intger. Let R = Z and S = nZ, the set of all multiples of n. Then S is a subring of R. (By the Second Subring Test, if a,b ∈ S,
say a = nc and b = nd, then a−b = n(c−d) ∈ S and ab = n(ncd) ∈ S.) In this case, the relation S is just congruence mod n, since a ≡S b if and only if b−a is a multiple of n. The cosets of S are thus precisely the congruence classes mod n. An element of a coset is called a coset representative. As we saw in the first chapter, it is a general property of equivalence relations that any element can be used as the coset representative: if b is in the same equivalence class as a, then a and b define the same equivalence classes. We now give a description of cosets. If S is a subset of R, and a ∈ R, we define S a to be the set
S a = {s a : s ∈ S}
consisting of all elements that we can get by adding a to an element of S.
Proposition 2.11 Let S be a subring of R, and a ∈ R. Then the coset of R containing a is S a.
Proof Let [a] denote the coset containing a, that is, [a] = {b ∈ R : a ≡S b} = {b ∈ R : b−a ∈ S}.
We have to show that [a] = S a.
First take b ∈ [a], so that b−a ∈ S. Let s = b−a. Then b = s a ∈ S a. In the other direction, take b ∈ S a, so that b = s a for some s ∈ S. Then
b−a = (s a)−a = s ∈ S, so b ≡S a, that is, b ∈ [a].
So [a] = S a, as required.
Any element of a coset can be used as its representative. That is, if b ∈ S a, then S a = S b.
Here is a picture.

Note that S 0 = S, so the subring S is a coset of itself, namely the coset containing 0.
In particular, the congruence class [a]n in Z is the coset nZ a, consisting of all elements obtained by adding a multiple of n to a. So the ring Z is partitioned into n cosets of nZ.