Skip to main content

Functions

A function is one of the most powerful ideas in all of mathematics: a reliable machine that takes an input, does something definite to it, and hands back exactly one output. Feed it the same input tomorrow and you get the same answer. That reliability is what lets us describe how one quantity depends on another — how a car's distance depends on time, how a phone bill depends on data used, how the area of a circle depends on its radius.

Once you learn to see the world in terms of functions, algebra stops being a bag of tricks and becomes a language for describing relationships. This page will build the idea carefully — from the plain-English "rule" to the precise definition, the f(x)f(x) notation, domain and range, how to read graphs, and how to bend and slide graphs with transformations.

Learning Objectives

By the end of this page, you should be able to:

  • Define a function as an input-output relation with exactly one output per input.
  • Use function notation f(x)f(x) fluently: evaluate, substitute, and interpret it.
  • Find the domain and range of a function from a formula or a graph.
  • Apply the vertical line test to decide whether a graph represents a function.
  • Read information off a graph (intercepts, values, where it increases or decreases).
  • Predict how shifts, stretches, and reflections change a graph and its equation.

Quick Answer

A function is a rule that assigns to each input exactly one output. We usually write it f(x)f(x), read "f of x," where xx is the input and f(x)f(x) is the resulting output. The set of allowed inputs is the domain; the set of outputs actually produced is the range. The defining condition — one output per input — is what the vertical line test checks on a graph: if any vertical line crosses the graph more than once, it is not a function. Simple changes to a formula move its graph in predictable ways: f(x)+kf(x)+k shifts it up, f(xh)f(x-h) shifts it right, and a factor in front stretches it. Master these and you can understand almost any curve you meet.

Where It Came From

The word "function" was born from a very practical need: calculus. In the late 1600s, Gottfried Wilhelm Leibniz was studying curves and needed a word for quantities that changed along with a moving point — the length of a tangent, the slope, the area swept out. Around 1673 he used functio (Latin for "performance" or "carrying out") to name such varying quantities. At that stage a "function" was tied to geometry, not yet a clean abstract rule.

The person who turned it into an everyday tool was Leonhard Euler. In the 1700s Euler introduced the notation f(x)f(x) and treated a function as an analytic expression — a formula built from a variable using arithmetic, powers, roots, logarithms, and so on. This is the intuition most students start with: "a function is a formula." Euler's notation was so convenient that physics and engineering adopted functions as the native language for describing motion, heat, and forces.

But a crisis arrived in the early 1800s. Studying how heat spreads, Joseph Fourier claimed that even jagged, discontinuous shapes could be built from sums of sine waves. That forced mathematicians to ask: does a function have to be a single tidy formula? In 1837 Peter Gustav Lejeune Dirichlet gave the answer we still use today. A function, he said, is simply any rule that pairs each input with exactly one output — no formula required. His famous example assigns 1 1 to every rational number and 0 0 to every irrational number, a "function" impossible to draw yet perfectly well-defined.

This is the deep point: the modern definition was not invented for elegance but forced into existence by the needs of calculus and physics. We needed a concept general enough to include wild objects, and precise enough to reason about. That is exactly what "one input, one output" delivers.

The Core Idea: One Input, One Output

Picture a vending machine. You press B4 and you always get the same snack. You never press one button and receive two different snacks depending on the machine's mood. That "always the same result for the same button" property is the function property.

Formally, a function ff from a set AA (the domain) to a set BB assigns to each element xx in AA exactly one element f(x)f(x) in BB. Two things can go wrong and disqualify a relation from being a function:

  • An input produces no output (the machine jams for that button) — then that input simply is not in the domain.
  • An input produces two outputs (one button, two different snacks) — this is fatal; it is not a function at all.

Note the rule is not symmetric. Two different inputs are allowed to share the same output. In f(x)=x2f(x) = x^2, both x=3x = 3 and x=3x = -3 give 9 9. That is fine — many buttons may dispense the same snack. What is forbidden is one button giving two snacks.

Worked example — testing a relation. Consider the set of pairs {(1,4),(2,5),(3,6),(1,7)}\{(1, 4), (2, 5), (3, 6), (1, 7)\}, written as (input, output). Is this a function?

