---
title: "Composite functions"
description: "Apply one function to the output of another, writing fg(x) as f(g(x)), and keep the order of the two rules straight."
canonical: https://lightmysky.com/learn/mathematics/composite-functions-mt_jqGJHXgYNw
source: https://lightmysky.com/learn/mathematics/composite-functions-mt_jqGJHXgYNw.md
retrieved: 2026-11-12
---

> **Agent view.** This is the Markdown twin of the page, for tools and assistants.
> When to use this site, and the call that answers each job: https://lightmysky.com/agent-instructions.md
> API description (OpenAPI 3.1): https://lightmysky.com/openapi.json · Authentication: https://lightmysky.com/auth.md
> Pricing: https://lightmysky.com/pricing.md · Catalog: https://lightmysky.com/llms.txt · Full catalog: https://lightmysky.com/llms-full.txt
> Every machine-readable file on this domain: https://lightmysky.com/.well-known/ai-catalog.json
> Ask for Markdown with `Accept: text/markdown`, a `.md` address, or `?mode=agent`.

# Composite functions

Apply one function to the output of another, writing fg(x) as f(g(x)), and keep the order of the two rules straight.

Subject: Mathematics · Area: Algebra · Ages 15 to 16
Page: https://lightmysky.com/learn/mathematics/composite-functions-mt_jqGJHXgYNw

## Ready when they can

- Work out fg(2) by finding g(2) first and then applying f
- Write and simplify an expression for fg(x)
- Show with one example that fg(x) and gf(x) usually differ

## Lesson: Composite functions

Previously, you put a number into one rule and read off the output. A composite function combines two rules: the output of one becomes the input of the next. The notation fg(x) means apply g first, then f, and is read as f of g of x. The notation tells you the order, so keep track of which rule acts first.

*(drawing: Two machines in a row: the output of g feeds straight into f.)*

The letters are read inside-out. In fg(x), g is the inner rule and f is the outer one. Always start with g: put the input into g, then put its output into f. It is tempting to start with f because f is written first, but the second letter acts first. Working inside-out helps you keep the order straight.

The composites fg(x) and gf(x) are usually not the same. Swapping the order changes which rule is on the inside, and that usually gives a different answer. Sometimes they match, but you cannot assume it. To show they differ, you need just one input that gives two different outputs.

**Example.** For f(x) = 3x - 2 and g(x) = x + 4, find both orders at input 2. For fg(2), g(2) = 6, then f(6) = 16. For gf(2), f(2) = 4, then g(4) = 8. The same input gives different results when the order changes. To compare or combine two composite values, calculate both inner outputs and both outer outputs, then add or subtract the final values in the requested order.

**Example.** For f(x) = 3x + 4 and g(x) = x - 3, substitute the whole inner rule: fg(x) = 3(x - 3) + 4 = 3x - 5. Check at x = 4: g(4) = 1, f(1) = 7, and 3(4) - 5 = 7. The reverse order gives gf(x) = (3x + 4) - 3 = 3x + 1. Keep brackets around the inner expression until you expand.

**Example.** For f(x) = x² and g(x) = 2x - 1, test input 3. For fg(3), g(3) = 5 and f(5) = 25. For gf(3), f(3) = 9 and g(9) = 17. Since 25 differs from 17, this one input proves the composites are different. Symbolically, fg(x) = (2x - 1)², while gf(x) = 2x² - 1. When substituting into a square, square the whole inner expression.

**Recap.** In fg(x), apply g first, then f. For a formula, substitute the whole inner rule and simplify. Changing the order may change the result; different outputs at one input prove two composites differ.

## Practice

33 questions on this page, each with its working shown.

## Needs first

- [Function notation and evaluating functions](https://lightmysky.com/learn/mathematics/function-notation-and-evaluating-functions-mt_YWKWzHK_6Z)

## Opens up

- [Inverse functions](https://lightmysky.com/learn/mathematics/inverse-functions-mt_7k7q5ZjMb4)
- [The Chain Rule](https://lightmysky.com/learn/mathematics/the-chain-rule-mt_kdhl4dmwJn)
- [Sets and Functions in the Language of Proof](https://lightmysky.com/learn/mathematics/sets-and-functions-in-the-language-of-proof-mt_XAcHX_3DVz)
