Mathematics

Composite Function: Formula, Rules & Examples

A composite function is created when the output of one function becomes the input of another function.

The standard formula is:

Composite Function Formula: (f ∘ g)(x) = f(g(x))

This means:

  1. calculate g(x) first;
  2. substitute that entire result wherever x appears in f(x).

For example, suppose:

f(x) = 2x + 3

and:

g(x) = x²

Then:

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

Substitute:

f(x²) = 2x² + 3

Therefore:

(f ∘ g)(x) = 2x² + 3

Function order matters. In general:

f(g(x)) ≠ g(f(x))

so reversing the functions can create a completely different result.

What Is a Composite Function?

Function composition connects functions in sequence.

Suppose:

g(x)

takes an input and produces an intermediate result.

Then:

f(x)

takes that result as its own input.

The complete operation is:

x → g(x) → f(g(x))

This can be thought of as a mathematical pipeline.

For example:

g(x) = x + 4

followed by:

f(x) = 3x

means:

First:

x → x + 4

Then:

x + 4 → 3(x + 4)

Therefore:

(f ∘ g)(x) = 3x + 12

The broader algebra framework uses this substitution principle throughout function analysis.

Composite Function Formula

The main formula is:

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

Read it as:

“f composed with g at x”

The rightmost function acts first.

Likewise:

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

The order is reversed.

This notation is closely connected to standard function notation.

Composite Function Example

Let:

f(x) = x + 5

and:

g(x) = 2x

Find:

(f ∘ g)(x)

Start with:

g(x) = 2x

Substitute 2x into f:

f(2x) = 2x + 5

Therefore:

(f ∘ g)(x) = 2x + 5

Now reverse the order:

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

Substitute:

g(x + 5) = 2(x + 5)

Therefore:

(g ∘ f)(x) = 2x + 10

The two composite functions are different.

Why Function Order Matters

Function composition is generally not commutative.

That means:

f ∘ g ≠ g ∘ f

For:

f(x) = x + 1

and:

g(x) = x²

we have:

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

but:

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

Using the binomial theorem:

(x + 1)² = x² + 2x + 1

Therefore:

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

while:

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

They are not equal.

Evaluating a Composite Function at a Number

Suppose:

f(x) = 3x – 2

g(x) = x² + 1

Find:

(f ∘ g)(2)

First evaluate:

g(2) = 2² + 1 = 5

Then:

f(5) = 3(5) – 2

= 13

Therefore:

(f ∘ g)(2) = 13

You can also build the composite formula first:

f(g(x)) = 3(x² + 1) – 2

= 3x² + 1

Then:

3(2²) + 1 = 13

Both methods agree.

Substitution Is the Core Skill

Suppose:

f(x) = x² – 4x

and:

g(x) = 3x + 1

To calculate:

f(g(x))

replace every occurrence of x in f with:

3x + 1

Therefore:

f(g(x)) = (3x + 1)² – 4(3x + 1)

Do not replace only one occurrence of x.

That is one of the most common composition mistakes.

Simplifying the Composite

Continue:

(3x + 1)² – 4(3x + 1)

Expand the square:

(3x + 1)² = 9x² + 6x + 1

Then:

-4(3x + 1) = -12x – 4

Combine:

9x² + 6x + 1 – 12x – 4

Therefore:

f(g(x)) = 9x² – 6x – 3

Composite Functions With Fractions

Suppose:

f(x) = 1/x

and:

g(x) = x + 4

Then:

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

The denominator cannot be zero.

Therefore:

x + 4 ≠ 0

so:

x ≠ -4

This restriction is part of the domain of the composite function.

Domain of a Composite Function

The domain of:

f(g(x))

contains values of x that satisfy both of these conditions:

1. x must be allowed in g(x)

and:

2. g(x) must produce an allowed input for f

A useful rule is:

Domain of f(g(x)) = Values of x in the domain of g for which g(x) lies in the domain of f

This second condition is often where mistakes occur.

Composite Function Domain Example

Let:

f(x) = √x

and:

g(x) = x – 5

Then:

f(g(x)) = √(x – 5)

For a real-valued square root:

x – 5 ≥ 0

