Derivatives: rules and functions

Meaning of a composite function f(g(x))

A composite function f(g(x))f(g(x)) applies gg first and then ff.

(f∘g)(x)=f(g(x))(f\circ g)(x)=f(g(x))

The composite function f(g(x))f(g(x)) applies gg to xx first, then ff to the result. Changing the order changes the function.

f(x)=x+3, g(x)=x2 ⇒ g(f(x))=(x+3)2,f(g(x))=x2+3\begin{gathered} f(x)=x+3,\ g(x)=x^2 \ \Rightarrow\ g(f(x))=(x+3)^2, \\[4pt] f(g(x))=x^2+3 \end{gathered}

For differentiation, practice seeing y=(2x+4)4y=(2x+4)^4 as an outer function y=u4y=u^4 and an inner function u=2x+4u=2x+4. The chain rule multiplies the derivatives of the outer and inner parts.

Examples

  1. 01Write g(f(x)) as an expression:f(x)=x+3,g(x)=x2\displaystyle f(x)=x+3, \quad g(x)=x^{2}AnswerHide
    Answer(x+3)2\displaystyle (x+3)^{2}

    Steps

    1. Substitute f into g
    2. g(x)\displaystyle g(x)=x2\displaystyle = x^{2}g(f(x))\displaystyle g(f(x))=(x+3)2\displaystyle = (x+3)^{2}
    3. Swapping the order gives a different expression
    4. f(g(x))\displaystyle f(g(x))=x2+3\displaystyle = x^{2}+3
  2. 02What is g(f(x)) − f(g(x))?g(f(x))=4x+2,  f(g(x))=4x+8\displaystyle g(f(x))=4x+2,\; f(g(x))=4x+8AnswerHide
    Answer−6\displaystyle -6

    Steps

    1. (4x+2)−(4x+8)\displaystyle (4x+2) - (4x+8)=−6\displaystyle = -6
    2. The x terms cancel; only the constants differ
    3. It is not 0 because the order changes the function
  3. 03Viewing this as y=u4y=u^{4}, what is the inner uu?y=(2x+4)4\displaystyle y=(2x+4)^{4}AnswerHide
    Answer2x+4\displaystyle 2x+4

    Steps

    1. The bracket, which is computed first, is all of u
    2. u\displaystyle u=2x+4\displaystyle = 2x+4y\displaystyle y=u4\displaystyle = u^{4}
  4. 04Write f(g(x)) as an expression:f(x)=x+5,g(x)=x2\displaystyle f(x)=x+5, \quad g(x)=x^{2}AnswerHide
    Answerx2+5\displaystyle x^{2}+5

    Steps

    1. Substitute g into f
    2. f(x)\displaystyle f(x)=x+5\displaystyle = x+5f(g(x))\displaystyle f(g(x))=x2+5\displaystyle = x^{2}+5
    3. Swapping the order gives a different expression
    4. g(f(x))\displaystyle g(f(x))=(x+5)2\displaystyle = (x+5)^{2}
  5. 05What is f(g(3))?f(x)=x+2,g(x)=x2\displaystyle f(x)=x+2, \quad g(x)=x^{2}AnswerHide
    Answer11\displaystyle 11

    Steps

    1. g goes first: compute g(3)
    2. g(3)\displaystyle g(3)=32=9\displaystyle = 3^{2} = 9
    3. Substitute that answer into f
    4. f(9)\displaystyle f(9)=9+2=11\displaystyle = 9+2 = 11
    5. Swapping the order gives a different value
    6. g(f(3))\displaystyle g(f(3))=(5)2=25\displaystyle = (5)^{2} = 25
  6. 06Write g(f(x)) as an expression:f(x)=x+4,g(x)=x2\displaystyle f(x)=x+4, \quad g(x)=x^{2}AnswerHide
    Answer(x+4)2\displaystyle (x+4)^{2}

    Steps

    1. Substitute f into g
    2. g(x)\displaystyle g(x)=x2\displaystyle = x^{2}g(f(x))\displaystyle g(f(x))=(x+4)2\displaystyle = (x+4)^{2}
    3. Swapping the order gives a different expression
    4. f(g(x))\displaystyle f(g(x))=x2+4\displaystyle = x^{2}+4

FAQ

Are f(g(x)) and g(f(x)) the same?
Usually not. With f(x)=x+3f(x)=x+3 and g(x)=x2g(x)=x^2, f(g(x))=x2+3f(g(x))=x^2+3 but g(f(x))=(x+3)2g(f(x))=(x+3)^2. The order matters.

Published 2026-09-04 · Updated 2026-10-14