Operations on Functions

Algebra 2Module 6: Inverses and Radical FunctionsAdvanced Math

Learn operations on functions step by step with worked examples you can follow. Then practise with 22 instant-feedback questions. Free Algebra 2 lesson from Mr Ahmed Hamouda.

Add, subtract, multiply and divide functions, and build composite functions f∘g

Key Concepts

🔑 Today's Vocabulary

composition of functions — an operation in which the output of one function becomes the input of another: [f ∘ g](x) = f[g(x)].
domain / range — for a composed function the domain is the set of x-values that survive both functions; the range is the set of resulting outputs.

🔑 The Four Operations on Functions

Let f(x) = 3x and g(x) = 2x − 4 for each example below.

OperationDefinitionExample
Addition(f + g)(x) = f(x) + g(x)3x + (2x − 4) = 5x − 4
Subtraction(f − g)(x) = f(x) − g(x)3x − (2x − 4) = x + 4
Multiplication(f · g)(x) = f(x) · g(x)3x(2x − 4) = 6x² − 12x
Division(f/g)(x) = f(x)/g(x), g(x) ≠ 03x/(2x − 4), x ≠ 2
⚠ Division restriction: Whenever you divide functions you must exclude every x that makes the denominator zero — even if that value cancels.
ℹ Degree tip: If the degree of f(x) is m and the degree of g(x) is n, then the degrees of (f + g)(x) and (f − g)(x) can be at most m or n, whichever is greater.

🔑 Composition of Functions

Suppose f and g are functions such that the range of g is a subset of the domain of f. Then the composition function f ∘ g can be described by:

[f ∘ g](x) = f[g(x)]    — "f of g of x"

x  →  g(x)  →  f[g(x)]
Work from the inside out. Evaluate the inner function first.
Substitute that entire output into the outer function wherever x appears.
Simplify, using parentheses carefully when the inner function is a polynomial.
State the domain: values excluded from g, plus values whose g-output is excluded from f.
⚠ Order matters: [f ∘ g](x) is not always equal to [g ∘ f](x). Composition is not commutative.

Key Figures

Figure 1 — composition is a chain of machines, and order matters
f(x) = 3x  ·  g(x) = 2x − 4  ·  start with x = 5 [f ∘ g](5) — inner function g runs first x= 5g: ×2 − 46f: ×318 [g ∘ f](5) — inner function f runs first x= 5f: ×315g: ×2 − 426 18 ≠ 26 — so [f ∘ g](x) is not [g ∘ f](x)
Think of each function as a machine: a number goes in, a number comes out. Composition wires two machines in series, and [f ∘ g](x) means the output of g is fed into f — so g runs first, even though f is written first. Swap the order and you get a different answer, which is why composition is not commutative.
Figure 2 — the domain has to survive both machines
f(x) = √x  ·  g(x) = x − 4  ·  [f ∘ g](x) = √(x − 4) g accepts every real x but f only accepts inputs ≥ 0 so g(x) = x − 4 must itself be ≥ 0 domain of f ∘ g: x ≥ 4
An x only belongs to the domain of f ∘ g if it clears two hurdles: g must accept it, and g's output must be something f accepts. Here g takes any real number, but f = √x refuses negatives, so we need x − 4 ≥ 0. The composed formula √(x − 4) happens to show this clearly, but with division the restriction can hide — which is why you check the inner function's output, not just the final simplified formula.

Move It Yourself

Step-by-Step Worked Examples

Click any example header to open or close it. Each step shows the algebra on the left and the reason on the right.

Given f(x) = −x² + 3x + 1 and g(x) = 2x² − 5, find (f + g)(x) and (f − g)(x).

Part a: (f + g)(x)

1(f + g)(x) = f(x) + g(x)Addition of functions
2= (−x² + 3x + 1) + (2x² − 5)Substitute f(x) and g(x)
3= −x² + 3x + 1 + 2x² − 5Remove parentheses
4= x² + 3x − 4Combine like terms
(f + g)(x) = x² + 3x − 4

Part b: (f − g)(x)

