Composition of Functions Calculator

An online calculator for the composition of functions is presented along with definitions and examples.

Definition of Composition of Functions

In the diagram below, function \( f \) has another function \( g \) as an input. Starting from the input \( x \), applying function \( g \) then function \( f \), we end up with a function called the composite function or composition of \( f \) and \( g \), denoted by \( f \circ g \) and defined by:

\[ (f \circ g)(x) = f(g(x)) \]

This composite function is defined if \( x \) is in the domain of \( g \) and \( g(x) \) is in the domain of \( f \).

diagram of the composition of functions
Figure 1. Diagram of function composition

According to the definition above, to find the composition \( (f \circ g)(x) \), we substitute the variable of \( f \) by \( g(x) \).

Example

Let \( f(x) = x^3 + 2x^2 - 3x - 1 \) and \( g(x) = x + 2 \). Find the composition \( (f \circ g)(x) \).

View Solution

Definition:

\[ (f \circ g)(x) = f(g(x)) \]

Substitute the variable \( x \) in \( f \) by \( g(x) \):

\[ = (g(x))^3 + 2(g(x))^2 - 3(g(x)) - 1 \]

Substitute \( g(x) \) by its formula \( x + 2 \):

\[ = (x+2)^3 + 2(x+2)^2 - 3(x+2) - 1 \]

Expand and simplify:

\[ (f \circ g)(x) = x^3 + 8x^2 + 17x + 9 \]

Use of the Composition Calculator

1 - Enter and edit functions \( f(x) \) and \( g(x) \) and click "Enter Functions", then check what you have entered and edit if needed.
2 - Press "Calculate Composition".
Note that the five operators used are: + (plus), - (minus), / (division), ^ (power), and * (multiplication). (Example: x^3+2*x^2 - 3*x -1).

\( f(x) \) =

\( g(x) \) =

Notes: In editing functions, use the following:
1 - The square root function is written as sqrt(x). (Example: sqrt(x^2-1))
2 - The exponential function is written as e^x. (Example: e^(2*x+2))
3 - The natural logarithm function is written as ln(x). (Example: ln(2*x-2))

Here are some examples of functions that you may copy and paste to practice:
sqrt(x)     x^2 + 2*x - 3     (x^2+2*x-1)/(x-1)     1/(x-2)     ln(2*x - 2)
sqrt(x^2-1)     2*sin(2*x-2)     e^(2*x-3)     1/sqrt(x^2-1)     x/(x+1)

More References and Links