Look at the input 1 1. It appears twice, paired once with 4 4 and once with 7 7. One input, two outputs — so this is not a function. If we deleted the pair (1,7)(1,7), the remaining set {(1,4),(2,5),(3,6)}\{(1,4),(2,5),(3,6)\} would be a function, because every input now has a single output.

Function Notation, Evaluation, and Domain and Range

The notation f(x)f(x) names three things at once: the function (ff), the input (xx), and the output (the whole symbol f(x)f(x)). Crucially, f(x)f(x) does not mean ff multiplied by xx; it means "the value ff produces from xx."

To evaluate, substitute the input everywhere xx appears.

Worked example — evaluating. Let f(x)=2x23x+1f(x) = 2x^2 - 3x + 1.

f(4)=2(4)23(4)+1=2(16)12+1=3212+1=21.f(4) = 2(4)^2 - 3(4) + 1 = 2(16) - 12 + 1 = 32 - 12 + 1 = 21.

You can substitute expressions too:

f(a+1)=2(a+1)23(a+1)+1=2(a2+2a+1)3a3+1=2a2+a.f(a+1) = 2(a+1)^2 - 3(a+1) + 1 = 2(a^2 + 2a + 1) - 3a - 3 + 1 = 2a^2 + a.

Let me check that middle step: 2(a2+2a+1)=2a2+4a+2 2(a^2+2a+1) = 2a^2 + 4a + 2, then 3a3+1-3a - 3 + 1 gives 3a2-3a - 2. Adding: 2a2+(4a3a)+(22)=2a2+a 2a^2 + (4a - 3a) + (2 - 2) = 2a^2 + a. Correct.

Domain is the set of legal inputs; range is the set of outputs you actually get. When a formula is given without extra context, we take the domain to be every real number for which the formula makes sense. Two operations commonly break:

  • Division by zero — the denominator may not be 0 0.
  • Even roots of negatives — the inside of a square root must be 0\ge 0 (over the real numbers).

Worked example — finding a domain. Find the domain of g(x)=x2x5g(x) = \dfrac{\sqrt{x-2}}{x-5}.

The square root needs x20x - 2 \ge 0, so x2x \ge 2. The denominator needs x50x - 5 \ne 0, so x5x \ne 5. Combining: the domain is all xx with x2x \ge 2 except x=5x = 5. In interval form, [2,5)(5,)[2, 5) \cup (5, \infty).

Worked example — finding a range. Find the range of f(x)=x2+3f(x) = x^2 + 3. Since x20x^2 \ge 0 for every real xx, the smallest value of x2x^2 is 0 0 (at x=0x = 0), giving f(0)=3f(0) = 3. As xx moves away from 0 0, x2x^2 grows without bound. So the outputs are all numbers 3\ge 3; the range is [3,)[3, \infty).

Reading Graphs and the Vertical Line Test

A graph of ff is the picture of all pairs (x,f(x))(x, f(x)). Because a function has one output per input, no vertical line can hit the graph twice — every xx gets one height. This gives us the vertical line test: if you can draw a vertical line that crosses a curve at two or more points, the curve is not the graph of a function.

Worked example — the circle. The circle x2+y2=25x^2 + y^2 = 25 is not a function of xx. At x=3x = 3 the equation gives y2=16y^2 = 16, so y=4y = 4 and y=4y = -4. A vertical line at x=3x = 3 hits the circle at (3,4)(3, 4) and (3,4)(3, -4) — two outputs, test failed. The upper half alone, y=25x2y = \sqrt{25 - x^2}, is a function, because we chose the single non-negative output.

Reading a graph, you can extract a lot without any formula:

  • Value at a point: to find f(2)f(2), go to x=2x = 2 on the horizontal axis, move up or down to the curve, and read the height.
  • Zeros / x-intercepts: where the curve crosses the x-axis, f(x)=0f(x) = 0.
  • y-intercept: the height at x=0x = 0, i.e. f(0)f(0).
  • Increasing / decreasing: where the curve rises left-to-right the function is increasing; where it falls it is decreasing.

Worked example — reading values. Suppose a graph passes through (0,1)(0, 1), (2,0)(2, 0), and (4,3)(4, 3), rising after x=2x = 2. Then f(0)=1f(0) = 1 (the y-intercept), x=2x = 2 is a zero because f(2)=0f(2) = 0, and the function is increasing on the interval from x=2x = 2 to x=4x = 4 since the height climbs from 0 0 to 3 3.

