Problem:
Calculate the compositions fg and gf of the functions

f(x) = x3 + 5
and
g(x) = 2 cos(2 x + 7)

and similar functions and determine whether fg = gf.


Visualization:
The following LiveMath Notebook evaluates the compositions fg and gf and plots their graphs. By looking at the graphs, you can easily see that the compositions fg and gf are not equal. You can modify the functions f and g and see the resulting changes. View an animation to see how this can be done.


  1. Which is the graph of fg and the graph of gf?
  2. Why did we look at the graphs rather than just say that since the formulas are different for fg and gf, then the compositions fg and gf are not equal? Can you give an example of two formulas that do not look the same but the functions defined by the formulas are equal?
  3. Give an example of two different functions f and g such that fg = gf. Answers