Operations on Functions and Composition

Sum, difference, product and quotient combine functions pointwise over the intersection of their domains. Composition is different — it feeds one function into another, and f∘g is generally not the same as g∘f.

--
Operations on Functions and Composition — Moosa Academy

Two functions can be combined in two very different ways. The four arithmetic operations — add, subtract, multiply, divide — work pointwise and stay forgiving about domain. Composition feeds one function's output into another, and here the order you combine them in changes everything.

Concept The four basic operations
Operation Rule Domain
Sum (f + g)(x) = f(x) + g(x) domain(f) ∩ domain(g)
Difference (f − g)(x) = f(x) − g(x) domain(f) ∩ domain(g)
Product (f · g)(x) = f(x) · g(x) domain(f) ∩ domain(g)
Quotient (f / g)(x) = f(x) / g(x) domain(f) ∩ domain(g), excluding g(x) = 0

In every case the domain of the combined function is the intersection of the two original domains — a value has to be legal for both f and g before it can be legal for the combination. The quotient adds one more restriction: wherever g(x) = 0, division fails, so that point is removed even if it was fine for both functions individually.

Concept Function composition

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

Composition feeds the entire output of one function into another as its input. To evaluate  f(g(x)) , first compute  g(x) , then substitute that whole result everywhere an  x appears in  f .

 g acts on  x first — it is the inner function.
 f acts on the result — it is the outer function.

Crucially,  f \circ g and  g \circ f are generally different functions. Composition is not commutative, so the order in which you apply the two functions matters as much as the functions themselves.

Example Finding f(g(x))

Let  f(x) = x^2 and  g(x) = x + 3 . Find  f(g(x)) .

Write the outer function as it is:  f(\square) = \square^2 .
Substitute  g(x) for the box:  f(g(x)) = (x + 3)^2 .
Expand:  (x+3)^2 = x^2 + 6x + 9 .
⟹ f(g(x)) = x² + 6x + 9
Example Finding g(f(x)) — same functions, reversed order

Using the same  f(x) = x^2 and  g(x) = x + 3 , find  g(f(x)) .

Now  f is inner,  g is outer:  g(\square) = \square + 3 .
Substitute  f(x) for the box:  g(f(x)) = x^2 + 3 .
⟹ g(f(x)) = x² + 3

Compare the two results:  x^2 + 6x + 9 versus  x^2 + 3 . Reversing the order produced a completely different expression — exactly the reason composition needs careful attention to which function sits outside.

Note Steps for composing any two functions
  1. Identify which function is outer and which is inner.
  2. Write the outer function's rule exactly as given.
  3. Replace every occurrence of the variable in the outer function with the entire inner function.
  4. Simplify — expand brackets and collect like terms.

The most common mistake is substituting the inner function into only part of the outer one, instead of every single  x . Treat the inner function as one indivisible block, and replace all copies of the variable with that block.

Summary
  1. Sum, difference, and product all use domain(f) ∩ domain(g); the quotient also excludes points where g(x) = 0.
  2. f(g(x)) means: compute g(x) first, then substitute that entire result into f.
  3. In general f ∘ g ≠ g ∘ f — composition is not commutative, so order matters.
  4. The most common error is replacing only some occurrences of x in the outer function instead of all of them.