Therefore:

x ≥ 5

The composite domain is:

[5, ∞)

The full domain and range topic develops these restrictions more deeply.

Domain Restriction Created by the Outer Function

Notice that:

g(x) = x – 5

itself allows every real number.

The restriction comes from the outer function:

f(x) = √x

Because f cannot accept a negative real input, the output of g must satisfy:

g(x) ≥ 0

Therefore:

x ≥ 5

Composition can create restrictions that are not obvious from the inner function alone.

Domain Restriction From the Inner Function

Now suppose:

f(x) = x²

and:

g(x) = 1/(x – 3)

Then:

f(g(x)) = [1/(x – 3)]²

The outer function accepts every real input.

But g(x) is undefined at:

x = 3

Therefore the composite domain excludes:

x = 3

Domain Restriction From Both Functions

Suppose:

f(x) = √x

and:

g(x) = 1/(x – 2)

Then:

f(g(x)) = √[1/(x – 2)]

For a real-valued composite, we need:

1/(x – 2) ≥ 0

and:

x ≠ 2

The reciprocal is positive when:

x > 2

Therefore the real domain is:

x > 2

This is more restrictive than the domain of either expression considered casually in isolation.

Composite Function With a Radical Equation

Suppose:

f(x) = √x

and:

g(x) = x + 3

Then:

f(g(x)) = √(x + 3)

If:

f(g(x)) = 5

then:

√(x + 3) = 5

Square both sides:

x + 3 = 25

x = 22

This composition produces the type of equation studied in radical equations.

Composite Function With a Quadratic

Let:

f(x) = x² + 2x + 1

and:

g(x) = 3x

Then:

f(g(x)) = (3x)² + 2(3x) + 1

Therefore:

f(g(x)) = 9x² + 6x + 1

The outer quadratic preserves its structure but receives the entire output of the inner function as its new input.

Composite Function Producing a Cubic Equation

Suppose:

f(x) = x³ – 1

and:

g(x) = x + 2

Then:

f(g(x)) = (x + 2)³ – 1

If the composite is set equal to zero:

(x + 2)³ – 1 = 0

This produces a transformed cubic equation.

The composition handles substitution; the cubic-equation method handles the resulting equation.

Composite Functions and Complex Roots

A composition can also lead to complex roots.

Suppose:

f(x) = x² + 4

and:

g(x) = x – 1

Then:

f(g(x)) = (x – 1)² + 4

Solve:

f(g(x)) = 0

Then:

(x – 1)² = -4

Therefore:

x – 1 = ±2i

So:

x = 1 ± 2i

The composite function itself is an algebraic substitution structure; the complex roots arise from solving the resulting equation.

Composite Functions Over Complex Numbers

Functions do not have to use only real inputs.

Suppose:

f(z) = z²

and:

g(z) = z + i

Then:

f(g(z)) = (z + i)²

Expand:

z² + 2iz + i²

Since:

i² = -1

we get:

f(g(z)) = z² + 2iz – 1

This uses the same composition principle within the complex numbers system.

Composite Function With an Absolute Value

Suppose:

f(x) = |x|

and:

g(x) = 2x – 5

Then:

f(g(x)) = |2x – 5|

If the composite equals 7:

|2x – 5| = 7

Then:

2x – 5 = 7

or:

2x – 5 = -7

Solutions:

x = 6

or:

x = -1

The resulting equation is an absolute value equation.

Composite Function With an Exponential

Suppose:

f(x) = 2ˣ

and:

g(x) = x + 3

Then:

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

If:

f(g(x)) = 32

then:

2^(x + 3) = 32

Since:

32 = 2⁵

we get:

x + 3 = 5

Therefore:

x = 2

The composition produces an expression that can lead to an exponential equation.

Composite Function With a Logarithm

Suppose:

f(x) = log(x)

and:

g(x) = x – 4

Then:

f(g(x)) = log(x – 4)

The logarithm requires:

x – 4 > 0

Therefore:

x > 4

If the composition is placed inside an equation, the resulting problem belongs to the logarithmic equation family.

Finding f(g(x)) From Tables

Functions do not need formulas to be composed.

Suppose a table gives:

