If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

Main content

# A more formal understanding of functions

## Video transcript

I think you've been exposed to the idea of a function at some point in your mathematical career but what I want to do in this video is explain it a little bit more formally than you might be used to and then relate it to all some of the concepts of vectors and linear algebra that we've seen so far so a function literally is so I'll write it like this a function really is just a relation between the members of one set and the members of the other set so let's say I have some set X and for every set X I'm going to relate or associate what's R with for every member of that set X I'm going to relate that member to or associate that member with another member of a set why it was set Y so if I imagine that that that is my set X and that this is my set Y right there and Y doesn't have to be smaller that's just the way I drew it the function is just a relation that if I just take a member of my set X so if I just take a member of it let's say that's the member that I'm taking it we're visualizing is at a point this function will say ok you gave me a member of X then I will give you a member of Y associated with that member of X so the function will say you give me that then I will map it I will map it to that member right there I'll use the word map it and that's really just means relating it to or associating with another member of Y and if you give me some other point right here I'll relate it to another member of Y I'll relate it to another member of Y right there I might even relate it to the same member of Y and so this notation just says this is a mapping from one set X and I'm speaking in very general terms to another set Y and so you're probably saying hey Sal you know this is very abstract how does this relate to the functions that I've seen in the past well let me let me just write down a function you've probably seen a lot in the past you've seen people write or you've dealt with f of X is equal to x squared how would we write this in this notation well this is a function assuming that it's kind of the traditional way that you see it this function and actually let me well let me just write with the F I was going to write it with the G of X to see that this doesn't always have to be in 1/2 but I think you get you get that idea in this case F is a mapping from real numbers right the real numbers are everything that I can put in here and actually this is part of the function definition I could constrain this to just be integers or just be even numbers or just be even integers but this is part of the function definition I'm defining the function to be a mapping from real numbers I'm saying you can put any real number here and it's going to map it's going to map to well it's going to map to real numbers so in this case if X is real numbers it's going to map to itself which is completely legitimate so if this is the real numbers and obviously the real numbers would go off in every direction forever but if this is the real numbers this function mapping is just taking every point with F and mapping it to another point or every point in R and mapping it to another point in R it's taking every point and associating with it it's perfect square and I want to make a very subtle notation what or at least in my mind the first time that I got exposed to functions I was thinking you give me an X and I square it and I'm giving you the square of X and that's true you are doing that but at least the way my brain worked I kind of thought it of is I was changing my X into another number and you can maybe view it that way and that might actually be the best way to view it but it the the mathematically the mathematical definition I'm introducing here is more that I'm associating I'm associating X I'm associating X with x squared and this is actually another way this is another function notation of writing this exact same thing these two statements right here this statement and this statement are identical this statement you've probably never seen before but I I kind of like it because it kind of shows the mapping or the Association more while this Association I kind of think that look you're putting you're putting an X into a little you know meat grinder or some machine that's going to turn that's going to ground up the X or square the X or do whatever it needs to do the X this notation to me implies the mapping you give me an X and then I'm going to associate another number in real numbers called x squared so it's going to be just another point and just as a little bit of of terminology and I think you've seen this terminology before the set that you are mapping from is called the domain and it's part of the function definition I is a function Creator have to tell you that look where every valid input here it has to be a set of real numbers now the set that I'm mapping to the set that I'm mapping to this is called the codomain co domain which is and and i guess the the obvious question that you're probably asking is hey Sal when I learned all of this function stuff in in in algebra 2 or whenever you first learn it you're like where did you know we never use this code domain word and actually I don't think it has a hyphen in it but we never use that code domain word we have this idea of range you know I learned the word range when I was in 9th or 10th grade how does this Co domain relate to range and this is it's a very subtle notation so the co domain is a set that you're mapping to in this example this is the co domain Co domain in this example the real numbers are the domain and the Co domain so the question is how does the range relate to this so the co domain is this is the set that can be possibly mapped to you're not necessarily mapping to every point in the co domain I'm just saying that this function is generally mapping from members of this set to that set the range the range is the subset let me write it this way it could be equal to the co domain it's some subset a set is a subset of itself every member of a set is also a member of its of itself so it's a it's a subset of itself so range is a subset of the codomain keep adding a - there or - is a subset of the codomain which the function actually maps to that the function actually maps to actually maps to maps too so let me give you an example let's say I define the function let's say I define the function G and it is a mapping from the set of real numbers well let me say it's a set it's a mapping from R 2 to R so I'm essentially taking two tuples and I'm mapping it to R and I will define I define G I'll write it a couple of different ways I could write so now I'm going to take G of let's say two values so I could say X Y or I could say x1 x2 let me do it that way G of x1 x2 is equal to well let's say it's always equal to 2 it just always equals to 2 it's a mapping from R 2 to R but this just always equals 2 so what is our and I'm actually let me write it the other notation just because you probably haven't seen this much but I could write G of G maps any points x1 and x2 to the point 2 this is kind of this makes the mapping a little bit clearer but just to get the notation right what is our domain what is our domain what's the real numbers that was part of my function definition I said we're mapping from the from R to so my domain is r2 and I should actually make that with that little line there now what is my co domain my co domain well my co domain is the set that I am potentially mapping to and it's part of the function definition this by definition is the co domain so my co domain is our now what is the range of my function what is the range the range is our is the set of values that the function actually maps to in this case we always map to the value 2 so the range is actually just the value 2 and if we were to visualize this you know R 2 is actually you know I would draw it as a blurb I would draw it as the entire Cartesian space but I'm just giving you kind of an abstract notion that's r2 if I really have to draw are I draw it as some type of a number line actually let me do it that way just for fun you don't normally see it written that way but I could just draw our like that's r2 and I could just draw our is some straight line so this is the set R I could draw it like that as well but let's just say it's a set R and my function G Maps essentially Maps any point over here to exactly the point - right - is just one little point nard it my function G takes any any point in r2 any coordinate X you know this is some point you know this could be the point three minus five whatever it is and it Maps it it always Maps it to the point two n R so if I take that point it Maps it to the point two that's what G always does so G so G's codomain you could say it's all over the real numbers but it's range is really just two now if I write the example if i if i say that let me do another example that might be interesting if I just write H is a function that goes from let's just say it goes from r2 to r3 and I'll be a little careful here H is goes from r2 to r3 and I'll write and I'll write here that H of X 1 X 2 is equal to so now I'm mapping I'm going to a higher dimension space so I'm going to say that that is going to be equal to let's say my first coordinate I could say in r3 or my first component at r3 is x1 plus x2 let's say my second coordinate is x2 minus x1 and let's say my third coordinate is X 2 times x1 now what is what is my domain and my range and my co domain so my domain by definition my domain by definition is this right there my codomain by definition is r3 and notice I'm going from a space that has two dimensions to a space that has three dimensions or three components but I can always associate some point within x1 x2 with some point in my r3 there and now a slightly trickier question here is what is the range can I always can I always associate every point every point maybe this wasn't the best example because it's not simple enough but can I associate every point in r3 is every point in r3 so this is my codomain my domain was r2 now and my function goes from r2 to r3 so that's H and so my range as you could see there's not it's not like every coordinate you can express as in this way in some way let me give you an example for example it's clearly the term I mean I could put some X 1 s and X 2's here and and figure it out let's do that let's take our H of let me use my other let me use my other notation let's say that I said H and I wanted to find the mapping from the point in r2 let's say the point 2 comma 3 and then my function tells me that this will map to the point in R 3 this will map to the I add the two term so 2 plus 3 so it's 5 I find the difference between X 2 and X 1 so 3 minus 2 is 1 and then I multiply the 2 6 so clearly this will be in the range this is a member of the range I shouldn't write like that I should write like this the member of the range so for example the point 2 3 which might be right there will be mapped to the three dimensional point it's kind of just drawn as a two dimensional blurb right there but I think you get the idea would be mapped to the three dimensional point 5 1 6 so this is definitely a member of the range now my question to you if I have some point in our 3 let's say I have the point a different color let me see I have the point there let's say that this is the point let's just this the point five one five one zero five one zero is this is this point a member of the range it's definitely a member of the codomain it's in r3 it's definitely in here and this by definition is the codomain but is this in our range well if I take this has five has to be the sum of two numbers the one has to be the difference of two numbers and then the zero would have to be the product of two numbers and clearly we know five is the sum and one is the difference we're dealing with two and three there's no way that you can get the product of those numbers to be equal to zero so this guy is not not in not in the range so the range would be the subset of all of these points in r3 so there'd be a ton of points that aren't in the range and there'll be a smaller subset of our three that is in the range now I want to introduce you to one more kind of one more piece of terminology when it comes to functions these functions up here this function that mapped from points in R 2 to R so it mapped its codomain was R this function up here that is probably the most common function you see in mathematics this is also mapping to are these these functions that map to are called scalar value or real Vow depending on how you want to think about it but if they map to kind of a one-dimensional space we call them a scalar valued function or a real valued function so scalar valued or maybe we could call it a real valued function real valued function which is pretty much all of the functions that you've probably dealt with up to this point in your in your mathematical career unless you've kind of taken some some vector calculus or whatever not now the functions that map to that map to subs that map to spaces or subspaces that have more than one dimension so if your map to R or any subset of R you have a real valued function or a scalar valued function if you map to you know RN where n is greater than 1 so if you map to R 2 R 3 R 4 R 100 you're then dealing with a vector-valued function so this last function that I define over here H is a vector valued vector valued function anyway I think you now have at least the the the mathematical notation to land what I'm going to do then the rest of this playlist and then hopefully you found this reasonably useful