A function is the most important kind of relation in all of mathematics. It captures the idea of a deterministic rule: feed in one input, get exactly one output. From here every later topic , limits, derivatives, integrals , is built.
Definitions
Let A and B be non-empty sets. A functionf from A to B is a relation f⊆A×B such that
(Total) every a∈A appears as the first coordinate of some pair, and
(Single-valued) if (a,b)∈f and (a,c)∈f, then b=c.
We write f:A→B and, for each a∈A, denote the unique b paired with a by f(a). So b=f(a) is just a short form of "(a,b)∈f".
A is the domain of f.
B is the codomain of f.
{f(a):a∈A} is the range of f , a subset of B.
The two conditions say: "every input has an output" and "no input has two outputs".
Three ways to specify a function
1. By a formula.f(x)=x2, f:R→R. The rule pairs each x with x2.
2. By a table or listing. For finite A we can list f(a) for each a.
3. By a graph. For real-valued functions, the graph {(x,f(x)):x∈A} in R2.
The vertical line test
A subset S⊆R2 is the graph of a function y=f(x) if and only if every vertical line x=c meets S in at most one point (and exactly one point if c is in the domain). This is just the single-valued rule, picture-side.
Examples:
y=x2: every vertical line cuts the parabola once. Function.
x2+y2=1: most vertical lines cut the circle in two points. Not a function.
y=x (taking the non-negative root): every vertical line in [0,∞) meets it once. Function.
When two functions are equal
Two functions f and g are equal if and only if:
They have the same domain.
f(a)=g(a) for every a in the domain.
So f(x)=x on R and g(x)=x on Z are different functions, even though their formulas look the same.
Examples of "function or not"
f:R→R, f(x)=2x+3: function.
f:R→R, f(x)=x1: not a function from R to R , undefined at x=0. But it is a function from R∖{0} to R.
f(x)=x: function from [0,∞) to R.
The "rule" f(x)=±x pairs x=4 with both 2 and −2 , not a function.
Worked examples
Example 1. Decide whether {(1,2),(2,3),(3,4)} is a function from {1,2,3} to {2,3,4,5}. State its domain, codomain, range.
Every element of {1,2,3} appears exactly once as a first coordinate, so this is a function. Domain ={1,2,3}, codomain ={2,3,4,5}, range ={2,3,4}.
Example 2. Is {(1,2),(2,3),(1,4)} a function on {1,2}?
No , the input 1 is paired with two outputs 2 and 4. Single-valuedness fails.
Example 3. Is the curve y2=x in the plane the graph of a function y=f(x)?
No. For x=4, both y=2 and y=−2 satisfy y2=x. The vertical line x=4 meets the curve at two points.
Example 4. Find f(0),f(1),f(−2) for f(x)=x2−3x+4.
f(0)=0−0+4=4. f(1)=1−3+4=2. f(−2)=4+6+4=14.
Example 5 (harder). A function f:R→R satisfies f(x+y)=f(x)+f(y) for all x,y∈R, and f(1)=3. Find f(0),f(2),f(−1),f(5).
Putting x=y=0: f(0)=2f(0), so f(0)=0.
Putting y=−x: f(0)=f(x)+f(−x)=0, so f(−x)=−f(x).
Now f(2)=f(1)+f(1)=6, f(−1)=−3, f(5)=f(2)+f(2)+f(1)=6+6+3=15.
(In fact this forces f(n)=3n for every integer n, and with mild extra assumptions, f(x)=3x for every real x.)
Try it yourself
Decide whether each is a function: (a) {(1,2),(2,4),(3,6)} from {1,2,3} to N; (b) {(1,2),(1,3)} from {1,2} to N; (c) {(1,1),(2,1),(3,1)} from {1,2,3} to N.
Find f(2),f(−3),f(0) for f(x)=x3−2x+1.
Does y=∣x∣ define a function from R to R?
Does the circle x2+y2=25 define y as a function of x?
Are f(x)=x on R and g(x)=xx2 on R∖{0} equal functions? Explain.
State the codomain and find the range of f:R→R, f(x)=x2.
If f(x)=ax+b with f(1)=5,f(2)=7, find a and b.
Plot the graph of f(x)=2x−1 for x∈[−1,2]. State its range.
Show that f(x)=1+x2x is a function from R to R and find its value at x=0,1,−1.
If f(x+1)=x2−3x+2, find f(x).
If f(x)=x2, evaluate hf(x+h)−f(x) for h=0 and simplify.
Sketch a curve that satisfies the vertical line test on [−2,2] but is not a polynomial.
Pitfalls / Tricks
A function must be defined for every input in the domain. Always state the domain explicitly: f(x)=1/x "on R" is incorrect; "on R∖{0}" is correct.
Two functions can have the same formula yet be unequal if their domains differ.
The range is a subset of the codomain , never confuse them.
Insight. A function is a machine: one input, one output, no exceptions. If a rule sometimes returns multiple values, sometimes none, it is a relation, not a function. Beginning with this distinction prevents endless confusion later.