Now we're going to do a different type of example. Remember how I said functions f and g for which f(g(x))=g(f(x)) are hard to find? Well, we're going to discuss that a bit more now.
If f and g are in fact the same function, then replacing g with f above gives f(f(x))=f(f(x)), which is true for any function f.
Another way to do this is to pick a function f and then "guess" functions g for which f(g(x))=g(f(x)). We can do function composition calculations even if we're guessing g, so we'll explain how.
Example: If f(x)=x+2, find a polynomial function g(x) of degree 2 or less so that f(g(x))=g(f(x)).
Solution: All polynomials of degree 2 resemble
g(x)=ax2+bx+c,
where a,b, and c are real numbers we can choose. This equation comes from the standard form of a quadratic.
So now here's the game plan: we want to find a,b, and c so that g(f(x))=f(g(x)). We let a,b, and c be variables when we calculate f(g(x)) and g(f(x)), and go from there.
Since f(x)=x+5, to find g(f(x)) we plug x+5 in for f and have
g(f(x))=g(x+5).
now we plug x+5 in the definition of g:
g(x+5)g(x+5)g(x+5)=a(x+5)2+b(x+5)+c⇒=a(x2+10x+25)+bx+5b+c⇒=ax2+(10a+b)x+(25a+5b+c).
This means that g(f(x))=ax2+(10a+b)x+(25a+5b+c). Now we calculate f(g(x)) in much the same way. Since g(x)=ax2+bx+c, we plug this into f(g(x)) to get
f(g(x))=f(ax2+bx+c).
Now since f(x)=x+5, we replace x with ax2+bx+c to see that
f(ax2+bx+c)=ax2+bx+c+5.
As a result of this, g(f(x))=ax2+bx+c+5. We wanted f(g(x))=g(f(x)), so we require the following equation to be true:
ax2+bx+c+5=ax2+(10a+b)x+(25a+5b+c)
These are both quadratic functions. If they are to be the SAME quadratic function, then the quadratic, linear, and constant terms must be the same. In particular, they have the same coefficients. Matching up the coefficients of the quadratic terms gives
a=a.
Matching up the coefficients of the linear terms gives
b=10a+b.
Finally, matching up the coefficients of the constant terms gives
c+5=25a+5b+c.
These equations together give us a system
abc+5=a=10a+b=25a+b+c.