What a Function Is, and How to Work With One

A function is a rule that gives exactly one output for each input. “Double the number and subtract 2” is a function: put in 4 and you always get 6. Functions are the main language of algebra, precalculus and calculus, so it pays to get comfortable with them early.

What makes something a function

Each input must have exactly one output. Different inputs can share an output, but one input can’t have two.

  • {(1, 2), (2, 2), (3, 5)} is a function. The inputs 1 and 2 share an output, which is fine.
  • {(2, 1), (2, 3)} is not a function. The input 2 has two outputs.

On a graph, use the vertical line test: if any vertical line crosses the graph more than once, the graph is not a function. A circle fails. A parabola that opens up passes.

Function notation

f(x) is read “f of x.” It means “the output of f when the input is x.” It does not mean f times x.

Example If f(x) = 3x − 2, find f(4)

Replace every x with 4: f(4) = 3(4) − 2 = 10.

Example If f(x) = x² − 3x, find f(−2)

Use parentheses when you substitute a negative: f(−2) = (−2)² − 3(−2) = 4 + 6 = 10.

You can substitute expressions too.

Example If f(x) = 3x − 2, find f(a + 1)

f(a + 1) = 3(a + 1) − 2 = 3a + 3 − 2 = 3a + 1.

Domain and range

The domain is every input the function accepts. The range is every output it can produce.

For most algebra functions, the domain is all real numbers except where something breaks. Two things break:

  1. Division by zero. Exclude any x that makes a denominator zero.
  2. Even roots of negatives. The expression under a square root must be zero or more.
FunctionDomainRange
h(x) = x² + 1All real numbersy ≥ 1
f(x) = √(x − 3)x ≥ 3y ≥ 0
g(x) = 1/(x − 5)x ≠ 5y ≠ 0

Example Find the domain of f(x) = √(10 − 2x)

The expression under the root must be at least zero: 10 − 2x ≥ 0. Subtract 10 and divide by −2, flipping the inequality: x ≤ 5.

Flip the inequality

When you multiply or divide an inequality by a negative number, reverse the sign. Forgetting this gives x ≥ 5 above, which is the wrong half of the number line.

Composition: f(g(x))

Composition feeds the output of one function into another. f(g(x)) means “do g first, then do f to the result.” Work from the inside out.

Let f(x) = 2x + 1 and g(x) = x².

Example Find f(g(3)) and g(f(3))

  1. g(3) = 9, so f(g(3)) = f(9) = 19.
  2. f(3) = 7, so g(f(3)) = g(7) = 49.

The order matters: 19 and 49 are different.

Example Find f(g(x)) and g(f(x)) as expressions

  1. f(g(x)) = f(x²) = 2x² + 1.
  2. g(f(x)) = g(2x + 1) = (2x + 1)² = 4x² + 4x + 1.

Inverse functions

An inverse function undoes the original. If f turns 3 into 5, then f⁻¹ turns 5 back into 3. To find one:

  1. Write y instead of f(x).
  2. Swap x and y.
  3. Solve for y.

Example Find the inverse of f(x) = (x − 4)/3

  1. y = (x − 4)/3.
  2. Swap: x = (y − 4)/3.
  3. Multiply by 3: 3x = y − 4. Add 4: y = 3x + 4.
  4. So f⁻¹(x) = 3x + 4.
  5. Check: f(f⁻¹(x)) = ((3x + 4) − 4)/3 = x. ✓

The graph of an inverse is the original graph reflected over the line y = x. A function only has an inverse function if it passes the horizontal line test, meaning no output is repeated.

The −1 in f⁻¹ is not an exponent. f⁻¹(x) is the inverse function. 1/f(x) is the reciprocal, which is something else.

Transformations

Small changes to a function’s formula move its graph in predictable ways. Starting from y = f(x):

ChangeEffect on the graph
f(x) + kShift up k
f(x) − kShift down k
f(x − h)Shift right h
f(x + h)Shift left h
−f(x)Reflect over the x-axis
f(−x)Reflect over the y-axis
a · f(x), a > 1Stretch vertically by a

Changes inside the parentheses work the opposite way to what you might guess: f(x − 2) moves the graph 2 units right. Try it with y = (x − 2)²: the vertex moves from 0 to x = 2.

Your turn

  1. If f(x) = 5 − 2x, find f(−3).

    Show answer

    11. f(−3) = 5 − 2(−3) = 5 + 6.

  2. If g(x) = x² + 2x, find g(a − 1) and simplify.

    Show answer

    a² − 1. (a − 1)² + 2(a − 1) = a² − 2a + 1 + 2a − 2.

  3. Find the domain of f(x) = (x + 1)/(x² − 9).

    Show answer

    All real numbers except 3 and −3, where the denominator is zero.

  4. Let f(x) = x + 3 and g(x) = 2x². Find f(g(2)) and g(f(2)).

    Show answer

    f(g(2)) = 11 and g(f(2)) = 50. g(2) = 8, so f(8) = 11. f(2) = 5, so g(5) = 50.

  5. Find the inverse of f(x) = 4x − 7.

    Show answer

    f⁻¹(x) = (x + 7)/4. Swap to get x = 4y − 7, then solve for y.

  6. Describe how the graph of y = (x + 4)² − 1 relates to y = x².

    Show answer

    It is shifted 4 units left and 1 unit down. The vertex moves from (0, 0) to (−4, −1).

Questions students ask

Is every equation a function?

No. x² + y² = 25 is a circle, and the input x = 3 gives two outputs, y = 4 and y = −4. It fails the vertical line test.

What’s the difference between f(x) and y?

On a graph they are the same thing. f(x) is more useful when you work with several functions at once or need to say which input you mean, as in f(2).

Why do functions matter so much?

Almost everything later in math is a function: lines, parabolas, exponential growth, trig and every function you differentiate in calculus. See Derivatives for Beginners for where this leads.

Keep studying

Drafted with help from AI tools. Every example is worked through step by step so you can check it.