FreeMathCamp
Course Articles

Free Math Camp

A free course in the maths you need before calculus. Short lessons, interactive visuals, practice that adapts to you, and a record of progress on your account.

freemathcamp.app

Made by Adam Richard Turner

hello@adamrichardturner.dev

Course

  • Foundations
  • Articles
  • Start free
  • Sign in

Legal

  • Privacy
  • Terms
  • Do not sell or share

Copyright © Adam Richard Turner. All rights reserved.

  1. Articles
  2. /
  3. Graphs & Functions
Graphs & Functions

What Is a Function? Inputs, Outputs, f(x) and the Vertical Line Test

Functions as machines, how to read and evaluate f(x)f(x)f(x) notation, the vertical line test for graphs, and piecewise functions that use different rules on different inputs.

3 min read Supports 4 lessons
In short

A function is a rule that gives exactly one output for each input. Writing f(x)f(x)f(x) means "the output of the function fff when the input is xxx".

Think of a function as a machine. You feed in an input, the machine applies its rule, and out comes exactly one output. "Double it and add 1" is a function: 333 goes in, 777 comes out; −2-2−2 goes in, −3-3−3 comes out.

x  ⟼    2x+1    ⟼  f(x)x \;\longmapsto\; \boxed{\;2x + 1\;} \;\longmapsto\; f(x)x⟼2x+1​⟼f(x)
Key idea

The defining rule: each input has one output. Two inputs may share an output (x2x^2x2 sends both 222 and −2-2−2 to 444), but one input may never produce two outputs.

Function notation

f(x)=2x+1f(x) = 2x + 1f(x)=2x+1 names the function fff and states its rule. f(3)f(3)f(3) is read "fff of 333" and means the output when the input is 333.

Watch out

f(x)f(x)f(x) does not mean fff times xxx. The brackets hold the input.

  1. f(x)=x2−3xf(x) = x^2 - 3xf(x)=x2−3x

    Find f(−2)f(-2)f(−2).

1/4

You can also work backwards. If g(x)=2x+1g(x) = 2x + 1g(x)=2x+1 and g(x)=9g(x) = 9g(x)=9, then 2x+1=92x + 1 = 92x+1=9, so x=4x = 4x=4. And you can feed in expressions: g(a+1)=2(a+1)+1=2a+3g(a + 1) = 2(a + 1) + 1 = 2a + 3g(a+1)=2(a+1)+1=2a+3.

The vertical line test

On a graph, an input is an xxx-value and its output is the height above it. If a vertical line crosses the graph twice, that input has two outputs, so the graph is not a function.

At x=2x = 2x=2 the sideways parabola has two heights, so it fails the test.

Key idea

A graph is a function if every vertical line crosses it at most once.

Piecewise functions

A piecewise function uses different rules on different parts of its domain. Taxi fares, tax bands and phone tariffs often work like this.

f(x)={x+2x<14−xx≥1f(x) = \begin{cases} x + 2 & x < 1 \\ 4 - x & x \ge 1 \end{cases}f(x)={x+24−x​x<1x≥1​

The two pieces meet at (1,3)(1, 3)(1,3), so there is no jump.

Worked example

Using fff above, find f(−2)f(-2)f(−2) and f(3)f(3)f(3).

  1. 1

    −2<1-2 < 1−2<1, so use the first piece: f(−2)=−2+2=0f(-2) = -2 + 2 = 0f(−2)=−2+2=0.

The absolute value function is piecewise in disguise: ∣x∣|x|∣x∣ is xxx when x≥0x \ge 0x≥0 and −x-x−x when x<0x < 0x<0.

Tip

At a boundary, check whether the pieces meet. If they do, the graph joins up there, which is what calculus calls being continuous.

Common questions

What makes something a function?

Each input must have exactly one output. A rule that could give two different answers for the same input is not a function.

What does f(x) mean?

It is the output of the function fff for the input xxx. If f(x)=x2f(x) = x^2f(x)=x2, then f(3)=9f(3) = 9f(3)=9.

Practise functions

The What Is a Function? lesson has worked examples and unlimited practice that adapts to you.

Open the lesson

On this page

  1. Function notation
  2. The vertical line test
  3. Piecewise functions
  4. Common questions
Lessons on this
  • What Is a Function?Functions
  • Function NotationFunctions
  • Piecewise FunctionsFunctions
  • Domain & RangeFunctions
Related reading7
Ideas this article builds on or leads to.
  • Graphs & Functions
    Domain and Range of a Function: How to Find Them

    The domain of a function is the set of inputs it accepts. The range is the set of outputs it actually produces.

  • Graphs & Functions
    Composite and Inverse Functions: f(g(x)) and f⁻¹(x) Explained

    A composite function f(g(x))f(g(x))f(g(x)) feeds the output of ggg into fff. An inverse function f−1f^{-1}f−1 undoes fff: if f(2)=7f(2) = 7f(2)=7, then f−1(7)=2f^{-1}(7) = 2f−1(7)=2.

  • Graphs & Functions
    Transformations of Graphs: Shifts, Stretches and Reflections

    A transformation moves or reshapes a graph. In y=a f(x−h)+ky = a\,f(x - h) + ky=af(x−h)+k, hhh shifts it right, kkk shifts it up, ∣a∣|a|∣a∣ stretches it vertically, and a negative aaa reflects it in the xxx-axis.

  • Graphs & Functions
    The Coordinate Plane: Axes, Quadrants and Plotting Points

    The coordinate plane is a grid made by two perpendicular number lines, the xxx-axis and the yyy-axis. Every point has an address (x,y)(x, y)(x,y): how far across, then how far up.

  • Algebra
    Algebraic Expressions: Variables, Terms, Coefficients and Like Terms

    An expression combines numbers and variables (letters standing for numbers) with operations, like 3x+53x + 53x+5. Like terms have exactly the same variable part and can be combined by adding their coefficients.

  • Number & Arithmetic
    Absolute Value: Distance from Zero, Equations and Inequalities

    The absolute value of a number, written ∣x∣|x|∣x∣, is its distance from zero on the number line. Distances are never negative, so ∣−4∣=∣4∣=4|-4| = |4| = 4∣−4∣=∣4∣=4.

  • Ready for Calculus
    What Is a Limit in Maths? Limits Explained for Beginners

    A limit describes the value a function approaches as its input gets closer and closer to some number, whether or not the function is defined there. We write lim⁡x→af(x)=L\lim_{x \to a} f(x) = Llimx→a​f(x)=L.