Transformations: Shifting, Stretching, Reflecting

Once you know the graph of a basic function, you can produce whole families of related graphs by simple edits to the formula. Let f(x)f(x) be the original. Here are the moves (with k,h>0k, h > 0):

Change to formulaEffect on graphDirection
f(x)+kf(x) + kvertical shiftup by kk
f(x)kf(x) - kvertical shiftdown by kk
f(xh)f(x - h)horizontal shiftright by hh
f(x+h)f(x + h)horizontal shiftleft by hh
af(x)a \cdot f(x), a>1a > 1vertical stretchtaller by factor aa
af(x)a \cdot f(x), 0<a<1 0 < a < 1vertical compressionshorter
f(x)-f(x)reflectionacross the x-axis
f(x)f(-x)reflectionacross the y-axis

The one that trips everyone up is horizontal shifts: f(xh)f(x - h) moves right, even though it looks like subtraction. The reason: to get the same output the original had at input 0 0, you now need xh=0x - h = 0, i.e. x=hx = h — the feature has moved to the right.

Worked example — building a parabola. Start with f(x)=x2f(x) = x^2, whose vertex is at the origin. Consider g(x)=2(x3)2+1g(x) = 2(x - 3)^2 + 1. Read it as three edits to x2x^2: replace xx by x3x - 3 (shift right 3 3), multiply by 2 2 (stretch vertically, twice as steep), then add 1 1 (shift up 1 1). The vertex moves from (0,0)(0, 0) to (3,1)(3, 1).

Check with a point. At x=4x = 4: g(4)=2(43)2+1=2(1)+1=3g(4) = 2(4 - 3)^2 + 1 = 2(1) + 1 = 3. That is the point (4,3)(4, 3), which sits 1 1 unit right of the vertex and 2 2 units up — exactly what a right-shift-by-3, stretch-by-2, up-by-1 predicts (on the parent, one unit right of the vertex rises 1 1; doubled gives 2 2). Consistent.

Real-World Applications

  • Physics — motion: Position as a function of time, s(t)s(t), is the backbone of kinematics. Its rate of change (a derivative) is velocity — the very problem that made Leibniz coin the word.
  • Economics — cost and revenue: A cost function C(q)C(q) gives total cost for producing qq units; profit is revenue minus cost, another function. Finding where profit is largest is an optimization of a function.
  • Medicine — drug dosing: Concentration of a drug in the blood is a function of time, often decaying exponentially. Domain restrictions matter: negative time is meaningless.
  • Computing: Every function you write in code (f(x)) is this exact idea — deterministic input to output. "Pure functions" in programming are literally mathematical functions.
  • Everyday life: Currency conversion, a taxi's fare as a function of distance, or the temperature reading as a function of the time of day are all functions you use without naming them.

Common Mistakes

  1. Thinking f(x)f(x) means ff times xx. It does not. f(x)f(x) is a single quantity, the output of ff at xx. Writing f(a+b)=f(a)+f(b)f(a+b) = f(a) + f(b) is usually wrong: for f(x)=x2f(x) = x^2, f(1+1)=4f(1+1) = 4 but f(1)+f(1)=2f(1) + f(1) = 2. Always substitute the whole input into the formula.

  2. Confusing "one input, one output" with "one output, one input." Functions forbid one input giving two outputs, but they happily allow two inputs sharing one output. f(x)=x2f(x) = x^2 sends both 2 2 and 2-2 to 4 4, and it is still a perfectly good function. Do not reject it.

  3. Shifting horizontally the wrong way. Students read f(x3)f(x - 3) and shift left because of the minus sign. It shifts right. Anchor yourself with a point: the feature that was at x=0x = 0 now needs x3=0x - 3 = 0, so it lives at x=3x = 3 — to the right.

  4. Forgetting to restrict the domain. With g(x)=1x5g(x) = \tfrac{1}{x-5} people happily plug in x=5x = 5 and get nonsense. Always scan for division by zero and even roots of negatives before declaring the domain "all reals."

Comparison and Connections

ConceptWhat it isFunction?
FunctionEach input has exactly one outputYes, by definition
RelationAny set of input-output pairsNot always
EquationA statement two expressions are equalSometimes defines a function
ExpressionA formula with no equals sign, e.g. 2x+1 2x+1Becomes a function when named f(x)f(x)

