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

Relations and functions

Learn to determine if a relation given by a set of ordered pairs is a function. Created by Sal Khan and Monterey Institute for Technology and Education.

Want to join the conversation?

  • male robot donald style avatar for user Sola Fatade
    I still don't get what a relation is. Can someone help?
    (84 votes)
    Default Khan Academy avatar avatar for user
    • piceratops ultimate style avatar for user Just Keith
      Let me try to express this in a less abstract way than Sal did, then maybe you will get the idea.

      Suppose there is a vending machine, with five buttons labeled 1, 2, 3, 4, 5 (but they don't say what they will give you).
      Scenario 1:
      Suppose that pressing Button 1 always gives you a bottle of water. Pressing 2, always a candy bar. Pressing 3, always Coca-Cola. Pressing 4, always an apple. Pressing 5, always a Pepsi-Cola.

      There is a RELATION here. The buttons 1, 2, 3, 4, 5 are related to the water, candy, Coca-Cola, apple, or Pepsi.

      Scenario 2: Same vending machine, same button, same five products dispensed. However, when you press button 3, you sometimes get a Coca-Cola and sometimes get a Pepsi-cola. Otherwise, everything is the same as in Scenario 1.

      There is still a RELATION here, the pushing of the five buttons will give you the five products. The five buttons still have a RELATION to the five products.

      While both scenarios describe a RELATION, the second scenario is not reliable -- one of the buttons is inconsistent about what you get.

      So, we call a RELATION that is always consistent (you know what you will get when you push the button) a FUNCTION. But, if the RELATION is not consistent (there is inconsistency in what you get when you push some buttons) then we do not call it a FUNCTION.

      Of course, in algebra you would typically be dealing with numbers, not snacks. But the concept remains.
      (573 votes)
  • blobby green style avatar for user Noélle Brown
    If you have:
    Domain: {2, 4, -2, -4}
    Range: {-3, 4, 2}

    But for the -4 the range is -3 so i did not put that in .... so will it will not be a function because -4 will have to pair up with -3.
    (54 votes)
    Default Khan Academy avatar avatar for user
  • blobby green style avatar for user Danni
    does the domain represent the x axis? You wrote the domain number first in the ordered pair at :52. I just wanted to ask because one of my teachers told me that the range was the x axis, and this has really confused me.
    (14 votes)
    Default Khan Academy avatar avatar for user
    • old spice man green style avatar for user jmascaro
      Hi,
      The domain is the set of numbers that can be put into a function, and the range is the set of values that come out of the function. So on a standard coordinate grid, the x values are the domain, and the y values are the range.

      The way I remember it is that the word "domain" contains the word "in". Therefore, the domain of a function is all of the values that can go into that function (x values).

      Hope that helps :-)
      (37 votes)
  • aqualine tree style avatar for user 张瑞文
    Hi, this isn't a homework question. I just found this on another website because I'm trying to search for function practice questions. Anyways, why is this a function:

    {(2,3), (3,4), (5,1), (6,2), (7,3)}

    if 2 and 7 in the domain both go into 3 in the range.
    (8 votes)
    Default Khan Academy avatar avatar for user
    • aqualine ultimate style avatar for user J Choi
      To be a function, one particular x-value must yield only one y-value. In this case, this is a function because the same x-value isn't outputting two different y-values, and it is possible for two domain values in a function to have the same y-value. If you graph the points, you get something that looks like a tilted N, but if you do the vertical line test, it proves it is a function.
      (21 votes)
  • winston baby style avatar for user A Rev that trolls
    Ah yes, this animal called "The Student" is absorbing knowledge as you see here. The Student is always on the prowl alone, and yawns almost twice a minute.
    (15 votes)
    Default Khan Academy avatar avatar for user
  • blobby green style avatar for user John Francis Portocarrero
    so if there is the same input anywhere it cant be a function?
    (6 votes)
    Default Khan Academy avatar avatar for user
  • blobby green style avatar for user matthewaspro
    I have a question. How do I factor 1-x²+6x-9
    The answer is (4-x)(x-2)
    (6 votes)
    Default Khan Academy avatar avatar for user
    • male robot hal style avatar for user Andrew M
      Why don't you try to work backward from the answer to see how it works. The way you multiply those things in the parentheses is to use the rule FOIL - First, Outside, Inside, Last

      First: 4*x
      Outside: 4*-2=-8
      Inside: -x*x = -x^2
      Last: -2*-x =+2x

      Now add them up: 4x - 8 -x^2 +2x = 6x -8 -x^2. If you rearrange things, you will see that this is the same as the equation you posted.

      Now your trick in learning to factor is to figure out how to do this process in the other direction. It usually helps if you simplify your equation as much as possible first, and write it in the order ax^2 + bx + c.

      So you have -x^2 + 6x -8

      Now make two sets of parentheses, and figure out what to put in there so that when you FOIL it, it will come out to this equation. I will get you started: the only way to get -x^2 to come out of FOIL is to have one factor be x and the other be -x. So here's what you have to start with:

      (x + ?)(-x+?) = -x^2 + 6x -8.

      Now you figure out what has to go in place of the question marks so that when you multiply it out using FOIL, it comes out the right way.
      (7 votes)
  • female robot grace style avatar for user Eliza Duncan
    Can the domain be expressed twice in a relation?
    (3 votes)
    Default Khan Academy avatar avatar for user
    • male robot hal style avatar for user Sheridan Teasel
      Hi Eliza,
      We may need to tighten up the definitions to answer your question. The domain is the collection of all possible values that the "output" can be - i.e. the domain is the fuzzy cloud thing that Sal draws and mentions about https://youtu.be/Uz0MtFlLD-k?t=150 . So there is only one domain for a given relation over a given range.

      But I think your question is really "can the same value appear twice in a domain"? If so the answer is really no. At the start of the video Sal maps two different "inputs" to the same "output". The output value only occurs once in the collection of all possible outputs but two (or more) inputs could map to that output.

      I hope that helps and makes sense. Please vote if so.

      Best regards,
      ST
      (5 votes)
  • marcimus pink style avatar for user Andrew Maysick
    In other words, the range can never be larger than the domain and still be a function? If the range has 5 elements and the domain only 4 then it would imply that there is no one-to-one correspondence between the two. Is this a practical assumption?
    (2 votes)
    Default Khan Academy avatar avatar for user
  • male robot johnny style avatar for user Waleed Sharkawy
    If the f(x)=2x+1 and the input is 1 how it gives me two outputs it supposes to be 3 only ? can you give me an example, please? :D
    (3 votes)
    Default Khan Academy avatar avatar for user

