Applying One Function After Another
A store applies the same discount and fixed price reduction in two different orders:
- Promo A: discount, then another deduction of .
- Promo B: Price reduction of , then a discount.
Do both promotions produce the same final price? We can answer this by writing each operation as a function and composing the two functions in the stated order.
Definition of Function Composition
Function composition is the sequential combination of two or more functions to produce a new function.
If we have a function and a function , then their composition, written as , is a new function that maps directly from the domain to the codomain .
This means we apply function first, and then we input its result into function .
Mathematically, this is written as:
The composite is defined only for inputs in the domain of whose output lies in the domain of :
Promo Calculation
Calculate the final price for an item worth . This simplified example ignores taxes, minimum-purchase rules, and price floors so that only the order of the two operations changes.
Let be the initial price of the item.
- discount function:
- reduction function:
Now compose these two functions according to the promo sequence:
-
Promo A (Discount first, then price reduction): We are looking for
For :
So, the final price with Promo A is .
-
Promo B (Price reduction first, then discount): We are looking for
For :
So, the final price with Promo B is .
For this item, Promo A () gives a final price of , while Promo B () gives . Reversing the order changes the result, so in general .
Comparing Both Orders of Composition
Suppose we have two functions:
Determine and .
Solution:
-
Finding :
Substitute in with :
So, .
-
Finding :
Substitute in with :
So, .
Because , function composition is not commutative.
The Domain Must Follow the Order
Composition is not the same as multiplying two functions, and its domain cannot be found by looking only at the final formula. Let
Then
The input must satisfy and . Therefore,
This check explains why values between and are excluded: they make the expression under the square root negative.