A relation is the broader idea: any pairing of inputs and outputs. Every function is a relation, but not every relation is a function — the circle x2+y2=25x^2 + y^2 = 25 is a relation that fails the vertical line test. An equation like y=3x+2y = 3x + 2 often defines a function (here f(x)=3x+2f(x) = 3x + 2), but an equation like x2+y2=25x^2 + y^2 = 25 does not define yy as a single function of xx. Functions connect forward to composition and inverses, and they are the object that calculus differentiates and integrates.

Practice Questions

Recall

State the defining property of a function in one sentence, and say what "domain" means.

Answer: A function assigns to each input exactly one output. The domain is the set of all allowed inputs.

Understanding

Is {(0,1),(1,2),(2,1),(0,3)}\{(0, 1), (1, 2), (2, 1), (0, 3)\} a function? Explain.

Answer: No. The input 0 0 is paired with both 1 1 and 3 3 — one input, two outputs — so it fails the definition. (The fact that 0 0 and 2 2 share the output 1 1 is fine and irrelevant.)

Application

For f(x)=x+2x29f(x) = \dfrac{x+2}{x^2 - 9}, find the domain and compute f(1)f(1).

Answer: The denominator x29=(x3)(x+3)x^2 - 9 = (x-3)(x+3) is zero at x=3x = 3 and x=3x = -3, so the domain is all reals except ±3\pm 3. Then f(1)=1+219=38=38f(1) = \dfrac{1+2}{1-9} = \dfrac{3}{-8} = -\dfrac{3}{8}.

Analysis

The graph of f(x)=x2f(x) = x^2 is transformed into h(x)=12(x+4)2h(x) = -\tfrac{1}{2}(x + 4)^2. Describe every transformation and give the vertex.

Answer: Replace xx by x+4x + 4: shift left 4 4. Multiply by 12\tfrac{1}{2}: vertical compression (flatter). The minus sign: reflect across the x-axis (opens downward). The vertex moves from (0,0)(0, 0) to (4,0)(-4, 0). Check: h(4)=12(0)2=0h(-4) = -\tfrac{1}{2}(0)^2 = 0, confirming the vertex at (4,0)(-4, 0).

FAQ

Is every equation a function? No. An equation defines a function only if solving for yy gives exactly one yy for each xx. y=2x+1y = 2x + 1 does; x2+y2=25x^2 + y^2 = 25 does not, because it gives two yy-values for many xx.

Can a function have two inputs give the same output? Yes, absolutely. That is allowed and common — f(x)=x2f(x) = x^2 sends 3 3 and 3-3 both to 9 9. The only forbidden thing is one input giving two outputs.

What is the difference between range and codomain? The codomain is the set we declare the outputs live in (say, all real numbers). The range is the set of outputs actually achieved. The range is always inside the codomain, and may be smaller — f(x)=x2f(x) = x^2 has codomain R\mathbb{R} but range [0,)[0, \infty).

Why do horizontal shifts go the "wrong" way? Because the input is transformed, not the output. To reproduce the value the graph had at input 0 0, you now need xh=0x - h = 0, forcing x=hx = h — so features slide right. It feels backwards because we are compensating for a change inside the function.

Does a function have to be given by a formula? No — that was the whole point of Dirichlet's definition. A function is any rule pairing each input with one output. It can be a formula, a graph, a table, or even a verbal rule like "round xx to the nearest integer."

How do I quickly tell if a graph is a function? Use the vertical line test: imagine sweeping a vertical line across the graph. If it ever touches the curve at two points at once, it is not a function.

Quick Revision

  • Function: each input → exactly one output. One input, two outputs = not a function.
  • Notation: f(x)f(x) is the output at xx, not multiplication.
  • Evaluate: substitute the whole input everywhere xx appears.
  • Domain: legal inputs. Watch for division by zero and even roots of negatives.
  • Range: the outputs actually produced.
  • Vertical line test: a vertical line hitting the graph twice ⇒ not a function.
  • Transformations: f(x)+kf(x)+k up; f(xh)f(x-h) right; af(x)a f(x) stretch; f(x)-f(x) flip over x-axis; f(x)f(-x) flip over y-axis.
  • History: Leibniz named it (~1673), Euler gave f(x)f(x), Dirichlet (1837) defined the modern "any rule" version.

Prerequisites

Next Topics