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

Intro to inverse functions

Sal explains what inverse functions are. Then he explains how to algebraically find the inverse of a function and looks at the graphical relationship between inverse functions. Created by Sal Khan.

Want to join the conversation?

  • male robot hal style avatar for user Ruchin
    Is the inverse of y=4 x=4? If so then are horizontal and vertical lines the only lines that are perpendicular to there inverses?
    (77 votes)
    Default Khan Academy avatar avatar for user
    • starky ultimate style avatar for user whitsona
      I love this question-- because testing the boundaries of new concepts is so important to advancing mathematics.First, we must come to grips with the idea that not every function has an inverse. Only functions with "one-to-one" mapping have inverses.The function y=4 maps infinity to 4. It is a great example of not a one-to-one mapping. Thus, it has no inverse. There is no magic box that inverts y=4 such that we can give it a 4 and get out one and only one value for x.
      (142 votes)
  • old spice man green style avatar for user Justin Lee
    Why do we rename Y to X?
    (19 votes)
    Default Khan Academy avatar avatar for user
    • male robot donald style avatar for user Jeremy
      Justin,

      If you are trying to invert a function, one way to do it is to switch the positions of all of the variables, and resolve the function for y. The intuition works like this:

      We sometimes think about functions as an input and an output. For example, we take a value, called x, and that is what we put into the function. Then the function does some "stuff" and we get out a value called y. So, for some function f, X goes in, and Y comes out. If we think about it that way, then for the inverse of the f function (call it 'g', maybe), we should be able put IN the values that came OUT of function f as our y's, and get the same x values we put IN to f to get the y's originally.

      But that is kind of like we switched the x's and y's in our f function…. and that's exactly how you solve for the inverse function, g. You take the original function, switch all of the y's for x's and the x's for y's, and then you resolve it for y.

      For example: if our original function f is y=2x-5, then we would switch the y's and x's to get x=2y-5. If we solve for y, we get y=(x+5)/2. That's function 'g'.

      Now let's try it out. We put in an x=0, 1, and 2 in function f, and we get, -5,
      -3, and -1 as the corresponding y's (try it yourself). Now we take those y's and we make them our x values (or inputs) into function g and we should get our original 0, 1, and 2.
      y=(-5+5)/2 =0
      y=(-3+5)/2= 1
      y=(-1+5)/2=2

      It worked. The x's (or inputs) for our first function produce y's (outputs) from our first function. We can take those y's (outputs from our first function) and make those the x's (or inputs) of our inverse function, and we get the original inputs we started with.
      (47 votes)
  • old spice man green style avatar for user Philipp
    i don't quite get the thing Sal does at . He is talking about y being equal to x, and then draws a dotted line in the middle. is there maybe a video that clarifies this relation?
    (30 votes)
    Default Khan Academy avatar avatar for user
    • old spice man green style avatar for user Philipp
      ah, ok I get it now. y=x has nothing to do with the functions itself, it is just a line with an inclination on 1 and a y intercept of 0 along which the 2 functions (or, for that matter, any function and its inverse i presume) are reflected. thanks very much
      (5 votes)
  • blobby green style avatar for user TokenArcanum
    At around , Sal labels the function 1/2y-2 as an inverse function, deemed f-1(y).

    I am not sure, but I think this is incorrect? F-1(x) should equal 1/2y-2, not F-1(y), right? F(y) is just a function, not an inverse. However, the inverse of x is equal to the y function.

    I hope I wasn't too confusing, but it would be appreciated if this got cleared up! :) thanks
    (17 votes)
    Default Khan Academy avatar avatar for user
    • blobby green style avatar for user jbandlow
      f(x)= 2x +4 .... f^-1(x)=(x/2)-2 .... f^-1[f(x)]=(2x+4)/2 -2 = x .(identity)
      f(y)=(y/2)-2.... f^-1(y)= 2y+4.... f^-1[f(y)]=2(y/2 -2)+4 = y .(identity)
      Check plot at to see that these are symmetric across X=Y. ..Venn rings can mislead.
      (12 votes)
  • duskpin tree style avatar for user Dee Patel
    as to solve for x, for inverse, why can't we just switch the x and y in the same equation..?
    (8 votes)
    Default Khan Academy avatar avatar for user
    • leafers ultimate style avatar for user GFauxPas
      That's not a wrong way to think of it, but as you learn more complicated functions, it becomes harder to do so.
      2^x = y
      x = ?
      You're not wrong though. If you learned about logarithms, maybe this will give you insight as to why people had to invent logarithms!
      (12 votes)
  • mr pants teal style avatar for user Deesha Shah
    Does this solely apply to lines?
    (8 votes)
    Default Khan Academy avatar avatar for user
    • leaf red style avatar for user Age of Caffeine
      No, all strictly growing or strictly decreasing functions have an inverse.

      If it is not strictly growing/decreasing, there will be values of f(x) where
      f(x) = f(y), x not equal to y.

      So, its inverse g would have two values for f(x), as g( f(x) ) = x AND y, which is not possible for a function.

      An example of this is x^2. It's inverse would be g(x) = +sqrt( x ) AND -sqrt( x ), which is not possible.

      However, functions such as f( x ) = x^3, or f( x ) = e^x, which are strictly growing, do have an inverse : )
      (10 votes)
  • leafers ultimate style avatar for user GFauxPas
    Starting at Sal draws another set as the range. Why is Sal drawing a second set next to the first one if the domain and the range are the same set, the set of real numbers? Shouldn't he draw one "blob" such that the function maps from elements in that set to other elements in that set?
    (7 votes)
    Default Khan Academy avatar avatar for user
    • blobby green style avatar for user Maryamklabib
      No, because the domain is the numbers on x that can go in and the range is the numbers on y that can be a result of this function. So they could both be all real numbers but they could be different. In a square root function for example, the domain would be all positive numbers only.
      (12 votes)
  • aqualine ultimate style avatar for user theo papazekos
    Can a function be the inverse of itself?
    What are some examples?
    (8 votes)
    Default Khan Academy avatar avatar for user
  • winston default style avatar for user felix.erlandson
    There are actually other ways you can write an inverse function! Take this example:

    f(x) = 2x + 4
    f(x)^-1 = (x-4)/2
    (4 votes)
    Default Khan Academy avatar avatar for user
  • mr pink red style avatar for user FluffyQ
    Is there any significance in the point that the two functions intersect?
    (4 votes)
    Default Khan Academy avatar avatar for user

