Try This First
Try this short activity before reading the lesson.
> Take $f(x) = x^2$ and $g(x) = x - 3$. On paper, work out $f(g(5))$ and $g(f(5))$. They are not the same number. Then try to find one input where they are equal.
Math Lab: Function machines — order matters
Predict first. Let $f(x)=x^2$ and $g(x)=x+1$. Will squaring then adding 1 match adding 1 then squaring?
<div class="math-model"><p><strong>Machine A: g(f(2)) = 5</strong></p><div class="model-bar"><span class="model-cell">Input 2</span><span class="model-cell">Square: 4</span><span class="model-cell">Add 1: 5</span></div><p class="model-caption">Machine B: 2 → add 1 → 3 → square → 9.</p></div>
Model and solve. $g(f(x))=x^2+1$, while $f(g(x))=(x+1)^2$. At $x=2$, the outputs are 5 and 9. The order changes the function.
Spot the bug / explain. Why does $(x+1)^2=x^2+1$ fail? Expand and identify the missing term.
Your turn. At which real input do these two compositions have the same output?
Check after trying. $x^2+1=x^2+2x+1$ gives $x=0$.
The Big Idea
A function is a rule, and this topic is about reading the rule itself rather than one output at a time. Where is the rule allowed to run (domain)? What can it produce (range)? Does it climb or fall on a stretch of inputs? Is it symmetric?
Two functions can be chained: $f \circ g$ means "do $g$ first, then $f$". The chain runs only where $g$ runs and $g$'s output is legal for $f$. That second check is the whole difficulty of composition. An inverse is the rule run backwards, and it exists only when the forward rule never sends two inputs to one output.
Everything here comes back in calculus. The average rate of change is a slope over an interval, and the derivative will be that slope over a shrinking interval.
In brief. A function read before it is computed with: domain, range, even and odd symmetry, where it rises and falls, and its average rate of change. Piecewise rules, composition $f\circ g$ with its domain found from $g$ first, and inverses verified by composing.
Words to Know
- domain: Every input the rule accepts. Square roots need a non-negative inside; fractions need a non-zero bottom.
- even, odd: Even: $f(-x) = f(x)$, mirror in the $y$-axis. Odd: $f(-x) = -f(x)$, half-turn about the origin. Most functions are neither.
- composition: $(f \circ g)(x) = f(g(x))$. The inner function runs first.
- average rate of change: $\frac{f(b) - f(a)}{b - a}$: the slope of the line through two points of the graph.
Formulas and Theorems
- Average rate of change: $\frac{f(b)-f(a)}{b-a}$
- Note: The slope of the secant line through $(a,f(a))$ and $(b,f(b))$.
- Composition: $(f\circ g)(x)=f(g(x))$
- Note: Its domain is every $x$ in the domain of $g$ whose output $g(x)$ is in the domain of $f$.
- Inverse check: $f(f^{-1}(x))=x \text{ and } f^{-1}(f(x))=x$
- Note: Both compositions must give $x$ back.
Worked Examples and Your Turn
Study each example, then try the paired problem.
Example 1: Domain from the rule alone
Problem: Find the domain of $h(x) = \dfrac{\sqrt{5 - x}}{x + 3}$.
Solution:
- Inside the root: $5 - x \ge 0$, so $x \le 5$. Why: a square root of a negative number is not a real number.
- Bottom of the fraction: $x + 3 \ne 0$, so $x \ne -3$. Why: division by zero is undefined.
- Combine both: $x \le 5$ and $x \ne -3$. Why: an input must pass every test at once.
Answer: $(-\infty, -3) \cup (-3, 5]$
> Verification & Check: Test $x = 0$: $\frac{\sqrt5}{3}$, fine. Test $x = 6$: root of $-1$, excluded. Test $x = -3$: bottom is zero, excluded.
Your Turn 1: Domain of $k(x) = \dfrac{x}{\sqrt{x - 2}}$.
Example 2: Odd or even, by algebra
Problem: Decide whether $f(x) = \dfrac{x^3}{x^2 + 1}$ is even, odd, or neither.
Solution:
- Replace $x$ by $-x$: $f(-x) = \dfrac{(-x)^3}{(-x)^2 + 1} = \dfrac{-x^3}{x^2 + 1}$. Why: the definition is about $f(-x)$ for every $x$, so substitute symbolically.
- Compare with $f(x)$: $f(-x) = -f(x)$. Why: the top flipped sign and the bottom did not, so the whole thing flipped.
Answer: Odd.
> Notice: Plugging in one number, say $x = 2$, can show a function is not even or odd. It can never show that it is. Only the algebra covers every $x$.
Your Turn 2: Even, odd, or neither: $g(x) = x^4 - 2x^2 + 7$?
Example 3: Average rate of change on an interval
Problem: Let $f(x) = 2^x$. Find the average rate of change from $x = 1$ to $x = 4$.
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 380 270" width="380" height="270" role="img" aria-label="Graph of y = 2 to the x from about x = −0.6 to 4.2. Points (1, 2) and (4, 16) are marked on the curve and joined by a red secant line. A dashed right triangle under the secant shows a run of 3 and a rise of 14, so the secant slope, the average rate of change, is 14/3."><rect x="0" y="0" width="380" height="270" fill="#ffffff"/><line x1="36.0" y1="187.2" x2="370.0" y2="187.2" stroke="#c9c9c4" stroke-width="0.8" stroke-dasharray="3 3"/><line x1="36.0" y1="138.9" x2="370.0" y2="138.9" stroke="#c9c9c4" stroke-width="0.8" stroke-dasharray="3 3"/><line x1="36.0" y1="90.5" x2="370.0" y2="90.5" stroke="#c9c9c4" stroke-width="0.8" stroke-dasharray="3 3"/><line x1="36.0" y1="42.2" x2="370.0" y2="42.2" stroke="#c9c9c4" stroke-width="0.8" stroke-dasharray="3 3"/><line x1="36.0" y1="235.5" x2="370.0" y2="235.5" stroke="#333" stroke-width="1.5"/><line x1="73.1" y1="250.0" x2="73.1" y2="12.0" stroke="#333" stroke-width="1.5"/><text x="368.0" y="228.5" font-family="Source Sans 3" font-size="12" fill="#333" text-anchor="end">x</text><text x="80.1" y="22.0" font-family="Source Sans 3" font-size="12" fill="#333">y</text><line x1="135.0" y1="232.5" x2="135.0" y2="238.5" stroke="#333"/><text x="135.0" y="251.5" font-family="Source Sans 3" font-size="12" fill="#333" text-anchor="middle">1</text><line x1="196.8" y1="232.5" x2="196.8" y2="238.5" stroke="#333"/><text x="196.8" y="251.5" font-family="Source Sans 3" font-size="12" fill="#333" text-anchor="middle">2</text><line x1="258.7" y1="232.5" x2="258.7" y2="238.5" stroke="#333"/><text x="258.7" y="251.5" font-family="Source Sans 3" font-size="12" fill="#333" text-anchor="middle">3</text><line x1="320.5" y1="232.5" x2="320.5" y2="238.5" stroke="#333"/><text x="320.5" y="251.5" font-family="Source Sans 3" font-size="12" fill="#333" text-anchor="middle">4</text><line x1="70.1" y1="187.2" x2="76.1" y2="187.2" stroke="#333"/><text x="67.1" y="191.2" font-family="Source Sans 3" font-size="12" fill="#333" text-anchor="end">4</text><line x1="70.1" y1="138.9" x2="76.1" y2="138.9" stroke="#333"/><text x="67.1" y="142.9" font-family="Source Sans 3" font-size="12" fill="#333" text-anchor="end">8</text><line x1="70.1" y1="90.5" x2="76.1" y2="90.5" stroke="#333"/><text x="67.1" y="94.5" font-family="Source Sans 3" font-size="12" fill="#333" text-anchor="end">12</text><line x1="70.1" y1="42.2" x2="76.1" y2="42.2" stroke="#333"/><text x="67.1" y="46.2" font-family="Source Sans 3" font-size="12" fill="#333" text-anchor="end">16</text><polyline points="36.0,227.5 36.7,227.5 37.5,227.4 38.2,227.3 39.0,227.3 39.7,227.2 40.5,227.1 41.2,227.1 41.9,227.0 42.7,226.9 43.4,226.8 44.2,226.8 44.9,226.7 45.6,226.6 46.4,226.5 47.1,226.5 47.9,226.4 48.6,226.3 49.4,226.2 50.1,226.2 50.8,226.1 51.6,226.0 52.3,225.9 53.1,225.9 53.8,225.8 54.6,225.7 55.3,225.6 56.0,225.5 56.8,225.4 57.5,225.4 58.3,225.3 59.0,225.2 59.8,225.1 60.5,225.0 61.2,224.9 62.0,224.8 62.7,224.7 63.5,224.7 64.2,224.6 64.9,224.5 65.7,224.4 66.4,224.3 67.2,224.2 67.9,224.1 68.7,224.0 69.4,223.9 70.1,223.8 70.9,223.7 71.6,223.6 72.4,223.5 73.1,223.4 73.9,223.3 74.6,223.2 75.3,223.1 76.1,223.0 76.8,222.9 77.6,222.8 78.3,222.7 79.0,222.6 79.8,222.5 80.5,222.4 81.3,222.3 82.0,222.2 82.8,222.0 83.5,221.9 84.2,221.8 85.0,221.7 85.7,221.6 86.5,221.5 87.2,221.4 88.0,221.2 88.7,221.1 89.4,221.0 90.2,220.9 90.9,220.8 91.7,220.6 92.4,220.5 93.2,220.4 93.9,220.3 94.6,220.1 95.4,220.0 96.1,219.9 96.9,219.7 97.6,219.6 98.3,219.5 99.1,219.3 99.8,219.2 100.6,219.1 101.3,218.9 102.1,218.8 102.8,218.7 103.5,218.5 104.3,218.4 105.0,218.2 105.8,218.1 106.5,217.9 107.3,217.8 108.0,217.6 108.7,217.5 109.5,217.3 110.2,217.2 111.0,217.0 111.7,216.9 112.4,216.7 113.2,216.6 113.9,216.4 114.7,216.3 115.4,216.1 116.2,215.9 116.9,215.8 117.6,215.6 118.4,215.4 119.1,215.3 119.9,215.1 120.6,214.9 121.4,214.8 122.1,214.6 122.8,214.4 123.6,214.2 124.3,214.1 125.1,213.9 125.8,213.7 126.6,213.5 127.3,213.3 128.0,213.1 128.8,213.0 129.5,212.8 130.3,212.6 131.0,212.4 131.7,212.2 132.5,212.0 133.2,211.8 134.0,211.6 134.7,211.4 135.5,211.2 136.2,211.0 136.9,210.8 137.7,210.6 138.4,210.4 139.2,210.2 139.9,210.0 140.7,209.7 141.4,209.5 142.1,209.3 142.9,209.1 143.6,208.9 144.4,208.7 145.1,208.4 145.8,208.2 146.6,208.0 147.3,207.7 148.1,207.5 148.8,207.3 149.6,207.0 150.3,206.8 151.0,206.6 151.8,206.3 152.5,206.1 153.3,205.8 154.0,205.6 154.8,205.3 155.5,205.1 156.2,204.8 157.0,204.6 157.7,204.3 158.5,204.1 159.2,203.8 160.0,203.5 160.7,203.3 161.4,203.0 162.2,202.7 162.9,202.4 163.7,202.2 164.4,201.9 165.1,201.6 165.9,201.3 166.6,201.0 167.4,200.8 168.1,200.5 168.9,200.2 169.6,199.9 170.3,199.6 171.1,199.3 171.8,199.0 172.6,198.7 173.3,198.4 174.1,198.1 174.8,197.7 175.5,197.4 176.3,197.1 177.0,196.8 177.8,196.5 178.5,196.1 179.2,195.8 180.0,195.5 180.7,195.1 181.5,194.8 182.2,194.5 183.0,194.1 183.7,193.8 184.4,193.4 185.2,193.1 185.9,192.7 186.7,192.4 187.4,192.0 188.2,191.6 188.9,191.3 189.6,190.9 190.4,190.5 191.1,190.2 191.9,189.8 192.6,189.4 193.4,189.0 194.1,188.6 194.8,188.2 195.6,187.8 196.3,187.4 197.1,187.0 197.8,186.6 198.5,186.2 199.3,185.8 200.0,185.4 200.8,185.0 201.5,184.6 202.3,184.1 203.0,183.7 203.7,183.3 204.5,182.8 205.2,182.4 206.0,182.0 206.7,181.5 207.5,181.1 208.2,180.6 208.9,180.1 209.7,179.7 210.4,179.2 211.2,178.7 211.9,178.3 212.6,177.8 213.4,177.3 214.1,176.8 214.9,176.3 215.6,175.8 216.4,175.3 217.1,174.8 217.8,174.3 218.6,173.8 219.3,173.3 220.1,172.8 220.8,172.3 221.6,171.7 222.3,171.2 223.0,170.7 223.8,170.1 224.5,169.6 225.3,169.0 226.0,168.5 226.8,167.9 227.5,167.4 228.2,166.8 229.0,166.2 229.7,165.6 230.5,165.0 231.2,164.5 231.9,163.9 232.7,163.3 233.4,162.7 234.2,162.1 234.9,161.4 235.7,160.8 236.4,160.2 237.1,159.6 237.9,158.9 238.6,158.3 239.4,157.6 240.1,157.0 240.9,156.3 241.6,155.7 242.3,155.0 243.1,154.3 243.8,153.7 244.6,153.0 245.3,152.3 246.0,151.6 246.8,150.9 247.5,150.2 248.3,149.5 249.0,148.8 249.8,148.0 250.5,147.3 251.2,146.6 252.0,145.8 252.7,145.1 253.5,144.3 254.2,143.6 255.0,142.8 255.7,142.0 256.4,141.2 257.2,140.4 257.9,139.7 258.7,138.9 259.4,138.0 260.2,137.2 260.9,136.4 261.6,135.6 262.4,134.7 263.1,133.9 263.9,133.1 264.6,132.2 265.3,131.3 266.1,130.5 266.8,129.6 267.6,128.7 268.3,127.8 269.1,126.9 269.8,126.0 270.5,125.1 271.3,124.2 272.0,123.2 272.8,122.3 273.5,121.4 274.3,120.4 275.0,119.4 275.7,118.5 276.5,117.5 277.2,116.5 278.0,115.5 278.7,114.5 279.4,113.5 280.2,112.5 280.9,111.5 281.7,110.4 282.4,109.4 283.2,108.3 283.9,107.3 284.6,106.2 285.4,105.1 286.1,104.0 286.9,102.9 287.6,101.8 288.4,100.7 289.1,99.6 289.8,98.4 290.6,97.3 291.3,96.1 292.1,95.0 292.8,93.8 293.6,92.6 294.3,91.4 295.0,90.2 295.8,89.0 296.5,87.8 297.3,86.6 298.0,85.3 298.7,84.1 299.5,82.8 300.2,81.5 301.0,80.2 301.7,78.9 302.5,77.6 303.2,76.3 303.9,75.0 304.7,73.6 305.4,72.3 306.2,70.9 306.9,69.5 307.7,68.2 308.4,66.8 309.1,65.3 309.9,63.9 310.6,62.5 311.4,61.0 312.1,59.6 312.8,58.1 313.6,56.6 314.3,55.1 315.1,53.6 315.8,52.1 316.6,50.6 317.3,49.0 318.0,47.5 318.8,45.9 319.5,44.3 320.3,42.7 321.0,41.1 321.8,39.5 322.5,37.9 323.2,36.2 324.0,34.6 324.7,32.9 325.5,31.2 326.2,29.5 327.0,27.8 327.7,26.0 328.4,24.3 329.2,22.5 329.9,20.7 330.7,18.9 331.4,17.1 332.1,15.3 332.9,13.5" fill="none" stroke="#1f5f8b" stroke-width="2"/><line x1="107.1" y1="236.7" x2="342.2" y2="22.5" stroke="#b5452c" stroke-width="2"/><line x1="135.0" y1="211.3" x2="320.5" y2="211.3" stroke="#333" stroke-width="1.2" stroke-dasharray="4 3"/><line x1="320.5" y1="211.3" x2="320.5" y2="42.2" stroke="#333" stroke-width="1.2" stroke-dasharray="4 3"/><text x="227.7" y="228.3" font-family="Source Sans 3" font-size="12" fill="#333" text-anchor="middle">run = 3</text><text x="325.5" y="126.8" font-family="Source Sans 3" font-size="12" fill="#333">rise = 14</text><circle cx="135.0" cy="211.3" r="3.6" fill="#333"/><circle cx="320.5" cy="42.2" r="3.6" fill="#333"/><text x="131.9" y="196.8" font-family="Source Sans 3" font-size="12" fill="#333" text-anchor="end">(1, 2)</text><text x="314.3" y="31.3" font-family="Source Sans 3" font-size="12" fill="#333" text-anchor="end">(4, 16)</text><text x="51.5" y="78.4" font-family="Source Sans 3" font-size="12" fill="#b5452c">secant slope = 14/3</text><text x="215.4" y="194.4" font-family="Source Sans 3" font-size="12" fill="#1f5f8b">y = 2ˣ</text></svg>
Solution:
- Compute the two outputs: $f(1) = 2$, $f(4) = 16$. Why: the rate needs the rise, and the rise needs both endpoints.
- Divide rise by run: $\dfrac{16 - 2}{4 - 1} = \dfrac{14}{3}$. Why: average rate of change is the slope of the secant line through the two points.
Answer: $\dfrac{14}{3}$
> Verification & Check: On $[1, 2]$ the rate is $\frac{4 - 2}{1} = 2$; on $[3, 4]$ it is $8$. A rate of $\frac{14}{3} \approx 4.7$ sits between them, as it should.
Your Turn 3: Average rate of change of $g(x) = x^2 + x$ from $x = 2$ to $x = 5$.
Example 4: The domain of a composition (the trap)
Problem: Let $f(x) = \sqrt{x}$ and $g(x) = \dfrac{1}{x - 2}$. Find the domain of $f \circ g$.
The chapter continues in the book.