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

Finding composite functions

Given that f(x)=√(x²-1) and g(x)=x/(1+x), Sal finds f(g(x)) and g(f(x)). Created by Sal Khan.

Want to join the conversation?

  • female robot grace style avatar for user mnmariogirl
    Would one be able to define the new function as its own function.
    For example, the new f(g(x)) would simply be h(x) instead?
    (26 votes)
    Default Khan Academy avatar avatar for user
  • duskpin ultimate style avatar for user Kaylah
    How do you find a composite function when one is missing for example if the question is "if g(x) = 2x and f(g(x))=3/x, what is f(x)?"
    (11 votes)
    Default Khan Academy avatar avatar for user
  • blobby green style avatar for user Chase Mulholland
    I am lost, bad at math and give up oof oof ooof oooof I try but I suck :((((
    (8 votes)
    Default Khan Academy avatar avatar for user
  • male robot hal style avatar for user Mirghani
    couldn't sal simplify the answer in ?
    (5 votes)
    Default Khan Academy avatar avatar for user
    • blobby green style avatar for user Aiena
      Hi Mirghani,

      You can simplify the expression, but it will still be a hairy expression.

      Let's see how it turns out-
      f(g(x)) = sqrt (x/x+1)^2 - 1
      = sqrt x^2/(x+1)^2 - 1
      = sqrt x^2/(x+1)^2 - (x+1)^2/ (x+1)^2
      = sqrt x^2 - (x+1)^2/ (x+1)^2
      = sqrt x^2 - (x^2 +2x + 1)/ x^2 +2x + 1
      = sqrt x^2 - x^2 -2x - 1 / x^2 +2x + 1
      = sqrt -2x -1/ x^2 + 2x +1

      You can see that it is still is a hairy number and will not help us much if we factored and simplified it.

      I hope that this helps.

      Aiena.
      (14 votes)
  • male robot hal style avatar for user Araa$h
    At around the mark, isn't your answer not simplified enough? The three basic rules of simplifying a radical state that the radicand must not have any perfect square factors, there can't be a radical in the denominator of a fraction, and the radicand can't be a fraction. So, to simplify Sal's answer further we would do sqrt((x^2-1)/(1+sqrt(x^2-1)))*(((1-sqrt(x^2-1))/(1-sqrt(x^2-1))). Therefore, we would get (x^2-1-sqrt(x^2-1))/x^2.

    Please reply if I have any mistakes.
    (5 votes)
    Default Khan Academy avatar avatar for user
    • stelly blue style avatar for user Kim Seidel
      I would agree with you...a simplified answer would have no radical in the denominator. Though, when I did it I got: (x^2 +1-sqrt(x^2-1))/x^2.
      Sal doesn't consistently simplify the radicals in his videos, which is frustrating.
      (5 votes)
  • aqualine ultimate style avatar for user Lianne
    For f( g(x)), couldn't we just plug in the value of g(x)?
    (3 votes)
    Default Khan Academy avatar avatar for user
    • male robot hal style avatar for user Jesse
      You could if you were looking at a particular value of x. In this example, Sal was simply using the two functions to build a single function. This is useful in that if you knew a value for x, you could now evaluate a single function rather than having to successively evaluate two different functions. If you need to evaluate the composition at many different input values, generating a composition function algebraically is often more efficient.
      (6 votes)
  • aqualine ultimate style avatar for user Lindsay MacVean
    I was able to further simplify f(g(x)) =
    sqrt((x^2/(1+x)^2) + 1)
    Normalize the 1 = (x+1)^2/(x+1)^2 and expand quadratics
    sqrt((x^2-x^2+2x+1)/(x+1)^2)
    = sqrt(2x+1) / (x +1)

    Is this correct?
    (4 votes)
    Default Khan Academy avatar avatar for user
  • aqualine ultimate style avatar for user JumpingHorseDancer
    Is it possible to do this mentally? Or is better to write the whole thing out? What do you guys think?
    (3 votes)
    Default Khan Academy avatar avatar for user
    • aqualine ultimate style avatar for user itimespi
      With practice, you will most likely be able to find composite functions mentally. This may not happen for all problems, but for some, it certainly will.

      For example, if f(x) = x + 1, and g(x) = x^2, finding f(g(x)) wouldn't most likely be regarded as hard, since you can simply substitute the x^2 in to get f(g(x)) = x^2 + 1

      However, if you were given a harder example, such as f(x) = (x + tanxsecx - x!/sqrt(x)) and g(x) = cscx * arccos(x), then finding the composite function mentally would probably be harder.
      (2 votes)
  • blobby green style avatar for user Nishit Samarth
    How do you find the domain and range of this function?
    (3 votes)
    Default Khan Academy avatar avatar for user
  • aqualine seed style avatar for user Jason  Li
    At around , Sal didn't make a condition/constraint where x cannot equal to -1. Why? Wouldn't g(x) be undefined when x is equal to -1? If so, then would the f(g(x)) also be undefined when g(x) is equal to -1?
    (1 vote)
    Default Khan Academy avatar avatar for user
    • stelly blue style avatar for user Kim Seidel
      I would agree with your assessment. If X = -1, both g(x) and f(g(x)) would be undefined. F(x) should also be restricted to values where X not = 0 as square roots are usually restricted to where the contents of the radical are >=0 to stay within the set of real numbers.
      (5 votes)

Video transcript

Voiceover:When we first got introduced to function composition, we looked at actually evaluating functions at a point, or compositions of functions at a point. What I wanna do in this video is come up with expressions that define a function composition. So, for example, I wanna figure out, what is, f of, g of x? f of, g of x. And I encourage you to pause the video, and try to think about it on your own. Well, g of x in this case, is the input to f of x. So, wherever we see the x in this definition, that's the input. So we're going to replace the input with g of x. We're going to replace the x with g of x. So, f of g of x is going to be equal to the square root of- Well instead of an x, we would write a g of x. g of x, g of x squared. g of x squared, minus one. Now what is g of x equal to? Well, g of x is this thing right over here. So this is going to be equal to the square root of, g of x, is x over 1 plus x. We're going to square that. We're going to square that, minus 1. So f of g of x, is also a function of x. So f of g of x is a square root of, and we could write this as x squared over 1 plus x squared, but we could just leave it like this. It's equal to the square root of this whole thing, x over 1 plus x, squared, minus one. Now let's go the other way round. What is g of f of x? What is g of f of x? And once again, I encourage you to pause the video, and try to think about it on your own. Well, f of x is now the input into g of x. So everywhere we see the x here, we'll replace it with f of x. So this is going to be equal to, this is going to be equal to, f of x, over- Let me do it in the same color, so you can appreciate it better. f of x over, one plus f of x. One plus f of x. And what's that equal to? Well, f of x is equal to the square root, of x squared minus one. x squared minus one. So it's gonna be that over 1, plus the square root. One plus the square root of x squared minus one. So this is a composition f of g of x, you get this thing. This is g of f of x, where you get this thing. And to be clear, these are very different expressions. So typically, you want the composition one way. This isn't gonna be the same as the composition the other way, unless the functions are designed in a fairly special way.