This distinction matters whenever a financial calculation has stages: shares become sale proceeds, proceeds determine a fee, and the fee is then deducted. Combining the stages correctly requires tracking what each function takes in and gives out.
A fee is a function of the sale proceeds
Consider a hypothetical executed sale at a fixed price of USD 50 per share. Allow positive fractional share quantities in this simple model. Let be the number of shares sold and a gross cash amount measured in USD:
The coefficient 50 has units USD per share. The fee rate 0.001 is dimensionless, and the fixed charge is USD 2. This is an illustrative fee schedule, not a broker quote; execution price changes, taxes and other costs are excluded.
The gross-proceeds function converts shares to USD; the fee function converts gross USD to fee USD. Substituting the first result into the second gives
Reversing these functions to breaks their economic meaning: the fee rule expects a USD amount, not a share quantity, while the gross-proceeds rule expects shares, not fee USD. A calculator may still return a number after units are stripped away. That does not make it a valid financial calculation.
Order and domain belong to the definition
Even when both orders are mathematically allowed, they usually differ. With dimensionless inputs, let and . Then , whereas : adding before squaring differs from squaring before adding.
For instance, feeding into the real square-root function gives , defined only for . Checking the inner function alone would miss that restriction.
In the sale model, and describe an executed sale. Extending the algebra to would produce a fee of USD 2 and net proceeds of negative USD 2; that is outside the stated model. A no-trade case needs its own fee rule.
Sources
- James Stewart, Single Variable Calculus: Early Transcendentals, 6th edition, §1.3, “New Functions from Old Functions,” pp. 41–42.
- OpenStax, Calculus Volume 1, §1.1, “Review of Functions”, function composition and domains.