Think of a function as a machine. You feed it an input (say, a number x), it does something, and out comes an output f(x). Now imagine you have two such machines, f and g. Function operations are simply ways to hook these machines together — to add, subtract, multiply, or divide their outputs, or to feed one machine's output into the other.
The core idea is simple: if you can do arithmetic with numbers, you can do arithmetic with functions. The only catch is that both functions must be "ready to work" on the same input at the same time.
The Four Arithmetic Operations
Let f and g be two functions. For any input x that belongs to both their domains (the set of numbers each can accept), we define:
Operation
Notation
What it means
Sum
(f+g)(x)
f(x)+g(x)
Difference
(f−g)(x)
f(x)−g(x)
Product
(f⋅g)(x)
f(x)⋅g(x)
Quotient
(gf)(x)
g(x)f(x), provided g(x)=0
Note
The domain of the new function is the intersection of the domains of f and g — the numbers both machines can handle. For the quotient, you must also exclude any x where g(x)=0, because division by zero is undefined.
Example. Let f(x)=x (domain: x≥0) and g(x)=x−1 (domain: all real numbers). Then:
(f+g)(x)=x+x−1, domain: x≥0.
(gf)(x)=x−1x, domain: x≥0andx=1.
Composition: Feeding One Machine into Another
This is the most powerful operation. Instead of adding outputs side by side, you take the output of one function and feed it as the input to the other.
(f∘g)(x)=f(g(x))
Read "f composed with g". You do g first, then f on the result.
Intuition. Suppose g is a machine that converts Celsius to Fahrenheit, and f is a machine that converts Fahrenheit to Kelvin. Then f∘g converts Celsius directly to Kelvin — one combined machine.
Domain trap. For f(g(x)) to make sense, two conditions must hold:
x must be in the domain of g (so g(x) exists).
g(x) must be in the domain of f (so f can accept it).
So the domain of f∘g is: all x in the domain of g such that g(x) is in the domain of f.
Watch out
Composition is not commutative. f∘g is almost never the same as g∘f. For example, if f(x)=x2 and g(x)=x+1, then: