Skip to content

Functions

Algebra · level 7, lesson 4 of 7

A question to start

Think of two rules about the people in your school.

  • Rule A: give it a person, and it tells you that person's birthday.
  • Rule B: give it a birthday, and it tells you the person born on that day.

Rule A always works: every person has exactly one birthday. Rule B is in trouble. Some days nobody in the school was born; on other days, two or three people were. (Even in a class of 30, it is more likely than not that two people share a birthday: see Probability.) So Rule B cannot always give one answer.

Mathematicians care so much about the difference that rules like A have their own name. They are functions, and they are the main characters of the rest of algebra.

The idea

What a function is

A relation is any pairing of inputs with outputs. A function is a relation in which every input has exactly one output. Different inputs may share an output (two people can share a birthday), but one input may never have two outputs.

A mapping diagram shows it with arrows from inputs to outputs:

1 2 3 4 5 a function input output 1 2 4 5 6 not a function input output

On the left, each input sends out exactly one arrow: a function, even though 1 and 3 both go to 4. On the right, the input 1 sends out two arrows: not a function.

Why insist on one output? Because then the rule is predictable: tell me the input and I can tell you, without doubt, the output. A calculator key, a formula for the cost of a taxi ride, the height of a ball at a given time: all are functions.

Function notation

We give a function a name, usually a letter such as \(f\), and write \(f(x)\) for "the output of \(f\) when the input is \(x\)". Read it "\(f\) of \(x\)". For example, if \(f(x) = 3x^2 - 2x + 1\), then

\[f(2) = 3(2)^2 - 2(2) + 1 = 12 - 4 + 1 = 9.\]

This says "the input 2 gives the output 9", or "the point \((2, 9)\) is on the graph". \(f(x)\) is not \(f\) times \(x\): the brackets hold the input.

You can put in anything, even an expression. Put brackets round it and replace every \(x\):

\[f(a + 1) = 3(a + 1)^2 - 2(a + 1) + 1.\]

Domain and range

  • The domain is the set of all inputs allowed.
  • The range is the set of all outputs that actually come out.

When a function is given by a formula and nobody says otherwise, the domain is every real number for which the formula makes sense. Two things go wrong in real numbers:

  • dividing by zero: in \(h(x) = \dfrac{1}{x + 4}\), the input \(x = -4\) is not allowed;
  • square roots of negatives: in \(g(x) = \sqrt{x - 3}\), we need \(x - 3 \ge 0\), so \(x \ge 3\).

Ways to write sets of numbers:

In words Set notation Interval notation
all real numbers \(\{x \in \mathbb{R}\}\) \((-\infty, \infty)\)
\(x\) is 3 or more \(\{x \in \mathbb{R} \mid x \ge 3\}\) \([3, \infty)\)
\(x\) is not \(-4\) \(\{x \in \mathbb{R} \mid x \ne -4\}\) \((-\infty, -4) \cup (-4, \infty)\)

\(\mathbb{R}\) is the set of real numbers, \(\in\) means "is in", the bar \(\mid\) means "such that", a square bracket includes the end, a round bracket leaves it out, and \(\cup\) means "or" (joining two sets). The symbol \(\infty\) is not a number, so it always gets a round bracket.

Finding the range takes more thought: you have to ask which outputs can come out. For a quadratic, the vertex tells you. \(k(x) = -2(x - 1)^2 + 5\) has a maximum of 5, and every number below 5 is reached too, so its range is \(y \le 5\).

The vertical line test

On a graph, an input \(x = a\) is the vertical line through \(a\). If some vertical line meets the graph twice, that input has two outputs, and the graph is not a function.

x y y = x²: one crossing, a function x y (4, 2) (4, −2) x = y²: two crossings, not a function

The sideways parabola \(x = y^2\) fails: the line \(x = 4\) meets it at \((4, 2)\) and \((4, -2)\). The ordinary parabola \(y = x^2\) passes: every vertical line meets it exactly once. A circle fails too: \(x^2 + y^2 = 25\) meets the line \(x = 3\) at \(y = 4\) and \(y = -4\).

Why \(\sqrt{9}\) is 3, not ±3

Both 3 and \(-3\) square to 9. But the symbol \(\sqrt{\phantom{x}}\) is meant to be a function, so it must give one answer. By agreement it gives the one that is not negative: \(\sqrt9 = 3\). When you want both, you write \(\pm\sqrt9\), as in the quadratic formula. This one agreement is why the graph of \(y = \sqrt{x}\) is only the top half of the sideways parabola.

Where the word comes from

The word "function" was used in this sense by Leibniz and Johann Bernoulli around 1700, and the notation \(f(x)\) was made popular by Euler in the 1730s. The modern "exactly one output" definition came later, in the 1800s, when mathematicians found strange functions that no single formula seemed to describe.

Worked examples