g(2) = 5

and another table gives:

f(5) = 9

Then:

f(g(2)) = f(5)

Therefore:

f(g(2)) = 9

The process is exactly the same:

first find the inner output, then use it as the outer input.

Finding f(g(x)) From a Graph

Suppose a graph shows:

g(1) = 3

and the graph of f shows:

f(3) = -2

Then:

f(g(1)) = -2

Composition can therefore be evaluated from equations, tables, graphs, or any other valid function representation.

Composite Function as a Machine

A useful conceptual model is to think of each function as a machine.

Suppose:

g(x) = x + 2

Machine g adds 2.

Then:

f(x) = 3x

Machine f multiplies by 3.

For input:

x = 4

first:

g(4) = 6

then:

f(6) = 18

Therefore:

(f ∘ g)(4) = 18

Reversing the machines:

f(4) = 12

then:

g(12) = 14

So:

(g ∘ f)(4) = 14

Order changes the result.

Composite Functions Are Associative

Function composition is associative.

For compatible functions:

(f ∘ g) ∘ h = f ∘ (g ∘ h)

At an input x:

((f ∘ g) ∘ h)(x) = f(g(h(x)))

and:

(f ∘ (g ∘ h))(x) = f(g(h(x)))

Both produce the same nested order of evaluation.

This does not mean composition is commutative.

Three-Function Composition Example

Suppose:

f(x) = x + 1

g(x) = 2x

h(x) = x²

Find:

f(g(h(x)))

First:

h(x) = x²

Then:

g(h(x)) = 2x²

Finally:

f(g(h(x))) = 2x² + 1

Therefore:

(f ∘ g ∘ h)(x) = 2x² + 1

The rightmost function still acts first.

Identity Function

The identity function is:

I(x) = x

Composing any suitable function with the identity leaves it unchanged:

f(I(x)) = f(x)

and:

I(f(x)) = f(x)

Therefore:

f ∘ I = I ∘ f = f

The identity function acts like the number 1 does in multiplication: it leaves the object unchanged.

Composite Functions and Inverse Functions

An inverse function reverses a function.

If f is invertible:

f⁻¹(f(x)) = x

and:

f(f⁻¹(x)) = x

In composition notation:

f⁻¹ ∘ f = I

and:

f ∘ f⁻¹ = I

on the appropriate domains.

This is one of the most important applications of function composition.

Inverse Function Example

Suppose:

f(x) = 2x + 3

Its inverse is:

f⁻¹(x) = (x – 3) / 2

Compose:

f⁻¹(f(x))

Substitute:

[(2x + 3) – 3] / 2

Simplify:

2x / 2

Therefore:

f⁻¹(f(x)) = x

The inverse composition returns the original input.

Composition With a Piecewise Function

A piecewise function can also be composed.

Suppose:

f(x) = x²

and:

g(x) = x + 1 when x < 0

g(x) = 2x when x ≥ 0

Then:

For:

x < 0

we get:

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

For:

x ≥ 0

we get:

f(g(x)) = (2x)² = 4x²

The composite retains the piecewise conditions of the inner function unless the outer function introduces further restrictions.

Composition With a Rational Function

Suppose:

f(x) = 1/x

and:

g(x) = x² – 4

Then:

f(g(x)) = 1/(x² – 4)

The denominator cannot equal zero:

x² – 4 ≠ 0

Factor:

(x – 2)(x + 2) ≠ 0

Therefore:

x ≠ 2

and:

x ≠ -2

This creates the same type of domain restriction seen in rational equations.

Composite Function and Linear Functions

Let:

f(x) = ax + b

and:

g(x) = cx + d

Then:

f(g(x)) = a(cx + d) + b

Simplify:

f(g(x)) = acx + ad + b

The composition of two linear equations viewed as linear functions is again linear, provided the usual affine form is being used.

Example With Two Linear Functions

Suppose:

f(x) = 3x + 2

g(x) = 4x – 5

Then:

f(g(x)) = 3(4x – 5) + 2

= 12x – 15 + 2

= 12x – 13

Reverse:

g(f(x)) = 4(3x + 2) – 5

= 12x + 8 – 5

