Skip to content
Curriculum / Mathematics · Calculus I · Free sample

Transformations, Compositions, and Building New Functions

Shift, scale, and compose functions — from familiar graphs to the building blocks of financial models.

What this note is about

Pricing a barrier option, seasonally adjusting a commodity price, or applying an activation function in a neural network all involve taking a familiar function and modifying it — shifting its graph, scaling its values, or feeding one function's output into another. This note makes those operations precise. Three mechanisms are covered: graph transformations (shifting, stretching, reflecting), arithmetic combinations (sums, products, quotients), and the composition operator. Knowing how to read a composed function apart — identifying the outer function and the inner function — is the indispensable prerequisite for the chain rule.
Learning objectives. By the end of this note you should be able to:
  • apply the six canonical graph transformations to sketch y=cf(x−a)+by = cf(x-a) + b from a known graph of y=f(x)y = f(x);
  • determine the domains of sums, products, quotients, and compositions of two functions;
  • decompose a given function into outer and inner parts and name both;
  • identify when absolute-value wrapping reflects a function's graph.

Graph transformations

Given the graph of y=f(x)y = f(x), seven canonical transformations produce related graphs. Divide them into two groups.

Translations (shifts)

Proposition 1 (Vertical and horizontal shifts). Let c>0c > 0.
Transformed functionEffect on graph
y=f(x)+cy = f(x) + cshift up by cc
y=f(x)−cy = f(x) - cshift down by cc
y=f(x−c)y = f(x - c)shift right by cc
y=f(x+c)y = f(x + c)shift left by cc
Intuition. To shift the graph right by cc, you must replace xx with x−cx - c in the formula. That is, to achieve the same yy-value, the new xx must be cc units further to the right. The sign is opposite to the direction of shift — this is the most common sign error in transformations.
Example 1 (Shifted parabola). Given y=x2y = x^2, express y=x2+6x+10y = x^2 + 6x + 10 in terms of a shift.
Complete the square: x2+6x+10=(x+3)2+1x^2 + 6x + 10 = (x + 3)^2 + 1. This is y=x2y = x^2 shifted 3 units left and 1 unit up. The vertex moves from (0,0)(0, 0) to (−3,1)(-3, 1).
Graph of y = x² (grey, vertex at origin) and its shift y = (x+3)² + 1 (blue, vertex at (−3,1)), showing the 3-left, 1-up translation
Graph of y = x² (grey, vertex at origin) and its shift y = (x+3)² + 1 (blue, vertex at (−3,1)), showing the 3-left, 1-up translation

Stretches and reflections

Proposition 2 (Vertical and horizontal stretching/reflecting). Let c>1c > 1.
Transformed functionEffect
y=cf(x)y = cf(x)stretch vertically by factor cc
y=(1/c)f(x)y = (1/c)f(x)compress vertically by factor cc
y=f(cx)y = f(cx)compress horizontally by factor cc
y=f(x/c)y = f(x/c)stretch horizontally by factor cc
y=−f(x)y = -f(x)reflect about the xx-axis
y=f(−x)y = f(-x)reflect about the yy-axis
Financial interpretation. A log-return distribution p(x)p(x) can be rescaled to any volatility σ\sigma by the horizontal stretch p(x/σ)/σp(x/\sigma)/\sigma — the standard-deviation rescaling that converts a unit-normal density to a N(0,σ2)N(0, \sigma^2) density. This is precisely the role of the 1/σ1/\sigma Jacobian in a change-of-variables density computation.
Example 2 (Daylight model). Philadelphia's daylight hours as a function of day-of-year tt follow approximately L(t)=12+2.8sin⁡ ⁣(2π365(t−80))L(t) = 12 + 2.8 \sin\!\left(\tfrac{2\pi}{365}(t - 80)\right). Starting from y=sin⁡ty = \sin t: stretch vertically by 2.8, stretch horizontally by 365/(2π)365/(2\pi) (period 365 days instead of 2π2\pi), shift right by 80 days, then shift up by 12. Each transformation has a direct physical meaning: amplitude controls the day-length swing; the horizontal stretch controls the annual period; the right-shift places the minimum on December 21 (day 8080 before the vernal equinox).
Graph of L(t) = 12 + 2.8 sin((2π/365)(t − 80)) over one year, oscillating between about 9.2 and 14.8 hours with the shifted, stretched sine shape
Graph of L(t) = 12 + 2.8 sin((2π/365)(t − 80)) over one year, oscillating between about 9.2 and 14.8 hours with the shifted, stretched sine shape

