edubun
English

What is a function

Each number from 1 to 5 paired with its double gives five pairs, from (1, 2) to (5, 10). Because every input gets exactly one output, the pairing is a function.

A vending machine where each button drops one drink

Picture a vending machine by a school canteen. This one is made up. Press button 1 and a can of cider drops. Button 2 gives orange juice. Button 3 also gives cider, and nobody minds: two buttons can share a drink. Now imagine button 1 giving cider on Monday and water on Tuesday, with nothing else changed. You could no longer say what button 1 does. That is the line a function draws. Each input, here a button, has to lead to exactly one output, here a drink.

Ordered pairs: inputs first, outputs second

Many quantities depend on others. A child's weight changes with age; the altitude of a plane changes with the distance it has flown. OpenStax starts from the idea of a relation, which is simply a set of ordered pairs. In the pairs (1, 2), (2, 4), (3, 6), (4, 8) and (5, 10), the first numbers are the inputs and the second numbers the outputs. The set of inputs, {1, 2, 3, 4, 5}, is the domain, and the set of outputs, {2, 4, 6, 8, 10}, is the range. Inputs are also called the independent variable, usually x, and outputs the dependent variable, usually y.

A function is a relation in which each input leads to exactly one output. The doubling relation qualifies: 3 goes to 6 and nowhere else. Now pair the words odd and even with the numbers 1 to 5: (odd, 1), (even, 2), (odd, 3), (even, 4), (odd, 5). Here the input odd leads to three different outputs, 1, 3 and 5, so this relation is not a function. Note what the rule does not forbid. Two inputs may share an output; in a price list, two drinks can both cost the same, and price is still a function of the item.

A function: each input on the left has exactly one arrow leaving it.

f(4) means: put 4 in for x

We name functions with letters and write f(x), read "f of x", for the output of f at the input x. It does not mean f times x. If f(x) = 3x − 2, then f(4) means: replace x by 4 and work it out, 3 × 4 − 2 = 10. The pair (4, 10) is on the graph of f. You can also go the other way: to find which input gives f(x) = 13, solve 3x − 2 = 13, so x = 5. Think of a function as a machine with a rule printed on its side. A number goes in, the rule acts on it and one number comes out.

The input 4 goes into f and the output f(4) = 10 comes out.

A vertical line through a circle meets it twice

On a graph, an input is a position on the x-axis and its outputs are the heights of the graph above or below it. So a quick test is to sweep a vertical line across the picture. If some vertical line crosses the graph more than once, that x has more than one output and the graph is not a function. A parabola passes; a circle fails, because a vertical line through its middle meets it at the top and the bottom. The graph of x = y² − 2, a parabola lying on its side, fails as well.

A second test, with a horizontal line, asks a different question. If every horizontal line crosses a function's graph at most once, then each output comes from only one input and the function is called one-to-one. The line y = 2x − 1 is one-to-one; y = x² − 3 is not, because 1 and −1 both give −2. One-to-one functions matter in the last unit, because they are exactly the ones that can be run backwards. In the lab, pick a curve, drag the vertical line and switch on the horizontal line test.

Loading

Drag to turn. Scroll or pinch to zoom.

The circle x² + y² = 16 with a vertical line at x = 1: two crossings, so it is not a function of x. Switch to the parabola or the cubic and the line never crosses twice.
BackgroundThe word function entered mathematics slowly. MacTutor records Leibniz writing in August 1673 about lines that "perform some function" in a figure, in the everyday sense of the word. Johann Bernoulli, in a letter of 2 September 1694, described a function as a quantity formed from variable and constant quantities. Euler made the idea central in his Introductio in analysin infinitorum of 1748 and in 1755 gave a much wider definition: if some quantities depend on others so that changing the latter changes the former, the former are functions of the latter. In 1837 Dirichlet went further and accepted rules with no formula at all, such as the one that gives 0 for every rational number and 1 for every irrational one. The textbook sentence "to a value of x corresponds a value of y, written y = f(x)" is close to the one Goursat gave in 1923.
  1. Is {(1, 2), (2, 4), (3, 6)} a function?
    • Yes
    • No
  2. Is {(odd, 1), (even, 2), (odd, 3)} a function?
    • No
    • Yes
  3. If f(x) = 3x − 2, what is f(4)?
  4. If f(x) = x² + 1, what is f(−3)?
  5. Which graph fails the vertical line test?
    • x² + y² = 16
    • y = x² − 3
    • y = 2x − 1
    • y = |x| − 2
  6. Is y a function of x for x = y²?
    • No
    • Yes
  7. If f(x) = 2x + 5, which x gives f(x) = 11?
  8. If f(x) = x², what is f(2) + f(3)?
  9. Which function is one-to-one?
    • y = 2x − 1
    • y = x² − 3
    • y = |x| − 2
    • y = 5
  10. In which book did Euler, in 1748, make the function concept central?
    • Introductio in analysin infinitorum
    • La Géométrie
    • Ars Magna
    • Liber embadorum