= 12x + 3

The slopes happen to match, but the intercepts do not.

Composition Can Simplify to the Same Result

Although composition is not generally commutative, some functions do commute.

Suppose:

f(x) = x + 2

g(x) = x + 5

Then:

f(g(x)) = x + 7

and:

g(f(x)) = x + 7

In this particular case:

f ∘ g = g ∘ f

The fact that some pairs commute does not make commutativity a general rule.

Composition With Squaring and Negation

Let:

f(x) = x²

g(x) = -x

Then:

f(g(x)) = (-x)² = x²

while:

g(f(x)) = -x²

Therefore:

f(g(x)) ≠ g(f(x))

This simple example makes the order issue particularly clear.

Composite Functions and De Moivre’s Theorem

Composition can also appear naturally when functions act on complex-number representations.

Suppose:

g(θ) = cos θ + i sin θ

and:

f(z) = zⁿ

Then:

f(g(θ)) = [cos θ + i sin θ]ⁿ

De Moivre’s theorem simplifies this to:

cos(nθ) + i sin(nθ)

The composition notation explains which operation occurs first; De Moivre’s theorem supplies the specialized complex-number simplification.

Composite Functions and the Binomial Theorem

Suppose:

f(x) = x⁵

and:

g(x) = x + 2

Then:

f(g(x)) = (x + 2)⁵

The composition creates the binomial power.

The binomial theorem can then expand it:

x⁵ + 10x⁴ + 40x³ + 80x² + 80x + 32

These are two distinct algebraic steps:

  1. compose the functions;
  2. expand the resulting binomial.

Composite Functions and Cubic Equations

Suppose:

f(x) = x³

and:

g(x) = 2x – 1

Then:

f(g(x)) = (2x – 1)³

If this expression is set equal to a constant, solving the resulting equation can become a cubic problem.

Function composition defines the nesting.

Cubic-equation methods solve the resulting polynomial equation.

Composite Functions and Arithmetic Series

A composite function should not be confused with an arithmetic series.

Composition means:

f(g(x))

where one output becomes another function’s input.

A series means terms are added:

a₁ + a₂ + a₃ + …

They are entirely different algebraic operations even though both can involve function notation or indexed values.

Finding an Unknown Function From a Composition

Suppose:

f(x) = 2x + 1

and:

f(g(x)) = 6x + 5

Since:

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

we have:

2g(x) + 1 = 6x + 5

Subtract 1:

2g(x) = 6x + 4

Divide by 2:

g(x) = 3x + 2

This type of problem reverses the usual composition process.

Verifying the Unknown Function

Substitute:

g(x) = 3x + 2

into:

f(x) = 2x + 1

Then:

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

= 6x + 4 + 1

= 6x + 5

The required composite function is recovered.

Decomposing a Function

Sometimes a complicated function can be viewed as a composition of simpler functions.

Consider:

h(x) = √(3x + 1)

One possible decomposition is:

g(x) = 3x + 1

and:

f(x) = √x

Then:

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

This perspective is especially useful later in calculus because composite structures affect differentiation and integration strategies.

Another Decomposition Example

Consider:

h(x) = (x² + 1)⁵

Let:

g(x) = x² + 1

and:

f(x) = x⁵

Then:

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

A complex-looking function can therefore be understood as a sequence of simpler transformations.

Composite Function and Range Restrictions

Composition can also affect range.

Suppose:

g(x) = x²

The output of g is always:

g(x) ≥ 0

If:

f(x) = √x

then:

f(g(x)) = √(x²)

For real x:

√(x²) = |x|

not simply x.

This is an important reminder that algebraic simplification must respect the definitions and ranges of the functions involved.

Why √(x²) = |x|

For:

x = -3

we have:

x² = 9

Then:

√9 = 3

not:

-3

Therefore:

√(x²) = |x|

for real x.

Function composition makes this distinction especially visible because the square function loses sign information before the square-root function acts.

Composite Function With Domain and Range

Suppose:

g(x) = x²

and:

f(x) = 1/(x – 4)

Then:

f(g(x)) = 1/(x² – 4)

For the outer function to be defined:

g(x) ≠ 4

