Beautiful Math
Path

Algebra · Lesson 3

Functions as machines

A function is a reliable machine: each allowed input gets exactly one output. That single rule is how models, formulas, and graphs stay coherent.

Core ~27 minDeep study ~78 minWhat makes something a function?What is composition?

Before this: Equations as relationships

How this idea was born

People needed reliable rules long before they had the modern word "function." Convert temperature. Price by weight. Tax by bracket. Given this input, you want exactly one sensible output, every time, so the rule can be reused, shared, and chained with other rules.
Leonhard Euler wrote mathematics the way a generous teacher speaks: clearly, abundantly, and with notation that sticks. Popularizing the habit of writing something like f(x) was not vanity. It was a tool so relationships could be named, composed, and reused. MacTutor's biography is the safe door. The ethic: invent language that makes hard ideas handleable, then use it everywhere.
For a modern rereader, this chapter is where algebra stops being only about solving for an unknown and starts being about building machines. An equation asks "when is this true?" A function says "given this input, here is the output, every time." Functions add the promise of reliability.

First principles

A function ff from a set of inputs (the domain) to outputs assigns exactly one output f(x)f(x) to each allowed xx.
xff(x)
A function assigns exactly one output to each allowed input.
If one input could yield two different outputs, it is not a function. The vertical-line test on a graph encodes the same idea: a vertical line should meet the graph at most once if yy is a function of xx.
Domain matters. x\sqrt{x} on the reals needs x0x \ge 0. A pricing formula may only accept nonnegative quantities. Specifying the domain is part of specifying the machine.
The range is the set of outputs actually produced as xx runs through the domain. Domain is "what you may feed in." Range is "what can come out."
Examples:
  • f(x)=2x+1f(x) = 2x + 1 (linear; domain often all reals unless context restricts)
  • g(x)=x2g(x) = x^2 (each xx still has one square; many different xx can share an output)
  • Piecewise rules (tax brackets) are still functions if each allowed input lands in exactly one piece
Algebrica's functions entry defines domain, range, and notation with clear diagrams. Use it when you want a second pass on vocabulary.

Worked intuition

Decisive maps

The vertical-line test is a cartoon of the definition: if a single xx tried to claim two yy values, the machine would be indecisive. Functions are decisive. That decisiveness is what lets you compose safely.
Function or not?
| Rule | Function? | Why | |------|-----------|-----| | f(x)=x2f(x) = x^2 | Yes | Each input has one square | | "Square root of xx" on reals | Yes (if we mean the principal root x0\sqrt{x} \ge 0) | Convention picks one output | | Circle x2+y2=1x^2 + y^2 = 1 as yy of xx | No | One xx can give two yy values | | Table: 131 \to 3, 252 \to 5, 353 \to 5 | Yes | Each input appears once with one output |

Composition

(fg)(x)=f(g(x))(f \circ g)(x) = f(g(x)): feed xx into gg, then feed that result into ff. Order usually matters. Converting units twice in a row is composition. So is "discount then tax" versus "tax then discount."
Composition worked example:
Let f(x)=2x+1f(x) = 2x + 1 and g(x)=x2g(x) = x^2.
  • (fg)(3)=f(g(3))=f(9)=19(f \circ g)(3) = f(g(3)) = f(9) = 19
  • (gf)(3)=g(f(3))=g(7)=49(g \circ f)(3) = g(f(3)) = g(7) = 49
Same inputs, different order, different machines.

Piecewise functions