FunctionA relation where each input has exactly one output
DomainThe set of inputs
RangeThe set of outputs
Vertical line testCrosses twice anywhere: not a function
One-to-oneEach output comes from one input
Common mistakes
  • Reading f(0) as f × 0 = 0 for f(x) = 3x − 2. f(0) is the output when 0 goes in: 3 × 0 − 2 = −2. Nothing is multiplied by f.
  • Deciding that {(1, 5), (2, 5), (3, 7)} is not a function because 5 appears twice. It is a function. The rule only forbids one input with two outputs. Inputs 1 and 2 may both go to 5, like two vending machine buttons that give the same cider.
  • Writing f(2 + 1) = f(2) + f(1) for f(x) = x². Work out the input first. f(3) = 9, but f(2) + f(1) = 4 + 1 = 5.
  • Calling y = x² − 3 "not a function" because a horizontal line meets it twice. The horizontal line test checks one-to-one, not function. Every vertical line meets y = x² − 3 once, so it is a function. It just is not one-to-one.
Teacher's noteStart with arrow diagrams and lists of pairs, not formulas. A student who meets functions as formulas first tends to stall on the odd and even example, where there is nothing to substitute. Ask one question over and over: for this input, how many outputs? Bring in f(x) only after that question feels routine. For the first few problems have students say "f of 4" aloud. Keep the vertical and horizontal line tests apart on the board, with what each one decides written next to it.
Key points
  • A function gives each input exactly one output.
  • f(x) is the output at x; it is not f times x.
  • Vertical line test: crossing twice means not a function.
  • Horizontal line test: crossing at most once means one-to-one.
Sources for this course (8)
  • Curriculum: 교육부 고시 제2022-33호 [별책 8] 수학과 교육과정 (ncic.re.kr/inv/org/download.do?year=2022&seq=10003559&orgType=ogi4, PDF read 2026-10-19: 중학교 1~3학년군 [9수02-06] 그래프 해석(증가와 감소), [9수02-14] 함수의 개념·함숫값, 용어 함수·함숫값·기울기·평행이동, 고려 사항 「한 양이 변함에 따라 다른 양이 하나씩 정해지는 두 양 사이의 대응 관계를 이용하여 도입」; 고등학교 공통수학2 [10공수2-01-06] 평행이동, [10공수2-01-07] 원점·x축·y축·직선 y = x에 대한 대칭이동, [10공수2-03-01] 함수의 개념(두 집합 사이의 대응 관계), [10공수2-03-02] 합성함수, [10공수2-03-03] 역함수, 용어 정의역·치역·공역·대응·일대일대응·일대일함수·합성함수·역함수, 기호 f: X → Y, g ∘ f, (g ∘ f)(x), y = g(f(x)), f⁻¹, y = f⁻¹(x), 교수·학습 용어 조건제시법; 미적분Ⅰ 용어 구간·닫힌구간·열린구간 [a, b], (a, b), 평균변화율, [12미적Ⅰ-02-07] 증가와 감소, 극댓값·극솟값)
  • Textbook: OpenStax, College Algebra 2e, 3.1 Functions and Function Notation (relation, domain and range of ordered pairs, {(1, 2), (2, 4), (3, 6), (4, 8), (5, 10)}, the odd/even relation that is not a function, coffee menu prices, vertical line test, horizontal line test, one-to-one: openstax.org/books/college-algebra-2e/pages/3-1-functions-and-function-notation)
  • Textbook: OpenStax, College Algebra 2e, 3.2 Domain and Range (no even root of a negative number, no division by 0, interval notation with brackets and parentheses, (0, 100] for "more than 0 and at most $100", {(2, 10), (3, 10), (4, 20), (5, 30), (6, 40)}: .../pages/3-2-domain-and-range)
  • Textbook: OpenStax, College Algebra 2e, 3.3 Rates of Change and Behavior of Graphs (average rate of change, increasing and decreasing intervals, local maxima and minima: .../pages/3-3-rates-of-change-and-behavior-of-graphs)
  • Textbook: OpenStax, College Algebra 2e, 3.4 Composition of Functions (f(g(x)); f(x) = 2x + 1 and g(x) = 3 − x give f(g(x)) = 7 − 2x and g(f(x)) = −2x + 2, so composition is not commutative; c(s) calories and s(t) sit-ups; f(x) = 1/x and g(x) = x − 3: .../pages/3-4-composition-of-functions)
  • Textbook: OpenStax, College Algebra 2e, 3.5 Transformation of Functions (g(x) = f(x) + k vertical shift, f(x − h) horizontal shift, −f(x) and f(−x) reflections, af(x) stretches and compressions, roof vent example S(t) = V(t) + 20 (open vent area in square feet plus 20): .../pages/3-5-transformation-of-functions)
  • Textbook: OpenStax, College Algebra 2e, 3.7 Inverse Functions (f⁻¹ is not an exponent and not 1/f, C = (5/9)(F − 32), 75 °F is about 24 °C, 26 °C is about 79 °F, x² restricted to [0, ∞), reflection about y = x: .../pages/3-7-inverse-functions)
  • History block only: MacTutor, University of St Andrews, The function concept (Leibniz, August 1673, the word "function"; Johann Bernoulli's letter of 2 September 1694; Euler, Introductio in analysin infinitorum 1748 and Institutiones calculi differentialis 1755; Dirichlet 1837; Goursat 1923 "y = f(x)": mathshistory.st-andrews.ac.uk/HistTopics/Functions)

Checked: 2026-10-18