1. Evaluating. \(f(x) = 3x^2 - 2x + 1\). Find \(f(2)\), \(f(-1)\) and \(f(a + 1)\).

  • \(f(2) = 12 - 4 + 1 = 9\).
  • \(f(-1) = 3(1) + 2 + 1 = 6\). (Note \((-1)^2 = 1\), and \(-2 \times (-1) = +2\).)
  • \(f(a + 1) = 3(a^2 + 2a + 1) - 2a - 2 + 1 = 3a^2 + 6a + 3 - 2a - 1 = 3a^2 + 4a + 2\).
  • Check with \(a = 1\): \(f(2)\) should be 9, and \(3 + 4 + 2 = 9\). ✓

2. Domain and range.

  • \(g(x) = \sqrt{x - 3} + 2\): need \(x \ge 3\). The square root gives every number \(\ge 0\), so \(g\) gives every number \(\ge 2\). Domain \([3, \infty)\), range \([2, \infty)\).
  • \(h(x) = \dfrac{1}{x + 4}\): domain \(x \ne -4\). A fraction with top 1 can be any number except 0, so the range is \(y \ne 0\).
  • \(k(x) = -2(x - 1)^2 + 5\): domain all real numbers, range \(y \le 5\).

3. Function or not?

  • \(\{(1, 4), (2, 5), (3, 4)\}\): each input appears once. A function.
  • \(\{(1, 4), (1, 5), (2, 6)\}\): the input 1 has two outputs. Not a function.
  • \(y = \lvert x \rvert\): each \(x\) gives one value. A function (a V-shaped graph that passes the vertical line test).

4. Working backwards. \(f(x) = x^2 - 4x\). For which \(x\) is \(f(x) = 5\)?

  • \(x^2 - 4x = 5\), so \(x^2 - 4x - 5 = 0\), so \((x - 5)(x + 1) = 0\), so \(x = 5\) or \(x = -1\).
  • Two inputs share the output 5. That is allowed for a function.

Try it

  1. \(f(x) = 5 - 2x\). Find \(f(0)\), \(f(3)\) and \(f(-4)\).
  2. Which are functions? (a) \(\{(2, 3), (3, 3), (4, 3)\}\) (b) \(\{(3, 2), (3, 3)\}\) (c) \(y = x^3\) (d) \(x^2 + y^2 = 9\)
  3. Find the domain and range: (a) \(f(x) = \sqrt{6 - 2x}\) (b) \(g(x) = x^2 + 1\) (c) \(h(x) = \dfrac{3}{x - 2}\)
  4. \(f(x) = x^2 + x\). Find and simplify \(f(t - 1)\).
  5. \(f(x) = 2x + 3\). Solve \(f(x) = 11\).
  6. Find the range of \(f(x) = x^2 - 6x + 1\).
  7. Is \(f(x) = \dfrac{x^2 - 1}{x - 1}\) the same function as \(g(x) = x + 1\)? Explain.
  8. \(f(x) = x^2\). Is it true that \(f(a + b) = f(a) + f(b)\) for all \(a\), \(b\)?
Answers
  1. \(f(0) = 5\), \(f(3) = 5 - 6 = -1\), \(f(-4) = 5 + 8 = 13\).
  2. (a) Function: each input has one output (all the same output is fine). (b) Not a function: input 3 has two outputs. (c) Function. (d) Not a function: \(x = 0\) gives \(y = 3\) and \(y = -3\).
  3. (a) Need \(6 - 2x \ge 0\), so \(x \le 3\). Domain \((-\infty, 3]\), range \([0, \infty)\). (b) Domain all reals; \(x^2 \ge 0\), so range \([1, \infty)\). (c) Domain \(x \ne 2\), range \(y \ne 0\).
  4. \(f(t - 1) = (t - 1)^2 + (t - 1) = t^2 - 2t + 1 + t - 1 = t^2 - t\).
  5. \(2x + 3 = 11\), so \(2x = 8\), so \(x = 4\).
  6. Complete the square: \(f(x) = (x - 3)^2 - 8\). The square is at least 0, so the range is \(y \ge -8\), that is \([-8, \infty)\).
  7. No. For \(x \ne 1\), \(\dfrac{(x - 1)(x + 1)}{x - 1} = x + 1\), so they agree there. But \(f(1)\) is \(\dfrac00\), not defined, while \(g(1) = 2\). They have different domains, so they are different functions. (The graph of \(f\) is the line with a hole at \((1, 2)\): see Rational functions.)
  8. No. Try \(a = 1\), \(b = 2\): \(f(3) = 9\) but \(f(1) + f(2) = 1 + 4 = 5\). In general \((a + b)^2 = a^2 + 2ab + b^2\), not \(a^2 + b^2\).

Common mistake

Reading \(f(x)\) as \(f \times x\). \(f(x + 2)\) is "the output for the input \(x + 2\)", not \(f(x) + 2\) and not \(fx + 2f\). With \(f(x) = x^2\): \(f(x + 2) = (x + 2)^2 = x^2 + 4x + 4\), while \(f(x) + 2 = x^2 + 2\).

Thinking that two inputs with the same output break the rule. \(f(x) = x^2\) sends both 3 and \(-3\) to 9, and it is a perfectly good function. The rule is only "one input, one output", not "one output, one input". (Functions that also have the second property are special. They are the ones with inverses: see lesson 6.)

Where it leads