 Welcome back to another screencast about functions. In the last screencast, we looked at three conceptual examples that drive the basic notions of functions. In this screencast, we're going to make all of that formal and introduce a lot of terminology here to make this really robust. So as we do this, let's keep in mind our three conceptual examples and not get too far from the big ideas. So to do this, let's start with two concept checks here that review what we learned in the last video. First of all, which of the following are essential parts of anything that we wish to call a function? Pause the video and come back when you have a choice. So the answer here is going to be D, all of the above. A function, remember, is just basically a process that changes one thing into another thing. So there has to be three items in place for that sort of process to even be valid. First of all, there needs to be a set that contains all the inputs to the process. There has to actually be a process specified to us either as a formula or as a list of directions or as a piece of software. And then finally, there needs to be a set that contains all the outputs. So those three things do need to be in place for any function. Secondly, what else has to be true about functions? So here are some more possibilities here. Pause the video and read those and come back when you have another selection. So the answer here is going to be E, both A and B have to be correct. If I'm going to have a process that I want to consider a function, then any valid input needs to produce something as an output. For example, in the vending machine model, if I walked up to a vending machine and it accepted dollar bills and I had a dollar bill and I put it in and I gave it a valid code and did everything right, and I'm supposed to get some kind of output. A machine that did not give me an output for some valid input would be considered broken and needs to be fixed. Secondly, B is true. Every valid input needs to produce only one output. In the vending machine model, if I put in my dollar bill and a correct code, I should get one candy bar but not two candy bars. So this sort of splitting of an input is not allowed in a functioning function. Now C we're going to see is not true. It is possible to have processes that we want to consider functions where two different inputs do get pushed down to the same output. This is acceptable. This is not acceptable. And we'll see examples of that as we go on. So now we're ready for our main definitions here. This is actually two whole pages of definitions. So keep in mind, again, the basic conceptual ideas that we saw in the last video, they all show up here and think about why and where. So a function from a set A to a set B we're going to define to be a rule that associates with every element x in the set A, exactly one element in the set B. And sometimes we call a function a mapping from A to B. And before we get to the notation there at the bottom, I just want to point out that the five basic items that we reviewed in the concept checks here are all baked into this one sentence here in the definition of function. First of all, the three items that have to be in place are here. We have the set that holds the inputs. And we have the set that holds the outputs. And we have the rule or the process or the directions. So those three things are there. Now notice the two important properties are also here. Every valid input does have an output because it says here in the definition that this rule that defines the function associates with every element of x, every element x of the set A, an element of the set B. So every element gets associated to something. And secondly, the splitting of inputs doesn't take place because it says that the rule associates with every element x of the set A exactly one element in the set B. So there's exactly one output for every valid input. A single valid input won't split into more than one output, in other words. So it's a very economical but quite terse way to define a function, but it's all there. All the five pieces are actually there. Notation-wise, we call our functions by names. For example, if the function is called F, we put this here. And we write F colon A, here's my set of inputs, and then here's my set of outputs in this arrow. Kind of a suggestive of I'm taking things in A and changing them into things that are in B. Now here's another set of definitions before we go on to some examples. Let's suppose we have a function from A to B. The set A is called the domain of my function F. That's the set of all inputs to my function. And we write A equals domain of F. This is basically the same usage of the word domain that you're used to from calculus and algebra. This is the set of all valid inputs to my function. The set B we're going to call the co-domain of F, like a pilot and a co-pilot. We have a domain and a co-domain here. And we write B equals CODOM of F. Now you might have been used to using a different word for this set B here, and we're going to define that a little differently in another slide coming up here. But for now, the set of inputs is the domain. And the set that holds the outputs is called the co-domain. Secondly, if A is an element of capital A, the domain of my function, then the element that gets associated with it, we're going to denote that by F of A. And we're going to call that the image of A under F. And if F of A happens to equal some element B in the set B, then we're going to say A is a pre-image of B under F. So this is looking at elements from two different viewpoints. For images, we think of the viewpoint from the going forward direction, starting with an element in the domain, what does it get changed into? And then from the pre-image point of view, we're starting with an element in the co-domain and asking what did we put into the process to get it. So those are our main definitions. I think it's important now to try some examples here. So let's go back to some things we saw in the first video. So here was an example. The function we took that was rounding up. Remember, we're going to call that just round. And remember what this did was take a real number and round it up to the next higher integer. So first of all, is this really a function? Well, are the sets clearly defined? Yes, I have. Here's my set of inputs and here's my set that holds the output. So yeah, we've got our sets clearly defined. Is the process clearly defined? Yes, I'm going to take X and I'm going to send it to the next higher integer. Yeah, that's a well-defined process. Does every, sorry, the spelling there, does every valid input produce an output? The answer is yes, every real number can be rounded. Even if that real number happens to be an integer, we can still consider it to be rounded just by doing nothing. If you have a single input, does it produce only one output? Very importantly here. And the answer is yes. If I start with a real number and round it, it's not going to ground to two different integers, even if it's like 3.5 and we're rounding up, remember, it's going to round to one thing. The domain of this rounding function, that's the set of all inputs to the function and that would be the set of real numbers. The co-domain of the rounding function is just the set of integers. That's this set here on the receiving end of the arrow. That's the co-domain. Okay, so we have the co-domain and the domain pretty well defined. What is the image of 99.2? When we talk about images, the 99.2 is an input. So its image is to simply what comes out of this process if I put in 99.2 and the answer would be 100. What is a pre-image of 17? I'm going to move over here for that because it's kind of a fairly complicated answer given the example we have here. Pre-image of 17 would be to say, what could I put into the rounding function? I'll just leave that blank to equal 17. So 17 here, when we speak of pre-images, is an output. It's something that's in the co-domain of my function. And I'm asking what could go from the domain into the rounding function to get 17? Now the answer here is there's more than one answer. I could put in 16.8 would work just perfectly well in here, but so would 16.1, and so would 16.9, and a whole bunch of other real numbers could be put into that function to give me 17. So while by the definition of a function any single input will only have one image, that's part of what it means to be a function. Inputs don't split into multiple images. It is possible for a single point in the co-domain to have multiple pre-images, and here's a great example of that, where one, two, three, many, many different inputs get sent to the same output. So here's another example. We also looked at the conceptual model of the G numbers. This is the G number, remember, is an 8-digit ID code that's assigned to all faculty and students at Grand Valley State University. Let's let N, just for shortness here, be the set of all names of GVSU faculty and students. So N is the set of all first and last names of those people. The function that changes names to G numbers, we're going to call that G, and here's the domain, that set of all names, and here's the co-domain, the set of all integers. I made this to be a, this is really just the integer 0, but I made it look like a G number, 8 digits, 0 through 999999. So is G a function? Are the sets and processes clearly defined? Yes, I have the set of all names, I have the set of integers, and the process is certainly clearly defined. I don't know what the algorithm is for assigning names to G numbers, but there's a computer program that does that. Does every valid input produce an output? Yes, every student and faculty member here at GVSU does have a G number. Is it the case that a single input only produces one output? Yes, and that's really important from a practical standpoint, right? Because if I had a student that had two different G numbers, that would be extremely confusing from an administrative standpoint. So a single input only produces one output here. What's the domain of G that will be the set N that we have here? The co-domain of G is the, I won't rewrite it, it's this thing right here, this large set of integers, not all integers of course, there are no such thing as a negative G number or a 20 digit G number, but that set right there. These are just made up names and numbers, but the image of Bob Smith would be whatever his G number is, suppose it might be 01099662 or something like that, that would be his image. The pre-image of this G number would be the student who has that as his or her G number, so maybe Alice Jones would be that pre-image. So I start with something in the co-domain with pre-images and work backwards to the domain. Now in this example, I don't think we would have for this particular function more than one pre-image for the same G number. It's also not the case that two different students would have the same G number. So not only would, in this particular example, inputs wouldn't split, one student wouldn't have multiple G numbers, I don't think it's possible here to have multiple students with the same G number. So this has a little bit extra property that the previous example did not have, and we're going to talk a whole lot more about that in an upcoming section. Now here's a new example here just to make things look a little bit more like mathematics here. So let's define a function f that starts in the real numbers, accepts real numbers as input, that's what this means, and then produces real numbers as output. Now if I just give you this, I haven't really defined the full function here. I have to define the process as well. I've defined the set of inputs, I've defined the set that holds the outputs, but what's the process itself? Well I'm just going to define that to be a quadratic polynomial that f of x equals 4 minus x squared. So this is a process, this is a rule. It says that if I take a number, what I'm going to do, a number from here, to change it, I'm going to run it through this formula here. I'm going to calculate its square and then subtract it from 4. And that's the rule. So what's the domain of f? In this case that's the set of real numbers. What's the co-domain of f? That's also the set of real numbers. We're just looking at these two sets right here. Here's the domain on the front end and here's the co-domain on the back end. What is the image of x equals 10? Now when I talk about images, these are things in the domain. So I start with x equals 10 and I want to see what is its image. So that's f of 10. Well f of 10, the rule tells me that I need to take 4 minus 10 squared. Okay, 4 minus 10 squared, that's 4 minus 100. So the answer is negative 96. And that's the image of 10. Okay, what is the pre-image of 1? So this is asking, what would I put into this function to get the number 1 out of it? Now there could be more than one answer to this. But at least what is a pre-image of 1? Well let's do this up here in the space. Well, I'm looking for an x value here. I'm given the output and I want to work backwards to get the x value here. So I would say, oh, here's 1. And if this is the output at all of this function, then I need to find what the x is. Well, if I solve for x here, I get x squared equals 3. And so x, really there are actually two inputs here, plus and minus square root of 3. So there are two pre-images of that particular number 1, and here they are. Both of those inputs would get sent to 1 as an output. Now finally, what is the pre-image of 5? Well if I tried this trick with the number 5, you get some kind of interesting results here. If I said, okay, well let me set up my formula and try to find 5 equals 4 minus x squared. Is there a number that I can possibly put into this function to give me 5 as an output? Now if I do a little solving here, I get 1 equals negative x squared and I have a problem because 1 cannot equal a negative of a positive number. So this has no solutions. So there is no pre-image of 5. 5 is actually not an output of this function. Some numbers are outputs of this function like 1, but some aren't. So 5 doesn't have a pre-image at all. And that brings up an important point here. I want you to note that not all elements in the co-domain of a function are actually outputs of the function. In that example we just saw the co-domain was a set of all real numbers. That includes things like 1 and negative 5 and plus 5. But 1 could show up as the output of a function. In fact we saw two pre-images of that number, but 5 does not. So that tells me that the co-domain holds the outputs of the function, but there are some things in the co-domain that are not outputs of the function. And so that brings up this next definition here. If f is going from a to b as a function, then the set of all outputs of my function, the set of all f of x values such that x belongs to a, is called the range of f. And we write range f as notation. Now what is this set? This is again just the set of all outputs, all actual outputs of the function. Okay, and that's the range of f. So the difference between range and co-domain is the co-domain is a fairly large set. It's just an area where the outputs happen to come out. But not everything in the co-domain may actually be an output. For example in this quadratic polynomial we just saw the co-domain of the function was the set of all real numbers. But not everything that is a real number is an actual output of this function. For example 5 was not an output of that function. So what's the range? Well I would need to think about what actually can be produced from this function. Well it seems like the highest I could possibly get is 4. And I could go as low as I want. Okay, if I put in x equals 0 then I could get 4 as an output. But anything else I put in is going to be less than 4. So the range of this function here is the half open interval from negative infinity to 4. Or if you like, it's the set of all let's say y values in the real numbers such that y is less than 4 or equal to 4. So there's a big difference between the range and the co-domain of a function. The co-domain is just a set that holds the outputs. But there may be things in the co-domain that are not actually outputs. The set of all things that are actually outputs are what we call the range. So that's a fairly lengthy look at functions and making things nice and rigorous with our definitions. You need to memorize those definitions but also more importantly we need to instantiate those definitions by building examples and non-examples. We're going to do some of that in the next several videos but also make sure you do some of these on your own as we go. So stay tuned and thanks for watching again.