1(f − g)(x) = f(x) − g(x)Subtraction of functions
2= (−x² + 3x + 1) − (2x² − 5)Substitute f(x) and g(x)
3= −x² + 3x + 1 − 2x² + 5Distribute the negative to BOTH terms
4= −3x² + 3x + 6Combine like terms
(f − g)(x) = −3x² + 3x + 6
⚠ Distribute the minus sign. In part b, −(2x² − 5) becomes −2x² + 5. Forgetting the second sign change is the most common error in this lesson.
Given f(x) = 4x² − 2x + 3 and g(x) = −x + 5, find (f · g)(x) and (f/g)(x).

Part a: (f · g)(x)

1(f · g)(x) = f(x) · g(x)Multiplication of functions
2= (4x² − 2x + 3)(−x + 5)Substitute f(x) and g(x)
3= −4x³ + 20x² + 2x² − 10x − 3x + 15Distributive Property
4= −4x³ + 22x² − 13x + 15Simplify
(f · g)(x) = −4x³ + 22x² − 13x + 15

Part b: (f/g)(x)

1(f/g)(x) = f(x)/g(x)Division of functions
2= (4x² − 2x + 3)/(−x + 5)Substitute f(x) and g(x)
3−x + 5 = 0 → x = 5Find the excluded value
(f/g)(x) = (4x² − 2x + 3)/(−x + 5),  x ≠ 5
✓ Check: Given f(x) = −x² + 1 and g(x) = x + 1:  (f · g)(x) = (−x² + 1)(x + 1) = −x³ − x² + x + 1;  (f/g)(x) = −(x − 1)(x + 1)/(x + 1) = 1 − x, x ≠ −1.
When two quantities are modelled by separate functions, a new function can be built with +, −, × or ÷. For example, if a(x) models money coming in and b(x) models money going out, the balance function is (a − b)(x) = a(x) − b(x).
1a(x) = 1750 + 925xMoney in: initial balance plus monthly deposit
2b(x) = 840xMoney out: fixed bills each month
3(a − b)(x) = a(x) − b(x)Subtraction of functions
4= (1750 + 925x) − 840xSubstitute
5= 1750 + 85xCombine like terms
(a − b)(x) = 85x + 1750
ℹ Reading the result: The slope 85 is the net gain per month and 1750 is the starting value — combining functions before graphing is usually faster than graphing both and subtracting point by point.
Given f = {(1, 12), (10, 11), (0, 13), (9, 7)} and g = {(4, 1), (5, 0), (13, 9), (12, 10)}, find [f ∘ g](x) and [g ∘ f](x). State the domain and range of each.

Part A: find [f ∘ g](x) — evaluate g first, then use its output in f

1f[g(4)] = f(1) = 12g(4) = 1, and f(1) = 12
2f[g(5)] = f(0) = 13g(5) = 0, and f(0) = 13
3f[g(13)] = f(9) = 7g(13) = 9, and f(9) = 7
4f[g(12)] = f(10) = 11g(12) = 10, and f(10) = 11
f ∘ g = {(4, 12), (5, 13), (13, 7), (12, 11)}

Part A continued: find [g ∘ f](x) — evaluate f first, then use its output in g

1g[f(1)] = g(12) = 10f(1) = 12, and g(12) = 10
2g[f(10)] = g(11) = undefined11 is NOT in the domain of g
3g[f(0)] = g(13) = 9f(0) = 13, and g(13) = 9
4g[f(9)] = g(7) = undefined7 is NOT in the domain of g
g ∘ f = {(1, 10), (0, 9)}

Part B: state the domain and range

[f ∘ g](x)

D = {4, 5, 12, 13}
R = {7, 11, 12, 13}

[g ∘ f](x)

D = {0, 1}
R = {9, 10}
⚠ A composition can shrink the domain. Because 11 and 7 are not in the domain of g, g ∘ f is undefined for x = 10 and x = 9. Those pairs are dropped entirely.
Given f(x) = 2x − 5 and g(x) = 3x, find [f ∘ g](x) and [g ∘ f](x). State the domain and range for each.

