What Are Functions?
Functions are the central concept of almost all mathematics beyond basic arithmetic. Once you understand what they actually are , not just the notation, but the idea , algebra, calculus, statistics, and even programming start making a lot more sense.
A function takes an input, applies a rule, and gives exactly one output. f(x) = 2x + 1 means "take x, double it, add 1." Put in 3, get out 7. Put in 10, get out 21. One input always gives one output , that's the defining rule.
The actual idea behind functions
Think about a vending machine. You put in a code , say B4 , and you get one specific item out. Same code, same item, every time. That's basically a function. Input goes in, one specific output comes out.
Now think about a broken vending machine where sometimes B4 gives chips and sometimes it gives a soda. That's not a function. The same input producing different outputs is what disqualifies it.
In math, a function is a rule that assigns exactly one output to each input. The input is usually called x. The output is usually called y, or f(x) (read "f of x"). The rule itself can be almost anything: add 5 to x, square x, take the square root of x, multiply x by 3 and subtract 7.
The one-output-per-input requirement is what makes functions useful. It means they're predictable. You can build reliable mathematical structures on top of them.
Reading function notation without confusion
f(x) looks like multiplication to a lot of people when they first see it. It isn't. f(x) means "the function named f, applied to the input x." The parentheses here mean "plug in" not "multiply."
So when you see f(x) = 3x + 2, that's defining the rule. When you then see f(5), that means "apply this rule to the input 5." You substitute 5 wherever x appears: f(5) = 3(5) + 2 = 17.
Functions can be named anything , f, g, h, or even something like cost(x) or temp(t). The letter is just a label. The important thing is what the rule says to do with the input.
Domain and range
The domain is the set of all valid inputs. The range is the set of all possible outputs.
For most functions in algebra, the domain is all real numbers , you can plug in anything. But there are cases where certain inputs don't work. You can't take the square root of a negative number (in real number math). You can't divide by zero. These restrictions define the domain.
For f(x) = 1/x, the domain is all real numbers except x = 0. Plug in 0 and you get division by zero, which is undefined. Everything else works fine.
For g(x) = √x, the domain is x ≥ 0. Negative inputs give imaginary numbers, which are outside real number arithmetic.
The vertical line test
When you graph a function, there's a quick visual check to confirm it's actually a function: draw vertical lines across the graph. If any vertical line hits the graph in more than one place, it's not a function.
Why? Because a vertical line at x = 3 is asking "what is the output when the input is 3?" If the line crosses the graph twice, there are two different outputs for the same input , which violates the one-output-per-input rule.
A circle fails the vertical line test (draw a vertical line through the middle and it hits the circle twice). A parabola y = x² passes it. A sideways parabola x = y² fails it.
Why functions matter beyond algebra class
Everything in calculus is about functions , derivatives measure how fast a function changes, integrals measure the area under one. Statistics uses functions to model distributions. Every equation in physics describes a function. In programming, functions are literally named that because they do the same thing: take inputs and return outputs.
The reason functions are so foundational is that they let you describe relationships in a precise, manipulable way. Instead of saying "when x gets bigger, y gets bigger too, kind of," you can say f(x) = 2x and now you know exactly how much y changes for any change in x. That precision is what makes math useful for building things, predicting things, and understanding things.
Practice Problems
Sources & Further Reading
The explanations on this page draw on the following established sources. We link to primary and secondary sources so you can verify claims and go deeper on any topic.