 So let's consider the basis of cryptography. An encryption system takes a plain text message P and produces a cipher text message C. Now in order to be useful, the recipient must be able to take the cipher text message C and recover the plain text message P. We can describe cryptography mathematically as follows. We have a function F. The function has domain M, the set of all possible messages. The function has range C, the set of all possible cipher texts, and the function has an inverse, F inverse. And so we can describe the encryption process as our cipher text message is the function applied to the plain text message, and then the decryption process is going to be our plain text message is going to be the inverse applied to the cipher text. And if we put this together, this means that mathematical cryptography is the study of invertible functions. So let's go back to our shift ciphers. So let P be our plain text message. We want to find a function F, so our cipher text message is a function of the plain text message. And with a little bit of thought, we've realized that a shift K cipher can be defined by F of X as congruent to X plus K mod N. And here's the important shift in view point. As soon as we define a cryptographic system in terms of a function, we can be creative, and we can use other functions as well. And so let's consider an important class of functions. So first off, a linear function F of X equals AX plus B is going to be completely defined by the parameters A and B. And so we can consider functions of this type to be the basis for our ciphers. Here we get something called an affine cipher F of X congruent to AX plus B mod N, and here our parameters, our key, will be A and B. So for example, let's take the function 3X plus 7 mod 26, and let's encrypt our message 5, 1, 3, 11. So we want to evaluate our function for each of these numbers. So F of 5 will be 22, F of 1 will be 10, and F of 3 and F of 11 will be 16 and 14. Or let's try another affine cipher, G of X congruent to 13X plus 7 mod 26, and let's try to encrypt 12 to 6, 14. So G of 12 will be 7, G of 2 will be 7, G of 6 will be 7, and G of 14 will be 7. And you might see there's a bit of a problem here. So why did this happen? Let's think about that. If F of P is equal to C, then recovering the plain text requires finding F inverse of C. Now our affine cipher is to find as a linear function of the plain text F of P equals AP plus B mod N. So if we get our cipher text C, we need to solve this congruence for P. And in the course of solving the congruence, we find that we need A inverse. And consequently, we have to limit our definition of an affine cipher. Let N be given an affine cipher as a function F where F of X is congruent to AX plus B mod N, where A inverse mod N exists. I had to teach both to remember that A inverse mod N exists if and only if the greatest common divisor of A and N is equal to 1. So let's take a look at a few affine ciphers and see what we can do with them.