Therefore:

x² ≠ 4

so:

x ≠ 2

and:

x ≠ -2

The domain restriction is derived from the outer function’s prohibited input after substituting the inner output.

Composite Function With Three Domain Restrictions

Suppose:

h(x) = √x

g(x) = 1/(x – 1)

f(x) = x + 2

Consider:

h(g(f(x)))

First:

f(x) = x + 2

Then:

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

Finally:

h(g(f(x))) = √[1/(x + 1)]

For a real result:

1/(x + 1) ≥ 0

and:

x ≠ -1

Therefore:

x > -1

Each nested function must remain valid at the stage where it is applied.

Function Composition Is Not Multiplication

The notation:

(f ∘ g)(x)

does not mean:

f(x) × g(x)

For:

f(x) = x + 1

g(x) = x²

composition:

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

Multiplication:

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

= x³ + x²

These are completely different operations.

Function Composition Is Not Addition

Likewise:

f(g(x))

does not mean:

f(x) + g(x)

Composition uses substitution.

Addition combines outputs.

For the same functions:

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

= x² + x + 1

while:

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

Common Composite Function Mistakes

A common mistake is evaluating the leftmost function first.

For:

f(g(x))

g acts first.

Another mistake is replacing only one occurrence of x inside the outer function rather than every occurrence.

Students frequently confuse:

f(g(x))

with:

f(x)g(x)

Domain restrictions are also often ignored.

Another error is assuming:

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

because the same two functions appear.

Parentheses can be lost during substitution, causing signs or exponents to be applied incorrectly.

Finally, simplifying:

√(x²)

to x instead of |x| can produce incorrect results.

Frequently Asked Questions

What is a composite function?

A composite function is created when the output of one function becomes the input of another.

What is the composite function formula?

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

Which function is evaluated first?

In:

f(g(x))

the inner function:

g(x)

is evaluated first.

How do you find f(g(x))?

Find g(x) and substitute the entire expression for every x in f(x).

Is f(g(x)) the same as g(f(x))?

Not generally.

Function composition is usually not commutative.

Is a composite function multiplication?

No.

f(g(x))

means substitution, while:

f(x)g(x)

means multiplication.

What is the domain of a composite function?

The input must be valid for the inner function, and the inner function’s output must be a valid input for the outer function.

What is the domain rule for f(g(x))?

Domain = Values of x in the domain of g for which g(x) lies in the domain of f

Can a composite function have a smaller domain than either individual function appears to have?

Yes. The outer function can impose restrictions on the output produced by the inner function.

Are composite functions associative?

Yes:

(f ∘ g) ∘ h = f ∘ (g ∘ h)

when the compositions are defined.

Are composite functions commutative?

Not generally:

f ∘ g ≠ g ∘ f

in most cases.

What is the identity function?

I(x) = x

It satisfies:

f ∘ I = I ∘ f = f

How are inverse functions related to composition?

For an invertible function:

f⁻¹(f(x)) = x

and:

f(f⁻¹(x)) = x

on the appropriate domains.

Can composite functions contain radicals?

Yes. Domain restrictions must then ensure the radical expression remains valid for the chosen number system.

Can composite functions use complex numbers?

Yes. The same substitution rules apply to complex-valued functions.

Can composition produce complex roots?

Yes. A composed equation can lead to a polynomial or another expression whose solutions include complex numbers.

How is the binomial theorem related to composite functions?

If an outer power function receives a binomial inner function, composition can produce an expression such as:

(x + 2)⁵

which can then be expanded using the binomial theorem.

What is the difference between a composite function and an arithmetic series?

A composite function nests functions through substitution. An arithmetic series adds terms with a constant-difference pattern.

Why are composite functions important?

Composition allows several mathematical transformations to be connected into one function. It is fundamental to algebra, inverse functions, domain analysis, mathematical modeling, and later topics such as the calculus chain rule.

Mehran Khan

Mehran Khan is the primary author at The Logic Library and CEO & Founder of One Digit Media. With 10+ years of experience in software engineering, SEO, and digital publishing, he uses a research-led approach to Logics, Maths, Tech, Formulas, Science, and AI.

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button