Part A: [f ∘ g](x)

1[f ∘ g](x) = f[g(x)]Composition of functions
2= f(3x)Substitute g(x) = 3x
3= 2(3x) − 5Substitute into f(x) = 2x − 5
4= 6x − 5Simplify
[f ∘ g](x) = 6x − 5

Part A continued: [g ∘ f](x)

1[g ∘ f](x) = g[f(x)]Composition of functions
2= g(2x − 5)Substitute f(x) = 2x − 5
3= 3(2x − 5)Substitute into g(x) = 3x
4= 6x − 15Simplify
[g ∘ f](x) = 6x − 15

Part B: domain and range

ℹ Both results are linear with nonzero slope, so D = {all real numbers} and R = {all real numbers} for both compositions.
⚠ 6x − 5 ≠ 6x − 15. This is direct evidence that f ∘ g and g ∘ f are generally different functions.
BOX OFFICE: A theatre charges $8.50 for each of the x tickets sold. The studios take 75% of the money earned on ticket sales t(x), so the theatre keeps 25%. If the amount kept is k(x), which composition represents the total amount the theatre keeps?
1t(x) = 8.50xTotal money earned on ticket sales
2k(x) = 0.25xThe theatre keeps 25% of an amount x
3Total sales happen first, then the splitThe output of t becomes the input of k
4[k ∘ t](x) = k[t(x)]Composition of functions
5= k(8.50x) = 0.25(8.50x)Substitute
6= 2.125xSimplify
[k ∘ t](x) = 2.125x  — the theatre keeps $2.125 per ticket
⚠ Watch the order. [t ∘ k](x) = 8.50(0.25x) = 2.125x gives the same number here only because both functions are simple multipliers. In general, choose the order that matches the real sequence of events.
Chris and Tobias are finding (f ∘ g)(x) where f(x) = x² + 2x − 8 and g(x) = x² + 8. Who is correct?

Chris (incorrect)

(f ∘ g)(x) = (x² + 8)² + 2x − 8
= x⁴ + 16x² + 64 + 2x − 8
= x⁴ + 16x² + 2x + 56

Tobias (correct)

(f ∘ g)(x) = (x² + 8)² + 2(x² + 8) − 8
= x⁴ + 16x² + 64 + 2x² + 16 − 8
= x⁴ + 18x² + 72
1[f ∘ g](x) = f[g(x)]Composition of functions
2Replace EVERY x in f with g(x)Both the x² term and the 2x term
3= (x² + 8)² + 2(x² + 8) − 8Substitute
4= x⁴ + 16x² + 64 + 2x² + 16 − 8Expand
5= x⁴ + 18x² + 72Combine like terms
Tobias is correct: (f ∘ g)(x) = x⁴ + 18x² + 72
⚠ Substitute into every x. Chris replaced only the squared term and left 2x untouched. In a composition, every occurrence of x in the outer function must be replaced.

Try It Yourself

Use f(x) = x² − 1 and g(x) = 2x + 3 unless a problem says otherwise. Work each one out before revealing.

Problem 1

Find (f + g)(x) and (f − g)(x).
1(f + g)(x) = (x² − 1) + (2x + 3)Add the two rules
2= x² + 2x + 2Combine like terms
3(f − g)(x) = (x² − 1) − (2x + 3)Subtract — keep the bracket
4= x² − 2x − 4Distribute the minus to both terms
(f + g)(x) = x² + 2x + 2 and (f − g)(x) = x² − 2x − 4
Order matters for subtraction: (g − f)(x) = −x² + 2x + 4, which is not the same function. Read carefully which one is being subtracted.

Problem 2

Find (f · g)(x) and state (f/g)(x) with its restriction.
1(f · g)(x) = (x² − 1)(2x + 3)Multiply the rules
2= 2x³ + 3x² − 2x − 3Expand all six products and collect
3(f/g)(x) = (x² − 1)/(2x + 3)Divide the rules
42x + 3 = 0 → x = −3/2Exclude wherever the denominator is zero
(f · g)(x) = 2x³ + 3x² − 2x − 3;  (f/g)(x) = (x² − 1)/(2x + 3), x ≠ −3/2
State the restriction even if nothing cancels. A quotient of functions is undefined wherever the bottom function is zero, and that exclusion is part of the answer.

