Functions and Their Graphs
What a function really is#
A function is a machine with a guarantee: feed it an input from its domain, and it returns exactly one output. Write f(x) = x^2 and you have described infinitely many facts at once — f(3)=9, f(-3)=9, f(\pi)=\pi^2 — all compressed into one rule.
The graph of f is the set of points (x, f(x)): a complete portrait of the function’s behavior. Reading graphs fluently is the single most valuable skill in this book, because a graph converts algebra (hard to feel) into geometry (easy to see).
- Domain: the inputs allowed. For f(x)=\sqrt{x}, the domain is x \ge 0; for f(x) = \frac{1}{x-2}, everything except 2.
- Range: the outputs actually achieved.
- Vertical line test: a curve is the graph of a function exactly when every vertical line meets it at most once — one input, one output.
Straight lines#
The straight line y = mx + c is the simplest function with something to say. The slope m is the exchange rate between y and x: every unit step right raises the graph by m. The intercept c is where the line crosses the y-axis.

Two forms cover every situation:
\begin{aligned}\text{slope–intercept: } y = mx + c \\ \text{point–slope: } y - y_1 = m(x - x_1).\end{aligned}
Given two points, the slope is m = \dfrac{y_2 - y_1}{x_2 - x_1} — rise over run. Parallel lines share slopes; perpendicular lines have slopes multiplying to -1 (each is the other’s negative reciprocal).
Transformations: every graph is an old friend, moved#
Once you know one graph, you know a whole family. For any function f:
| New function | Effect on the graph |
|---|---|
| f(x) + k | slide up by k |
| f(x - h) | slide right by h |
| a\,f(x) | stretch vertically by a (flip if a<0) |
| f(bx) | squash horizontally by b |

The inside-the-brackets moves feel backwards (f(x-2) moves right) — the resolution is that changing the input relabels the x-axis: to get the old value f(0), you must now feed in x = 2.
Combined transformations are read in a definite order, and getting it wrong is the commonest source of a wrong sketch. Take y = -2(x+1)^2 + 3, built from y = x^2:
\begin{aligned}y = x^2 &\longrightarrow (x+1)^2 \\ &\quad \text{inside first: } +1 \text{ shifts left } 1 \text{ — backwards, as always} \\ &\longrightarrow 2(x+1)^2 \\ &\quad \text{stretch vertically by } 2 \\ &\longrightarrow -2(x+1)^2\end{aligned}
the minus flips it upside down
\begin{aligned}&\longrightarrow -2(x+1)^2 + 3 \\ &\quad \text{finally lift } 3\end{aligned}
The result is a downward parabola with vertex (-1, 3). The rule to hold on to: inside the bracket, act first and act backwards; outside the bracket, act last and act as written. Every combined transformation in this book obeys it.
Composition and inverses#
Composition chains machines: (f \circ g)(x) = f(g(x)) — g acts first. Order matters: with f(x)=x^2 and g(x)=x+1, f(g(2)) = 9 but g(f(2)) = 5.
The inverse f^{-1} runs the machine backwards: f^{-1}(y) is the input that produced y. It exists precisely when f never sends two inputs to one output (one-to-one). Graphically, f^{-1} is f reflected across the line y = x — inputs and outputs swap seats. We will meet the most important inverse pair of all, e^x and \ln x, in Chapter 5.
In the wild. “Function” is the load-bearing idea of the modern world. A program’s function
f(input) -> outputis the mathematical concept, verbatim. An entire trained neural network is one function \hat y = f(\vec x;\theta) from inputs to predictions (Part IV makes this precise), and composition — Chapter 3’s f \circ g — is exactly how its layers stack. Domains matter in practice too: feed a function an input outside its domain and you get the software version of \frac{1}{0} — a crash.
If you keep one thing from this chapter: A function is a machine and its graph is the machine’s portrait; every graph you will ever meet is a familiar one, shifted, stretched, or flipped.
Exercises 3
- Find the domain of f(x) = \dfrac{\sqrt{x+3}}{x-1}.
- Find the equation of the line through (2, -1) perpendicular to y = \frac{1}{3}x + 4.
- Sketch y = -2(x+1)^2 + 3 starting from y = x^2, naming each transformation. (Worked in this chapter — close the book and do it from memory first, then compare.)
- If f(x) = 2x + 3, find f^{-1}(x) and verify f(f^{-1}(x)) = x.
- With f(x) = \frac{1}{x} and g(x) = x - 2, find the domain of f \circ g and of g \circ f.