Video transcript

Let's think about what functions really do, and then we'll think about the idea of an inverse of a function. So let's start with a pretty straightforward function. Let's say f of x is equal to 2x plus 4. And so if I take f of 2, f of 2 is going to be equal to 2 times 2 plus 4, which is 4 plus 4, which is 8. I could take f of 3, which is 2 times 3 plus 4, which is equal to 10. 6 plus 4. So let's think about it in a little bit more of an abstract sense. So there's a set of things that I can input into this function. You might already be familiar with that notion. It's the domain. The set of all of the things that I can input into that function, that is the domain. And in that domain, 2 is sitting there, you have 3 over there, pretty much you could input any real number into this function. So this is going to be all real, but we're making it a nice contained set here just to help you visualize it. Now, when you apply the function, let's think about it means to take f of 2. We're inputting a number, 2, and then the function is outputting the number 8. It is mapping us from 2 to 8. So let's make another set here of all of the possible values that my function can take on. And we can call that the range. There are more formal ways to talk about this, and there's a much more rigorous discussion of this later on, especially in the linear algebra playlist, but this is all the different values I can take on. So if I take the number 2 from our domain, I input it into the function, we're getting mapped to the number 8. So let's let me draw that out. So we're going from 2 to the number 8 right there. And it's being done by the function. The function is doing that mapping. That function is mapping us from 2 to 8. This right here, that is equal to f of 2. Same idea. You start with 3, 3 is being mapped by the function to 10. It's creating an association. The function is mapping us from 3 to 10. Now, this raises an interesting question. Is there a way to get back from 8 to the 2, or is there a way to go back from the 10 to the 3? Or is there some other function? Is there some other function, we can call that the inverse of f, that'll take us back? Is there some other function that'll take us from 10 back to 3? We'll call that the inverse of f, and we'll use that as notation, and it'll take us back from 10 to 3. Is there a way to do that? Will that same inverse of f, will it take us back from-- if we apply 8 to it-- will that take us back to 2? Now, all this seems very abstract and difficult. What you'll find is it's actually very easy to solve for this inverse of f, and I think once we solve for it, it'll make it clear what I'm talking about. That the function takes you from 2 to 8, the inverse will take us back from 8 to 2. So to think about that, let's just define-- let's just say y is equal to f of x. So y is equal to f of x, is equal to 2x plus 4. So I can write just y is equal to 2x plus 4, and this once again, this is our function. You give me an x, it'll give me a y. But we want to go the other way around. We want to give you a y and get an x. So all we have to do is solve for x in terms of y. So let's do that. If we subtract 4 from both sides of this equation-- let me switch colors-- if we subtract 4 from both sides of this equation, we get y minus 4 is equal to 2x, and then if we divide both sides of this equation by 2, we get y over 2 minus 2-- 4 divided by 2 is 2-- is equal to x. Or if we just want to write it that way, we can just swap the sides, we get x is equal to 1/2y-- same thing as y over 2-- minus 2. So what we have here is a function of y that gives us an x, which is exactly what we wanted. We want a function of these values that map back to an x. So we can call this-- we could say that this is equal to-- I'll do it in the same color-- this is equal to f inverse as a function of y. Or let me just write it a little bit cleaner. We could say f inverse as a function of y-- so we can have 10 or 8-- so now the range is now the domain for f inverse. f inverse as a function of y is equal to 1/2y minus 2. So all we did is we started with our original function, y is equal to 2x plus 4, we solved for-- over here, we've solved for y in terms of x-- then we just do a little bit of algebra, solve for x in terms of y, and we say that that is our inverse as a function of y. Which is right over here. And then, if we, you know, you can say this is-- you could replace the y with an a, a b, an x, whatever you want to do, so then we can just rename the y as x. So if you put an x into this function, you would get f inverse of x is equal to 1/2x minus 2. So all you do, you solve for x, and then you swap the y and the x, if you want to do it that way. That's the easiest way to think about it. And one thing I want to point out is what happens when you graph the function and the inverse. So let me just do a little quick and dirty graph right here. And then I'll do a bunch of examples of actually solving for inverses, but I really just wanted to give you the general idea. Function takes you from the domain to the range, the inverse will take you from that point back to the original value, if it exists. So if I were to graph these-- just let me draw a little coordinate axis right here, draw a little bit of a coordinate axis right there. This first function, 2x plus 4, its y intercept is going to be 1, 2, 3, 4, just like that, and then its slope will look like this. It has a slope of 2, so it will look something like-- its graph will look-- let me make it a little bit neater than that-- it'll look something like that. That's what that function looks like. What does this function look like? What does the inverse function look like, as a function of x? Remember we solved for x, and then we swapped the x and the y, essentially. We could say now that y is equal to f inverse of x. So we have a y-intercept of negative 2, 1, 2, and now the slope is 1/2. The slope looks like this. Let me see if I can draw it. The slope looks-- or the line looks something like that. And what's the relationship here? I mean, you know, these look kind of related, it looks like they're reflected about something. It'll be a little bit more clear what they're reflected about if we draw the line y is equal to x. So the line y equals x looks like that. I'll do it as a dotted line. And you could see, you have the function and its inverse, they're reflected about the line y is equal to x. And hopefully, that makes sense here. Because over here, on this line, let's take an easy example. Our function, when you take 0-- so f of 0 is equal to 4. Our function is mapping 0 to 4. The inverse function, if you take f inverse of 4, f inverse of 4 is equal to 0. Or the inverse function is mapping us from 4 to 0. Which is exactly what we expected. The function takes us from the x to the y world, and then we swap it, we were swapping the x and the y. We would take the inverse. And that's why it's reflected around y equals x. So this example that I just showed you right here, function takes you from 0 to 4-- maybe I should do that in the function color-- so the function takes you from 0 to 4, that's the function f of 0 is 4, you see that right there, so it goes from 0 to 4, and then the inverse takes us back from 4 to 0. So f inverse takes us back from 4 to 0. You saw that right there. When you evaluate 4 here, 1/2 times 4 minus 2 is 0. The next couple of videos we'll do a bunch of examples so you really understand how to solve these and are able to do the exercises on our application for this.