 Welcome back to another example of functions where we're using examples to instantiate the basic definitions around functions. This is gonna be a little more technical of an example, so let's get into it. So I'm gonna define a process that takes in, as it's inputs, natural numbers. These are the positive integers. And then produces outputs that belong to the whole set of integers. Right now I haven't defined a full function for you. I need to specify what the process is. Here's what I want this process P to do. If I take P and evaluate it at a positive integer, I would like to return an integer that is a count of the number of prime numbers. Number of primes that are less than or equal to n. So if I put in an n, I want to go through and just count the number of prime numbers that are less than or equal to n. And return that number as my output here. To get a little ahead of ourselves, let's do an example of what that process would look like. For example, if I put in four as my input. Well, how many primes are there less than or equal to four? Let's just list the numbers that are less than or equal to four. And I see two primes. There's two and there's three. So the result of this process would be two, just the count of the number of primes that I have. So that's the process that I want. So let's ask the six questions that we are asking of all of our processes here. Starting with, is that process really a function? Well, the input set is definitely specified. It's defined, specified to be the set of all natural numbers. So no ambiguity there. Did I tell you what the output set was? Yes, the output set is going to be the set of all integers. Did I tell you the process? Notice that I didn't tell you the process at the beginning. So just specifying the input set and the output set is not enough to give a function. To give a real function, I need to specify the process. And we just did that in words more than anything else. There's not necessarily a formula that tells us how to produce the output. But certainly a set of directions to follow that will produce output. Does every valid input have an output? Yeah, I can go and take any natural number I want and perform this process on it. There's no natural number out there that is excluded from this process. And the kind of important last question here, does every valid input have only one output? And the answer is, or could there possibly be two outputs? The answer there is going to be yes as well, because if I take a natural number and look at the list of numbers that are up to and including that natural number, then there's only going to be one count of all the prime numbers in here. I'm not going to be able to take a natural number and put it into my process and say there are both 12 and 13 prime numbers less than or equal to n. That's just not possible. So this is really a function. I've specified the input set, the output set, and told you what to do in terms of directions and processes. And then every input does have an output and every input has only one output. Now let's examine some particulars about this function now that we'll call it. The domain is really easy to see. We've actually already answered that question. That's the set of all the inputs here. And that would be the set of all natural numbers. The co-domain, and the way that we've specified it, the co-domain is the set of all integers. Now you might be thinking, really the set of all integers? I mean, are we ever going to get, for example, negative one out of this function? We'll see later on the answer is no, but that doesn't change the fact that the way that we have specified this process says that the co-domain is the set of integers. Now, the set of actual outputs of this function could be something far, far smaller than the set of all integers, but that's not the question. The question is, what's specified to be the receiving end of this process? And we said it was the integers, and so that's what the co-domain is. Okay, so we have the co-domain and the domain specified. Now it's probably a good idea to play around with this function a little bit. We've done that already. For example, we found the image of four was two, because how many prime numbers are there, less than or equal to four? That would be two. What about, let's say, six? Well, do a little scratch work over here. If I look at the list of numbers that are less than or equal to six, I see three prime numbers in there, two, three, and five. So the output there is going to be three. That's the number of prime numbers I have. And we could play that all day long with any natural number I choose. So I think that's fairly well understood. Now what about pre-images? So a pre-image of a point in the co-domain, what we do is we pick out an integer, something from the co-domain, and ask, is there something or what could I put into my process to get that integer? For example, let's take the number 10. Okay, that's certainly an integer, so it's in the co-domain. Now what is a pre-image at that point? That would be, again, the question, what could I, if anything, put into this function from the domain to give me 10 as an output? And that's a much harder question to answer. You have to do some trial and error here, and the answer is not unique either. For example, let me just change color here. It turns out that 30, if I put in 30 and count the number of prime numbers less than or equal to 30, I get 10. But it could also put in 29, and that would also give me an output of 10. And there may or may not be more inputs besides. So that number 10 has at least two pre-images, both 30 and 29. It's an example, again, of where I have two different inputs that are getting sent to the same output. That doesn't disqualify it from being a function because I'm not splitting the inputs out. I'm merely showing you that there are potentially two different inputs that get sent to the same output, and that's okay. So a pre-image of the number 10 would be 30, but also 29 would work as well. And you can play this game some more. For example, what's a pre-image of the number 100? Well, you have to really work at that, but it turns out one possible pre-image is the number 545. Okay, so that's pre-image as a point in the co-domain. Notice that not every point in the co-domain has a pre-image. It's real easy to see, for example, pick the number negative two. That's certainly in the co-domain, it's an integer. But since the outputs of this function are counts, things that I count up to, I'm never going to have negative two as an output of this function. It simply won't happen. Okay, so there are a lot of points in the co-domain that do not have any pre-images whatsoever. And that gets us to this final question about what is the set of all actual outputs of this function? Well, you have to play around with this a little bit. And we're seeing that two is an actual output because I plugged in four or evaluated four into that function. Three is an output because we saw that as well. And you can actually go through and find that any integer past two, certainly will have, and there's no ending dot there. Those all, all integers bigger than or equal to two will have outputs of this function, it turns out. Okay, but what about some of the other ones? Well, certainly none of the negative numbers in the co-domain will be actual outputs here. So all these numbers from negative infinity up to zero for sure. I'll leave zero off for a second. None of those occur as actual outputs of my function here. Now what about the number zero? Is there a natural number that has no prime numbers less than or equal to it? In other words, is the number zero a possible output of this function? Well, actually the answer there is yes. I could put in the number one. And the number one has no prime numbers, that's a natural number. So it's a legitimate element of the domain. But there are no prime numbers less than or equal to one. So p of one does equal zero. So I can add zero into the mix here. What about one? Could I ever get one as an actual output? Yeah, I could just put in the number two, for example. And there's exactly one prime number less than or equal to two, that would be two itself. So the set of all actual outputs of this function, if you believe me about the dots here that all integers bigger than or equal to two do occurs outputs, that would mean that the set of all actual outputs, in other words, the range of this function, looks like it would be the set of all natural numbers. And then I will also add on with a union the set consisting of zero. In other words, it's the set of all integers, if you want to write it this way, that are bigger than or equal to zero. That's a much smaller set than the co-domain of this function. But it does seem to hold all the actual outputs of my function. So that's the range. Thanks for watching.