Absolute value as a reflection

If y=∣f(x)∣y = |f(x)|, the part of the graph of ff that lies below the xx-axis gets reflected above it. The part above stays put.

Example 3. To graph y=∣x2−1∣y = |x^2 - 1|: first draw y=x2−1y = x^2 - 1 (parabola, vertex (0,−1)(0, -1), zeros at ±1\pm 1). The segment between x=−1x = -1 and x=1x = 1 dips below the axis; reflect it up. The result is a "W" shape with vertex at (0,1)(0, 1) and zeros at ±1\pm 1.
Graph of y = x² − 1 (grey, dipping to −1 between the zeros) and y = |x² − 1| (blue), showing the below-axis segment reflected upward into a "W" shape
Graph of y = x² − 1 (grey, dipping to −1 between the zeros) and y = |x² − 1| (blue), showing the below-axis segment reflected upward into a "W" shape

Arithmetic combinations

Given functions ff and gg with domains AA and BB:

Definition 1 (Arithmetic combinations). On the intersection A∩BA \cap B:
(f+g)(x)=f(x)+g(x)(f−g)(x)=f(x)−g(x)(fg)(x)=f(x) g(x)(f/g)(x)=f(x)/g(x),g(x)≠0\begin{aligned} (f + g)(x) &= f(x) + g(x) \\ (f - g)(x) &= f(x) - g(x) \\ (fg)(x) &= f(x)\,g(x) \\ (f/g)(x) &= f(x)/g(x), \quad g(x) \neq 0 \end{aligned}

The domain of f+gf + g, f−gf - g, and fgfg is A∩BA \cap B. The domain of f/gf/g is A∩BA \cap B with all points where g=0g = 0 removed.

Example 4 (Domain of a combination). Let f(x)=xf(x) = \sqrt{x} (domain [0,∞)[0, \infty)) and g(x)=2−xg(x) = \sqrt{2 - x} (domain (−∞,2](-\infty, 2]). Then:
  • (f+g)(x)=x+2−x(f + g)(x) = \sqrt{x} + \sqrt{2-x}, domain [0,2][0, 2].
  • (f/g)(x)=x/2−x(f/g)(x) = \sqrt{x}/\sqrt{2-x}, domain [0,2)[0, 2) (exclude x=2x = 2 where g=0g = 0).

Composition

The most important way to build new functions is by feeding one into another.

Definition 2 (Composition). The composite of ff after gg is
(f∘g)(x)=f(g(x))\boxed{(f \circ g)(x) = f(g(x))}

Domain of f∘gf \circ g: all xx in the domain of gg such that g(x)g(x) is in the domain of ff.

Symbol by symbol: gg acts first (the inner function), producing an intermediate value u=g(x)u = g(x); then ff acts on that value (the outer function), producing the final output f(u)f(u).
Composition flow diagram: input x passes through inner function g to produce g(x), then through outer function f to produce f(g(x)) = (f ∘ g)(x)
Composition flow diagram: input x passes through inner function g to produce g(x), then through outer function f to produce f(g(x)) = (f ∘ g)(x)
Example 5 (Identifying inner and outer). Let h(x)=x2+1h(x) = \sqrt{x^2 + 1}.

