The Math Forum

Ask Dr. Math - Questions and Answers from our Archives
Associated Topics || Dr. Math Home || Search Dr. Math

Sometimes, Always, or Never True?

Date: 02/12/2002 at 19:02:16
From: Jon
Subject: Functions 

I can find no explanation for this question.

Tell whether this statement is always, sometimes, or never true:

f(g(x)) = g(f(x))

Date: 02/12/2002 at 23:05:39
From: Doctor Ian
Subject: Re: Functions 

Hi Jon, 

Suppose f(x) = x + 1, and g(x) = x^2.  Then

  f(g(x)) = g(x) + 1

          = x^2 + 1


  g(f(x)) = (f(x))^2

          = (x + 1)^2

          = x^2 + 2x + 1

So in this case, f(g(x)) is clearly not equal to g(f(x)), except when 
x happens to be zero. So we know that it's not _always_ true.  

On the other hand, suppose f(x) = x + 1 and g(x) = x - 1.  Then 

  f(g(x)) = g(x) + 1

          = (x - 1) + 1

          = x

  g(f(x)) = f(x) - 1
          = (x + 1) - 1

          = x

So for these functions, f(g(x)) = g(f(x)), regardless of what the 
value of x happens to be.

This is easiest to think about if you think of functions as little 
processes. Then the composition of two processes says: Put something 
into the inner function; and whatever comes out, use that as input to 
the outer function.  

The functions don't have to be mathematical. For example, if f(x) 
means 'paint x blue', and g(x) means 'wrap x in paper', then

  f(g(x)) => wrap x in paper, and paint the whole thing blue


  g(f(x)) => paint x blue, and wrap the painted object in paper

In the first case, the paper gets painted; in the second, the object 
itself gets painted.  

In many cases where f(g(x)) = g(f(x)), the functions are inverses of each 
other.  That is, what one does, the other undoes, so when you compose 
them (in either order), you get x back as the final result.  You've 
seen one example.  Here are some others:
  f(x) = x^2, g(x) = \| x

  f(x) = 10^x, g(x) = log(x)

  f(x) = 2x, g(x) = x/2

  f(x) = sin(x), g(x) = arcsin(x)

But this isn't always the case, e.g., 

  f(x) = 1/x,  g(x) = -x    

Does this help?   

- Doctor Ian, The Math Forum   
Associated Topics:
High School Functions

Search the Dr. Math Library:

Find items containing (put spaces between keywords):
Click only once for faster results:

[ Choose "whole words" when searching for a word like age.]

all keywords, in any order at least one, that exact phrase
parts of words whole words

Submit your own question to Dr. Math

[Privacy Policy] [Terms of Use]

Math Forum Home || Math Library || Quick Reference || Math Forum Search

Ask Dr. MathTM
© 1994- The Math Forum at NCTM. All rights reserved.