Skip to content

Composite function

Read function composition in the correct order, track domains and units, and separate a sale fee from net proceeds.

A composite function feeds the output of one function into another. Written (f∘g)(x)=f(g(x))(f\circ g)(x)=f(g(x)), it applies the inner function gg first and the outer function ff second. The circle means composition, not multiplication.

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 qq be the number of shares sold and xx a gross cash amount measured in USD:

g(q)=50q,f(x)=0.001x+2.g(q)=50q,\qquad f(x)=0.001x+2.

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 gg converts shares to USD; the fee function ff converts gross USD to fee USD. Substituting the first result into the second gives

(f∘g)(q)=f(50q)=0.001(50q)+2=0.05q+2.(f\circ g)(q)=f(50q)=0.001(50q)+2=0.05q+2.
Selling 20 shares therefore gives gross proceeds of USD 1,000 and a fee of USD 3. The composite function gives the fee, not the net proceeds. Net proceeds require a further subtraction:
n(q)=g(q)−f(g(q))=49.95q−2,n(20)=997 USD.n(q)=g(q)-f(g(q))=49.95q-2,\qquad n(20)=997\text{ USD}.
A synthetic sale maps 20 shares into gross proceeds of USD 1,000 and then a fee of USD 3. A separate subtraction gives net proceeds of USD 997.
A synthetic sale maps 20 shares into gross proceeds of USD 1,000 and then a fee of USD 3. A separate subtraction gives net proceeds of USD 997.
Original synthetic example: composition calculates the fee; subtracting it from gross proceeds calculates the cash received.

Reversing these functions to g(f(q))g(f(q)) 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 a(x)=x2a(x)=x^2 and b(x)=x+2b(x)=x+2. Then a(b(3))=25a(b(3))=25, whereas b(a(3))=11b(a(3))=11: adding before squaring differs from squaring before adding.

A composition also inherits restrictions from both functions. Its domain is
{x∈dom⁡(g):g(x)∈dom⁡(f)}.\{x\in\operatorname{dom}(g):g(x)\in\operatorname{dom}(f)\}.

For instance, feeding x−4x-4 into the real square-root function gives x−4\sqrt{x-4}, defined only for x≥4x\ge4. Checking the inner function alone would miss that restriction.

In the sale model, q>0q>0 and x>0x>0 describe an executed sale. Extending the algebra to q=0q=0 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.

Recognising the inner and outer stages is also the starting point for the chain rule, which calculates how a composite output changes when its original input changes. For more on constructing and decomposing functions, read Transformations, Compositions, and Building New Functions, a free full lesson.

Sources

Last updated
  • functions
  • composition
  • domains
  • units
  • transaction costs
← Back to the glossaryBack to top ↑