Video transcript

Is the relation given by the set of ordered pairs shown below a function? So before we even attempt to do this problem, right here, let's just remind ourselves what a relation is and what type of relations can be functions. So in a relation, you have a set of numbers that you can kind of view as the input into the relation. We call that the domain. You can view them as the set of numbers over which that relation is defined. And then you have a set of numbers that you can view as the output of the relation, or what the numbers that can be associated with anything in domain, and we call that the range. And it's a fairly straightforward idea. So for example, let's say that the number 1 is in the domain, and that we associate the number 1 with the number 2 in the range. So in this type of notation, you would say that the relation has 1 comma 2 in its set of ordered pairs. These are two ways of saying the same thing. Now the relation can also say, hey, maybe if I have 2, maybe that is associated with 2 as well. So 2 is also associated with the number 2. And so notice, I'm just building a bunch of associations. I've visually drawn them over here. Here I'm just doing them as ordered pairs. We could say that we have the number 3. 3 is in our domain. Our relation is defined for number 3, and 3 is associated with, let's say, negative 7. So this is 3 and negative 7. Now this type of relation right over here, where if you give me any member of the domain, and I'm able to tell you exactly which member of the range is associated with it, this is also referred to as a function. And in a few seconds, I'll show you a relation that is not a function. Because over here, you pick any member of the domain, and the function really is just a relation. It's really just an association, sometimes called a mapping between members of the domain and particular members of the range. So you give me any member of the domain, I'll tell you exactly which member of the range it maps to. You give me 1, I say, hey, it definitely maps it to 2. You give me 2, it definitely maps to 2 as well. You give me 3, it's definitely associated with negative 7 as well. So this relation is both a-- it's obviously a relation-- but it is also a function. Now to show you a relation that is not a function, imagine something like this. So once again, I'll draw a domain over here, and I do this big, fuzzy cloud-looking thing to show you that I'm not showing you all of the things in the domain. I'm just picking specific examples. And let's say that this big, fuzzy cloud-looking thing is the range. And let's say in this relation-- and I'll build it the same way that we built it over here-- let's say in this relation, 1 is associated with 2. So let's build the set of ordered pairs. So 1 is associated with 2. Let's say that 2 is associated with, let's say that 2 is associated with negative 3. So you'd have 2, negative 3 over there. And let's say on top of that, we also associate, we also associate 1 with the number 4. So we also created an association with 1 with the number 4. So we have the ordered pair 1 comma 4. Now this is a relationship. We have, it's defined for a certain-- if this was a whole relationship, then the entire domain is just the numbers 1, 2-- actually just the numbers 1 and 2. It's definitely a relation, but this is no longer a function. And the reason why it's no longer a function is, if you tell me, OK I'm giving you 1 in the domain, what member of the range is 1 associated with? Over here, you say, well I don't know, is 1 associated with 2, or is it associated with 4? It could be either one. So you don't have a clear association. If I give you 1 here, you're like, I don't know, do I hand you a 2 or 4? That's not what a function does. A function says, oh, if you give me a 1, I know I'm giving you a 2. If you give me 2, I know I'm giving you 2. Now with that out of the way, let's actually try to tackle the problem right over here. So let's think about its domain, and let's think about its range. So the domain here, the possible, you can view them as x values or inputs, into this thing that could be a function, that's definitely a relation, you could have a negative 3. You could have a negative 2. You could have a 0. You could have a, well, we already listed a negative 2, so that's right over there. Or you could have a positive 3. Those are the possible values that this relation is defined for, that you could input into this relation and figure out what it outputs. Now the range here, these are the possible outputs or the numbers that are associated with the numbers in the domain. The range includes 2, 4, 5, 2, 4, 5, 6, 6, and 8. 2, 4, 5, 6, and 8. I could have drawn this with a big cloud like this, and I could have done this with a cloud like this, but here we're showing the exact numbers in the domain and the range. And now let's draw the actual associations. So negative 3 is associated with 2, or it's mapped to 2. So negative 3 maps to 2 based on this ordered pair right over there. Then we have negative 2 is associated with 4. So negative 2 is associated with 4 based on this ordered pair right over there. Actually that first ordered pair, let me-- that first ordered pair, I don't want to get you confused. It should just be this ordered pair right over here. Negative 3 is associated with 2. Then we have negative 2-- we'll do that in a different color-- we have negative 2 is associated with 4. Negative 2 is associated with 4. We have 0 is associated with 5. 0 is associated with 5. Or sometimes people say, it's mapped to 5. We have negative 2 is mapped to 6. Now this is interesting. Negative 2 is already mapped to something. Now this ordered pair is saying it's also mapped to 6. And then finally-- I'll do this in a color that I haven't used yet, although I've used almost all of them-- we have 3 is mapped to 8. 3 is mapped to 8. So the question here, is this a function? And for it to be a function for any member of the domain, you have to know what it's going to map to. It can only map to one member of the range. So negative 3, if you put negative 3 as the input into the function, you know it's going to output 2. If you put negative 2 into the input of the function, all of a sudden you get confused. Do I output 4, or do I output 6? So you don't know if you output 4 or you output 6. And because there's this confusion, this is not a function. You have a member of the domain that maps to multiple members of the range. So this right over here is not a function, not a function.