 This lecture is part of Berkeley Math 115, an introductory undergraduate course on number theory, and will be mostly about rings in number theory. So I'll just start by very quickly recalling the definition of a ring. So a ring is something where you can do addition, subtraction and multiplication, satisfying the usual rules of algebra. Here are some examples of rings. We have the integers, usually denoted by z, the real numbers and the complex numbers. And a particularly important example we've been studying a lot is the integers, modulo n, which I'll denote by z, divided by nz for a reason that will be coming up fairly soon. They say they satisfy the usual rules of high school, algebra is a little bit vague. So more precisely, the ring is a group under addition, more precisely an abelian group. So in other words, we have an identity with 0 plus a equals a plus 0 equals a. We have inverses a plus minus a equals 0 equals minus a plus a, and we have associativity a plus b plus c equals a plus b plus c. And it has a multiplication with an identity that is commutative. We're only using commutative rings. So a times 1 equals 1 times a equals a and abc equals abc. And finally, we have the distributive rules. I guess I should have said ab equals ba, because we're taking them to be commutative, because the a times b plus c is ab plus ac. And if your ring wasn't commutative, you'd have to have a second distributive rule, but we won't bother with that. So now I want to define quotients of rings as a generalization of taking the integer modulo number. First, let's define quotients of groups. And here I'm going to take the groups to be abelian or commutative just to avoid some minor problems. So suppose that h is a subgroup of the group g. And I'm going to write the group g with an operation being addition. And what we can do is we can then define a quotient group g modulo h, which is roughly what we get by make all elements of h equal to zero. So more precisely what we do is we define an equivalence relation on g by saying a is congruent to b. You can say a is congruent to b modulo h, if you want to include the subgroup h, to mean a minus b is in the subgroup h. And we can check this is an equivalence relation. In other words, a congruent to b implies b congruent to a, and a is congruent to a, and a is congruent to b, and b is congruent to c, implies a is congruent to c. Moreover, it has the properties that if a is congruent to b and c is congruent to d, then a plus c is congruent to b plus d, and ac is congruent to bd, and so on. So multiplication and addition sort of preserves equivalence classes. And what this means is that we can define g over h with either the set of equivalence classes. Well, thinking of equivalence classes is a bit of a headache to think about. So usually we just take a set of representatives, psychological reasons of equivalence classes, and we've done this for the integers modulo n. So for example, if we take g to be the integers and h to be m times the integers, then g modulo h is just the integers modulo m. That's more or less the same definition. And we can think of the elements either as being equivalence classes. So the equivalence classes would be things like minus 2m, minus m0, m2m, that would be the equivalence class containing zero. And then the equivalence class containing one would be this one, and so on. But of course, humans, I mean, think of entire equivalence classes as a real headache. So instead of thinking of the equivalence classes, we just pick a representative element from each equivalence class and think of g over h in this case as being the set of element 0, 1, m minus 1. So we just pick one from each equivalence class, and that's much easier to think about. So we can do the same for any abelian group and any subgroup. If the group g is none abelian, you can do something similar, but there are several minor complications. It doesn't work for all groups h. You need to take something called a normal subgroup, but we won't go into that because all our groups will be abelian. And now we can do the same for rings. So suppose g, suppose r is a ring, we want to define quotient r modulo i. And you may think we can take i to be a subring, but that doesn't really quite work. For a start, we've said that the subring has to contain the identity element i. And so the identity element 1, so you'd be saying 1 is equal to 0 if you quotient it out and that's just going to collapse this. It turns out we need i to be something called an ideal. The name ideal comes from complicated historical reasons. So first of all, i is a subgroup of r under addition. And this means we can define the group r over i under addition. And then we need multiplication to be well-defined. In other words, we want to have the property that a is equivalent to b and c is equivalent to d, then a times c is equivalent to b times d. And it's easy to check that this property follows if the ideal i is closed under multiplication by elements of r. And it's important to notice that we're not saying i is just closed under multiplication by elements of i. We're saying it must be closed under all multiplication by all elements of the ring r. And if the subgroup i has this extra property, then multiplication is well-defined. So the quotient r over i is also a ring. And the standard example is we just take r to be the integers and i to be the integers times m. And obviously, i is closed under multiplication by all integers, so it's an ideal. And again, we find that z, the integers modulo m, form a ring. So the construction of the integers modulo m generalizes to any ideal, so any ring modulo any ideal. Let's have some further examples of this. Let's take the ring r to be the real numbers polynomials over the reals. And let's take the ideal i to be all multiples of the polynomial x squared plus one. And we usually denote the set of all multiples of x squared plus one by just putting x squared plus one in parentheses. And yes, I know mathematicians overuse parentheses and this is yet another overuse of them. So this just means all elements of the form f times x squared plus one where f is some polynomial. And then what is r over i? Well, any polynomial is a multiple of x squared plus one plus some linear polynomial. So its elements are just of the form a plus b times x for a and b real. And they're multiplied by setting, well, x squared plus one is equal to zero in this ring. So we can think of x as being the square root of minus one. So what we've done is we've actually just added a square root of minus one to the reals. And this ring is, of course, just the complex numbers c, except we usually write x as being i. So we would have all the elements a plus b i with i squared equals minus one. So the construction of the complex numbers and the construction of the integers modulo m are both special cases of taking a quotient of a ring by an ideal. More generally, we can do this with any polynomial. So we can take the ring of polynomials and we can quotient it out by all multiples of f. So this is the ideal of all multiples of the polynomial. And we'll see analogs of this coming up a bit later where we're going to replace r by something else. Now let's look at analogs of the Chinese remainder theorem. So the Chinese remainder theorem says that the integers modulo mn is isomorphic to the integers modulo m times the integers modulo n whenever m and n co-prime. So what I want to do is to have an analog of this for rings. So here mz and nz are ideals of z. So what we should do is we should pick two ideals i and j of a ring r. And then we have a map from ring r to r over i times r over j. So what is this? Well, this is just a product of rings. So product of rings is defined in more or less the obvious way. If we've got two rings r and s, then the product r times s is a set of all pairs rs with r in r and s in s. And this time this is an ordered pair, not the ideal generation by r and s. I'm sorry, notation is really ambiguous. And we just define addition and multiplication in the obvious way. So r1 s1 plus r2 s2 is equal to r1 plus r2 s1 plus s2 and r1 s2 times r. So r1 s1 times r2 s2 is r1 r2 s1 s2. You can figure out what zero and one of this ring is. So we've got a map from the ring r to r modulo i, just projecting it into r modulo j. So we also have a map from the ring to the product of these two rings, which just takes r to its image in here times its image in here. And this is sort of looking a bit like the Chinese remainder theorem. So let's take another look at this r maps to r over i times r over j. And we can ask when is it on to? Well, the answer is it's on to when i plus j is equal to r. So i plus j is the set of things i plus little i plus little j for i in i and j in j. And if i plus j is equal to r, this implies that 1 is equal to i plus j for some i in i. j in j. So now suppose a b is in r over i times r over j. So we can think of a as being really in r. I mean, not really. Sorry. We want to find some element r in the ring r such that it does image a in r over i and b in r over j. So what this means is r must be equal to a plus i for some i and it must be equal to b plus j for some j, where we have picked representatives a of this element r over i except now we're thinking of a as being an element of r. So we can solve for this because all this says is that i minus j is equal to b minus a and we can solve for i in i and j in j because we said that any element of r in particular b minus a can be written in this form. So provided i plus j is equal to r, this condition is satisfied. Now we notice that if m and n are co-prime, then zm plus zn is equal to z. So this condition is satisfied for pairs of numbers m and a co-prime which was the condition we had in the Chinese remainder theorem. So we have a map from r to r over i times r over j whenever i plus j is equal to r. So this is now onto. Well, we would like this to be an isomorphism. Well, it's not an isomorphism because there are lots of things mapping to zero. So r in r maps to zero if and only if r is in i and it's also in j. And this is also an ideal of r. And so we get a map from r modulo i intersection j to r over i times r over j. So this is now the intersection i j. And again, we notice that mz intersect mnz is equal to mnz if m and n are co-prime. And we see that this map is actually now an isomorphism. So we have an isomorphism whenever i plus j is equal to r. So if we take r to be the integers, we find as a special case of this that z modulo mnz is isomorphic to z over mz times z over nz, which is the usual Chinese remainder theorem. So the Chinese remainder theorem generalizes to much more general rings and ideals. Now let's look at unique factorization. So you know z has unique factorization into primes. And let's just recall the proof. So the main point, we have a division with remainder algorithms. So if we've got a and b, we can write a is equal to qb plus r with r having absolute value less than the absolute value of b. And if we've got this division with remainder algorithm, we can get Euclid's algorithm where we can find the greatest common divisor of a and b. And if we've got greatest common divisor of a and b, we recall that if p is prime and p divides a b, this implies p divides a or p divides b. And this was the main condition we needed in order to show that z has unique factorization. And we're now going to try and generalize these steps to more general rings. So what we want to do is to show that if a ring has some sort of division with remainder algorithm, then it has unique factorization. So we say r is a Euclidean ring. If it has division with remainder. So we want to be able to write if we're given a and b in r, we can write a is equal to b times q plus a remainder with the remainder being less than a. Well, in order for this to make sense, we need some sort of absolute value on r. So this is going to be some function from r to the integers that are greater than or equal to 0. There are other variations of this, but this will do for the moment. And what we want is that we have the absolute value of x is equal to 0 if and only if x is actually equal to 0. And with this condition, you find that we can just copy all the proofs we had for the integers. So first of all, we can show that there's a Euclidean algorithm. So this says that given a and b, we can find some element c with c, a linear combination of a, x and b, y and c divides a and b. And we just copy the usual Euclidean algorithm for the integers. And this implies that if p is prime, and this means p not a unit and not 0, and we're going to say if p equals a, b, this implies a or b is a unit. This is actually not quite the usual definition of a prime in a ring, but never mind. So if p is prime, then p divides a, b implies p divides a or p divides b. And the proof of this is just the same as for the integers. If p does not divide a, then p and a are co-prime because p is prime and it doesn't divide a. So xp plus ya is equal to 1 for some a and b, sorry for some x and y. And if we multiply it by b, we find xpb plus yab is equal to b. And now we notice that both of these are divisible by p, so p divides b. This is divisible by p because a times b is equal to p. And just as before, this rather easily implies that anything can be written as a product of primes. You remember the main point is to show that if we've got primes p1, p2, up to pm, which is equal to q1, q2, up to qn. If all these are primes, then p1 must divide the product of q1 up to qn. So it must divide one of them, say q2. Now, since q2 is also a prime, this means that p1 must be equal to, say, q2. And you can then cross off p1 and q2 and continue pairing off the primes. So a Euclidean ring implies unique factorization in just the same way that it does for the integers. And this is completely useless unless we have several good examples of Euclidean rings. So let's find some examples of Euclidean rings. Well, what I mentioned earlier is you just take the real numbers, polynomials over the real numbers. And this has division with remainder. So every polynomial can be written in an essentially unique way as a product of irreducible polynomials. In fact, over the reals, the irreducible polynomials are all either linear or quadratic. So x squared plus bx plus c, except sometimes these break off as a product of two linear factors. There's another slightly more interesting example of Euclidean ring, which is the so-called Gaussian integers. So the Gaussian integers are all integers of the form m plus ni for mn integers and i the square root of minus 1. So this is a subring of the complex numbers. And we can draw a picture of the Gaussian integers just as a sort of rectangular grid. So if we draw a grid like this, then the Gaussian integers are going to be all these points here, where as usual we denote numbers in the complex plane as ordered pairs. So this is 0. This is 1. And this is i. This is 1 plus i. This is 2 plus i and so on. And we can get the Gaussian integers by taking the ring of polynomials over z and quotient out by the ideal of all multiples of x squared plus 1. So the Gaussian integers are an example of a quotient of rings. And now what we want to do is to show the Gaussian integers Euclidean. So what do we need to show? We need to show that given a and b, we can find that a is equal to q times b plus r, with r is less than b. This is for b, not equal to 0, of course. I think I forgot to say b was non-zero. So what we use is the absolute value. Well, we want the absolute value to be an integer. So we can't take the usual complex absolute value. What we do is we say the absolute value of x plus iy is now going to be x squared plus y squared, which is the square of the distance from the origin. And now we've got to prove this result. So given a and b, we want to write a over b is equal to q plus r over b, where we want this to absolute value less than 1. And what this is saying is the distance between the complex number a over b and the number q is at most 1. So what we do is we take all the points, all the Gaussian integers and draw a little circle of radius 1 about these integers. And now you can see these little disks of radius 1 or cover the complex plane. So if you've got any number q, so any number a over b, say a over b is here, a over b is inside one of these disks. That means there is at least one complex number. So who's such that the unit disk around that point contains q. For instance, in this case, the complex number q would be there. So because these unit disks cover the plane, there is a Euclidean algorithm. And therefore the Gaussian integers also have unique factorization into primes. We're going to see that turning up later on in the course when we look at ways of representing numbers as a sum of two squares. You notice that the absolute value of x plus iy in this notation is just x squared plus y squared. This is the square of the usual complex absolute value. And now we can get the following interesting property by multiplying complex numbers. If we multiply x plus iy times a plus ib, we get this as xa minus yb plus i times ay plus xb. Now the complex numbers of the property that xy is equal to the absolute value of x times the absolute value of y, as you can easily check. Now this means that the absolute value of x plus iy, which is x squared plus y squared, times the absolute value of a plus ib, which is a squared plus b squared, is equal to xa minus yb squared plus ay plus xb squared. And what this says is that if two integers m and n are the sum of two squares, so is their product m times n, because here's a way of writing their product as a sum of two squares. So this is going to be m and this is going to be n. And we'll use this later when investigating which integers are the sums of two squares. In fact, we will also be using the fact that the Gaussian integers form a unique factorization domain. Now, we notice with the integers mod m that the integers modulo p are the special. They have the property that any non-zero element has an inverse. In other words, a, if we've got an element a, which is co-prime to p, this implies ab is congruent to one mod p for sum b. And that follows from Euclid's algorithm, you remember, because we can solve a x plus py is equal to one, and then x is just the inverse of a. And rings in which any non-zero element has an inverse are called fields. So the field is just a ring such that all non-zero elements have an inverse. So let's figure out some examples of fields. So these are fields and these are going to be not fields. So examples of fields are the reals, are complex numbers c, and we've just seen another important example this course is the integers modulo p for p prime. Things that are not fields are things like the integers. So the integer is not a field. Another example is something that is not a field is z over mz for m not prime. By the way, I should say in a field, I've also asked the condition that one is not equal to zero. So the integers modulo one are still not a field. For instance, z modulo six is not a field because two times three is equal to zero. So two and three don't have inverses. Another important example of a field is something that is sometimes a field is Let's take any field k and let's take the ring of polynomials over k and it's quotient out by four multiples of f where f is irreducible. And this is now a field for much the same reason that z over pz is a field. You see, irreducible polynomials are exactly the analogs of prime numbers and the proof that z modulo pz is a field goes over to showing that k of x over f is a field whenever f is irreducible. And of course, the example of this that everybody knows is if you take the reals modulo the irreducible polynomial x squared plus one, this is a field, a field of complex numbers. And if we take kx modulo f where f is not irreducible then this is not a field for much the same reason that z over mz is not a field when m is not a prime. We also notice that if k is any field then k of x has division with the remainder. You can divide any polynomial by another and the remainder is going to be a polynomial of smaller degree unless you're trying to divide by zero in which case you're kind of stupid. So it has unique factorization. We mentioned this earlier when k is the real numbers but in fact k can be any field and this still has unique factorization. In particular, we can talk about primes and irreducible elements in this and we now have analogues of things like can we find all primes in a of x? Well, sometimes we can. We can use the sieve of eratosthenes. So you remember the sieve of eratosthenes for the integers, we write down all the integers. We cross off the zero and the units and then the first one is a prime then we cross off all multiples of it then the next one is prime and we cross off all multiples of that and the next one is prime and so on. And we can sometimes do exactly the same thing to find irreducible polynomials. So let's do an example of this. Let's take the field k to be the field with two elements. So it's just got two elements zero and one. So what we do is instead of writing out all positive integers, we write out all polynomials over this field. So we get zero, one, x, x plus one, squared, x squared plus one, x squared plus x, x squared plus x plus one, x cubed, x cubed plus one, x cubed plus x and so on. This is getting a bit boring and what we do to find out all the irreducible polynomials, we can do exactly what we did before. We cross off the zero and the units and then the first one on our list is a prime or irreducible and now we cross off all multiples of it. So we cross off everything divisible by x and then the next one is going to be another polynomial, another irreducible polynomial and now we cross off all multiples of this. So we notice that x squared plus one is actually equal to x plus one squared. Remember two is equal to zero because we're working over the field with two elements and x cubed plus one is also a multiple of x plus one. So we should, sorry, we should cross that one off, cross that one off as well. And the next one on our list is another irreducible element and then we can then go off crossing, crossing off multiples of this and so on. So the next two primes if you want to continue this a bit further will be x cubed plus x plus one and x cubed plus x squared plus one. And you can go on happily listing primes for as long as your patience holds out, which probably isn't very long because this is kind of boring. So we can do other things with this that we did for the integers. You remember Euclid proved the number of primes is infinite. And the way he did that was he took all the primes he thought of so far. You multiply them together. We add one and we take some prime factor of this and that must be a new prime. And you notice the same proof works for polynomials over the field with two elements. In fact, it works for polynomials over any field. If you found some irreducible polynomials p1 pk, we can multiply them all together, add one to it and take an irreducible polynomial dividing that and that would be a new irreducible polynomial. It can't be equal to any of these because then it would divide one. So the number of irreducible polynomials over any field is always infinite. Actually, if the field is infinite, this is completely trivial because you can just take the polynomials x minus a for a in the field. But if a field is finite like this little field of order two, it's not quite so obvious. So you can use Euclid's proof that they're an infinite number of primes. So next lecture I'll be talking more about properties of fields and their relation to number theory. In particular, I'll be saying more about the finite fields.