A rule with one output
A function assigns exactly one output to every input in its domain. With , the input 3 produces 6; the input produces . Different inputs can share an output: sends both 2 and to 4. That still counts as a function.
Write to say that accepts real inputs and returns real outputs. The set after the arrow is the codomain. The outputs actually reached form the range. For with real inputs, the range is even if we choose as the codomain.
Connect two simple rules
Let double a number and let square a number. Connect the output of to the input of :
Follow the input
First double the input. Then square the result. Does changing the order matter?
Preparing interactive controls…
The composite function is written . Read it as “f after g.” Evaluate the inside first:
Changing the order usually changes the answer:
For , those outputs are 16 and 8. Composition is an instruction sequence, not ordinary multiplication of function names.
Ask where a function makes sense
A formula comes with a domain. The real-valued square root needs . A reciprocal excludes zero. The natural logarithm needs . Composing functions means checking the intermediate output too: requires .
A function may accept several numbers. For example,
could be the cost of notebooks and pens, at 2 dollars and 3 dollars each. This function has a pair as its input and one number as its output.
Reversing a rule
An inverse recovers the input from the output. The inverse of is . The superscript here means inverse function, not reciprocal.
Squaring on all of has no inverse function: from the output 4, you cannot tell whether the input was 2 or . Restrict the input to and the principal square root becomes an inverse.
Make a prediction
Let g(x) = x + 1 and f(x) = x². What is f(g(3))?
An ML connection
A prediction pipeline is a sequence of transformations. You might first rescale an input, then compute a score, then map that score to a prediction. Understanding the order now will make the chain rule easier later.