Tax brackets are the classic piecewise machine:
T(x)={0.10xif 0x10,0001000+0.20(x10,000)if x>10,000T(x) = \begin{cases} 0.10x & \text{if } 0 \le x \le 10{,}000 \\ 1000 + 0.20(x - 10{,}000) & \text{if } x > 10{,}000 \end{cases}
Each allowed income xx falls in exactly one bracket, so TT is a function. The rule changes, but decisiveness does not.

Invertibility (when it exists)

Unit conversion C=59(F32)C = \frac{5}{9}(F - 32) is a function from Fahrenheit to Celsius. It is invertible here, so you can undo it. Squaring is a function on the reals, but it is not invertible on all reals without restricting the domain, because many inputs share an output.
Thinking "can I undo this?" is already advanced functional thinking, even before formal inverse notation.
To find an inverse, swap input and output roles and solve. If C=59(F32)C = \frac{5}{9}(F - 32), then F=95C+32F = \frac{9}{5}C + 32. The inverse machine runs backward. Check: compose forward then backward and you should return to where you started.

Evaluating and checking

If h(x)=3x2h(x) = 3x - 2, then h(5)=13h(5) = 13 and h(1)=5h(-1) = -5. Evaluation is not solving. You are applying the machine, not asking when the output equals something.
If someone asks "solve h(x)=10h(x) = 10," you are finding inputs that produce output 10: 3x2=103x - 2 = 10, so x=4x = 4. Function evaluation and equation solving meet at that question, but they start from different directions.
Quick check: For f(x)=2x+1f(x) = 2x + 1, does f(3)=7f(3) = 7? Substitute: 2(3)+1=72(3) + 1 = 7. Yes. Evaluation is one substitution away from verification.
That habit (substitute, compare) is the same checking instinct from the equations chapter, now applied to machines.

Why this is the gateway to models

A formula is a function. A spreadsheet column computed from another is a function. A trained predictor y^=fw(x)\hat{y} = f_w(x) is a function whose internal knobs ww we choose.
Euler's f(x)f(x) notation makes that reusable: name the machine, then apply it.

Common confusions

Confusing "many inputs, one output" with "not a function." g(x)=x2g(x) = x^2 sends both 22 and 2-2 to 44. That is fine. The ban is the opposite: one input must not fork into two outputs.
Thinking vertical lines are functions of xx. A vertical line has one xx and many yy values. It fails the definition as a function y=f(x)y = f(x).
Ignoring domain. Writing x\sqrt{x} without context hides whether you mean reals or complexes. In school algebra, assume reals unless told otherwise, and state restrictions.
Assuming composition is commutative. fgf \circ g and gfg \circ f are different machines in general. Try f(x)=x+1f(x) = x + 1 and g(x)=2xg(x) = 2x.
Treating functions as only formulas. Tables, graphs, and algorithms can define functions. The essence is the unique-output rule, not the presence of an algebraic expression.
Confusing f(x)f(x) with fxf \cdot x. The parentheses mean "apply ff to xx," not multiplication. Context matters, but in function notation, f(x)f(x) is almost always application.
Mixing up range and codomain. The codomain is the set you declare outputs live in. The range is what actually appears. For f(x)=x2f(x) = x^2 on the reals, the range is [0,)[0, \infty) even if you casually say "outputs are real numbers."
Treating f(a+b)f(a + b) as f(a)+f(b)f(a) + f(b). In general, f(a+b)f(a)+f(b)f(a + b) \neq f(a) + f(b). Try f(x)=x2f(x) = x^2: f(2+3)=25f(2 + 3) = 25 but f(2)+f(3)=4+9=13f(2) + f(3) = 4 + 9 = 13. Only special functions (linear ones) distribute over addition.

History and stories

Leonhard Euler (1707-1783) wrote mathematics the way a generous teacher speaks: clearly, abundantly, and with notation that sticks. MacTutor and standard histories credit him with popularizing f(x)f(x) notation. That was not vanity. It was language so relationships could be named, composed, and reused.
Before compact function notation, people described processes in words. Naming the machine lets you say "apply ff again" or "compose with gg" without re-explaining. Notation revolutions matter emotionally: they shrink the distance between having an idea and sharing it.
Do not treat "Euler invented functions" as a slogan. The concept of correspondence is older; the portable notation and Euler's prolific clarity helped make the modern habit stick.

Real world

  • Temperature converters and currency converters: fixed rules, one input, one output.
  • Pricing formulas and piecewise tax brackets: the rule may change by interval, but each input still lands in exactly one interval.
  • Spreadsheet columns that depend on other columns: =A2*1.08 is a function of A2.
  • Physical laws written as F=maF = ma style rules (force as a function of mass and acceleration, in context).
  • GPS distance estimates: input two coordinates, output a distance via a formula (great-circle or flat-earth approximation).
Anywhere you plug in and trust a determined output, you are using a function, whether or not someone wrote f(x)f(x).
Curiosity question: Is "tip = 18% of bill" a function of the bill amount? What is the domain in a real restaurant (negative bills? zero bill?)?
Checking a real-world function: If Celsius C=59(F32)C = \frac{5}{9}(F - 32), verify that F=32F = 32 gives C=0C = 0 (freezing) and F=212F = 212 gives C=100C = 100 (boiling). The machine should match known anchor points.

Open when you want the machine-learning connection. Skip freely.

Field notes, extra examples, and glossary live here when you want more than the core path.

Carry this forward

  • One allowed input, exactly one output.
  • Composition builds complexity from simple maps.
  • Domain is part of the definition.
  • Check whether a rule is a function before you compose or invert it.
  • Next: seeing functions as graphs in the plane.

Read more

Go deeper when curiosity hits - videos, essays, and primary trails.

Check your understanding

A short learning loop - try a few, learn from misses, mark complete when you have engaged. No timer, no scoreboard.

1.A function assigns…
2.Vertical-line test fails when…
3.Power Tools (Strogatz): functions…
4.Composition f∘g means…
5.Euler's f(x) notation mattered because…

Try at least 3 core prompts, or choose I'll return later.