Inner function: g(x)=x2+1g(x) = x^2 + 1. Outer function: f(u)=uf(u) = \sqrt{u}. Then h=f∘gh = f \circ g since f(g(x))=x2+1f(g(x)) = \sqrt{x^2 + 1}. Domain: all xx (since x2+1≥1>0x^2 + 1 \geq 1 > 0 for all real xx).

Remark 1 (Order matters). Composition is not commutative. In general f∘g≠g∘ff \circ g \neq g \circ f. For f(x)=xf(x) = \sqrt{x} and g(x)=x+1g(x) = x + 1:

(f∘g)(x)=x+1(f \circ g)(x) = \sqrt{x + 1}, domain [−1,∞)[-1, \infty).
(g∘f)(x)=x+1(g \circ f)(x) = \sqrt{x} + 1, domain [0,∞)[0, \infty).

Different functions with different domains. Never write f∘g=g∘ff \circ g = g \circ f without checking.
Example 6 (Decomposing a finance function). The Black-Scholes d1d_1 formula contains the term ln⁡(S/K)/(sigmaT)\ln(S/K)/(sigma\sqrt{T}). Identify the compositional structure.

Let h=ln⁡(S/K)h = \ln(S/K). This is h=ln⁡∘(⋅/K)h = \ln \circ (\cdot/K): first divide by KK (inner), then take the natural log (outer). The whole fraction d1=[ln⁡(S/K)+(r+σ2/2)T]/(σT)d_1 = [\ln(S/K) + (r + \sigma^2/2)T]/(\sigma\sqrt{T}) is a linear function of ln⁡(S/K)\ln(S/K) — a composition of the logarithm with the ratio S/KS/K and then a linear scaling. Recognising this structure is what allows you to differentiate d1d_1 with respect to SS, σ\sigma, or TT via the chain rule.

Remark 2 (Decomposition is not unique). Most composed functions can be decomposed in more than one way. For h(x)=(x2+1)10h(x) = (x^2 + 1)^{10}, valid choices include: outer f(u)=u10f(u) = u^{10}, inner g(x)=x2+1g(x) = x^2 + 1; or outer f(u)=(u+1)10f(u) = (u+1)^{10}, inner g(x)=x2g(x) = x^2. The convention for the chain rule is to use the most natural outer/inner split — usually the one that reveals the most structure in the expression.

Even and odd functions

Definition 3. A function ff is even if f(−x)=f(x)f(-x) = f(x) for all xx in its domain (graph symmetric about the yy-axis). It is odd if f(−x)=−f(x)f(-x) = -f(x) for all xx (graph symmetric about the origin).

Most functions are neither even nor odd. Polynomials with only even powers are even; polynomials with only odd powers are odd.

Financial connection. Payoff distributions for straddles are symmetric about the current spot — an even payoff around KK. Skewed payoffs (risk reversals, digital puts vs calls) are explicitly odd-symmetric perturbations of a symmetric base.

Where this goes next

Exercises

Exercise 1. Starting from the graph of y=xy = \sqrt{x}, describe in order the transformations needed to obtain y=−2x−3+1y = -2\sqrt{x - 3} + 1. State the domain and range of the result.
Solution. Apply in sequence to y=xy = \sqrt{x}:
  1. Replace xx with x−3x - 3: shift right 3 → y=x−3y = \sqrt{x - 3}, domain [3,∞)[3, \infty).
  2. Multiply by 2: stretch vertically by 2 → y=2x−3y = 2\sqrt{x - 3}, range [0,∞)[0, \infty).
  3. Multiply by −1-1: reflect about the xx-axis → y=−2x−3y = -2\sqrt{x - 3}, range (−∞,0](-\infty, 0].
  4. Add 1: shift up 1 → y=−2x−3+1y = -2\sqrt{x - 3} + 1, range (−∞,1](-\infty, 1].

Domain: [3,∞)[3, \infty); range: (−∞,1](-\infty, 1]. ■\blacksquare