Problem 3

Find [f ∘ g](2) and [g ∘ f](2).
1g(2) = 2(2) + 3 = 7For f ∘ g the inner function g goes first
2f(7) = 49 − 1 = 48Feed that output into f
3f(2) = 4 − 1 = 3For g ∘ f the inner function f goes first
4g(3) = 2(3) + 3 = 9Feed that output into g
[f ∘ g](2) = 48 and [g ∘ f](2) = 9
Very different answers from the same starting number — exactly the point of Figure 1. Work strictly inside out.

Problem 4

Find [f ∘ g](x) as a simplified expression.
1[f ∘ g](x) = f(2x + 3)Replace the input of f with the whole of g(x)
2= (2x + 3)² − 1Wherever f had x, put (2x + 3) — brackets are essential
3= 4x² + 12x + 9 − 1Expand the square in full
[f ∘ g](x) = 4x² + 12x + 8
Check against Problem 3: at x = 2 this gives 16 + 24 + 8 = 48 ✓, matching the step-by-step value. Substituting a number is the fastest way to catch a composition slip.

Problem 5

If p(x) = 1/x and q(x) = x − 5, find [p ∘ q](x) and its domain.
1[p ∘ q](x) = p(x − 5) = 1/(x − 5)q runs first, and its output becomes p's input
2p rejects an input of 0So q(x) must not be 0
3x − 5 ≠ 0 → x ≠ 5Exclude that value
[p ∘ q](x) = 1/(x − 5), domain: all real x except x = 5
Same logic as Figure 2: the restriction comes from what the outer function refuses, applied to the inner function's output.

Problem 6

Given f(x) = x² − 1 and g(x) = 2x + 3, is there any value of x where [f ∘ g](x) = [g ∘ f](x)?
1[f ∘ g](x) = 4x² + 12x + 8From Problem 4
2[g ∘ f](x) = 2(x² − 1) + 3 = 2x² + 1Substitute f into g this time
34x² + 12x + 8 = 2x² + 1Set them equal
42x² + 12x + 7 = 0Collect on one side
5x = (−12 ± √(144 − 56)) / 4 = (−6 ± √22)/2Quadratic formula, then simplify √88 = 2√22
Yes, at x = (−6 ± √22)/2 ≈ −0.65 and −5.35
Not commutative does not mean never equal. The two compositions are different functions, but different functions can still agree at particular points — here at two of them.

Summary & Common Mistakes

📝 Quick Reference

You are asked forWhat to doWatch for
(f + g)(x)Add and combine like termsLine up matching powers
(f − g)(x)Distribute the negative to every term of gSign errors on the second and later terms
(f · g)(x)Distribute each term of f across each term of gMissing cross terms
(f/g)(x)Write as a quotientExclude x-values where g(x) = 0
[f ∘ g](x)Evaluate g first, substitute into fReplace EVERY x in f
[g ∘ f](x)Evaluate f first, substitute into gUsually different from f ∘ g
Domain of a compositionStart with the domain of the inner functionRemove x whose output leaves the outer domain

⚠ Common Mistakes to Avoid

⚠ Forgetting to distribute the minus sign. (f − g)(x) requires subtracting all of g(x), not just its first term.
⚠ Assuming f ∘ g = g ∘ f. With f(x) = 2x − 5 and g(x) = 3x you get 6x − 5 versus 6x − 15. Order changes the answer.
⚠ Substituting into only one x. If f(x) = x² + 2x − 8, then f[g(x)] replaces both the x² and the 2x.
⚠ Losing the division restriction. Even if a factor cancels, the original zero of the denominator stays excluded.
⚠ Keeping pairs that are undefined. With ordered pairs, if an output of the inner function is not in the domain of the outer function, that x is simply not in the composition.

Practice Quiz

15 questions · click an answer to check it instantly

0/15

๐Ÿ“ Test your understanding