Exercise 2. Find the domain of h(x)=x−1x2−9h(x) = \dfrac{\sqrt{x-1}}{x^2 - 9}.
Solution. Write h=f/gh = f/g where f(x)=x−1f(x) = \sqrt{x - 1} (domain [1,∞)[1, \infty)) and g(x)=x2−9g(x) = x^2 - 9 (domain R\mathbb{R}). The domain of hh is (A∩B)∖{g=0}(A \cap B) \setminus \{g = 0\}.

g(x)=0⇔x=±3g(x) = 0 \Leftrightarrow x = \pm 3. On [1,∞)[1, \infty), the point x=−3x = -3 is already excluded; x=3x = 3 must be removed.

Domain: [1,3)∪(3,∞)[1, 3) \cup (3, \infty). ■\blacksquare


Exercise 3. Let f(x)=1xf(x) = \dfrac{1}{x} and g(x)=x2−1g(x) = x^2 - 1.

(a) Find f∘gf \circ g and its domain.
(b) Find g∘fg \circ f and its domain.
(c) Show f∘g≠g∘ff \circ g \neq g \circ f.

Solution. (a) (f∘g)(x)=f(g(x))=1/(x2−1)(f \circ g)(x) = f(g(x)) = 1/(x^2 - 1). Domain: R∖{±1}\mathbb{R} \setminus \{\pm 1\} (exclude where g=0g = 0, i.e. x=±1x = \pm 1).

(b) (g∘f)(x)=g(f(x))=(1/x)2−1=1/x2−1(g \circ f)(x) = g(f(x)) = (1/x)^2 - 1 = 1/x^2 - 1. Domain: R∖{0}\mathbb{R} \setminus \{0\} (exclude x=0x = 0 where ff is undefined).

(c) Take x=2x = 2: (f∘g)(2)=1/(4−1)=1/3(f \circ g)(2) = 1/(4-1) = 1/3; (g∘f)(2)=1/4−1=−3/4(g \circ f)(2) = 1/4 - 1 = -3/4. Different values, confirming f∘g≠g∘ff \circ g \neq g \circ f. ■\blacksquare


Exercise 4 (Decomposition — finance application). A risk system computes a position's dollar Greeks by the formula
Dollar Delta=Δ⋅S\text{Dollar Delta} = \Delta \cdot S

where Δ=N(d1)\Delta = N(d_1) (the option delta, a function of the log-moneyness m=ln⁡(S/K)m = \ln(S/K)) and SS is the current spot price. Express the dollar delta as a composed function and identify the outer and inner functions when the independent variable is SS.

Solution. Write the dollar delta as H(S)=N(d1(S))⋅SH(S) = N(d_1(S)) \cdot S. This is a product of two functions, not a composition; but each factor involves composition:
  • d1(S)=[ln⁡(S/K)+(r+σ2/2)T]/(σT)d_1(S) = [\ln(S/K) + (r + \sigma^2/2)T]/(\sigma\sqrt{T}): outer is the affine map u↦(u+c1)/c2u \mapsto (u + c_1)/c_2 (where c1,c2c_1, c_2 are constants), inner is ln⁡(⋅/K)\ln(\cdot/K) — itself the logarithm composed with the scaling S↦S/KS \mapsto S/K.
  • N(d1(S))N(d_1(S)): outer is the standard normal CDF NN, inner is d1(S)d_1(S).
Dollar delta =N(d1(S))⋅S= N(d_1(S)) \cdot S is the product of the two composed functions. To differentiate with respect to SS later, the chain rule is applied to each factor. Identifying the composition structure here is precisely what lets us read off the option gamma as ∂Δ/∂S=n(d1)/(SσT)\partial \Delta/\partial S = n(d_1) / (S\sigma\sqrt{T}), where n=N′n = N' is the standard normal density. ■\blacksquare

This is a sample from the full curriculum. Members get every lesson, exercise solution and project.

See membership options

Another free sample