2.3 Concept of a Function
1. Definition of a Function
Let us formally introduce the idea of a function $$f:X\rightarrow Y.$$ A function from a set $X$ to a set $Y$ assigns to each element $x$ of $X$ exactly one element $y$ of $Y$.
- We say that $f$ maps $x$ to $y$.
- We also say that $y$ is the image of $x$ under $f$.
- We write: $$f(x)=y\qquad\text{or}\qquad f:x\mapsto y.$$
IMPORTANT
A relation is a function only if every input has one and only one output. Therefore:
- Every element of the domain must be used.
- No input is allowed to have two different outputs.
- Different inputs may have the same output. This is still a function.
| Condition | Allowed for a function? | Reason |
|---|---|---|
| Every input has exactly one output | Yes | This is precisely the definition of a function. |
| Two inputs have the same output | Yes | Many-to-one mappings are still functions. |
| One input has two outputs | No | The output is not unique. |
| One input has no output | No | Every domain element must be assigned an image. |
2. Mapping Diagrams
Mapping diagrams help us visualize functions. We represent the domain and codomain as two sets, and we use arrows to show where each input is sent.
EXAMPLE 1: A Valid Function (One-to-One)
Let $$X=\{1,2,3\},\qquad Y=\{a,b,c,d\}.$$ In this example, every element of $X$ has exactly one image in $Y$, and no two inputs share the same image.
EXAMPLE 2: A Valid Function (Many-to-One)
A function is still valid if two different inputs have the same output. The only requirement is that each input has exactly one output.
EXAMPLE 3: Not a Function (Missed Element)
The following relation is not a function because the input $3$ has no image.
EXAMPLE 4: Not a Function (One-to-Many)
The following relation is not a function because the input $1$ maps to two different outputs.
3. Domain, Codomain, and Range
For a function $$f:X\rightarrow Y,$$ we use the following terminology.
- Domain: the set of all possible inputs. It is usually denoted by $D_f$.
- Codomain: the target set $Y$ named in the mapping $f:X\rightarrow Y$.
- Range: the set of actual outputs. It is usually denoted by $R_f$.
The range is not necessarily the entire codomain. The range consists only of the values actually reached by the function.
The Standard Picture
4. Types of Functions
Functions can be classified according to how the domain elements map to the codomain elements.
1. One-to-One Function / Injective Function
A function is one-to-one, or injective, if different inputs always have different outputs: $$x_1\neq x_2\quad\Longrightarrow\quad f(x_1)\neq f(x_2).$$
Equivalently: $$f(x_1)=f(x_2)\quad\Longrightarrow\quad x_1=x_2.$$
2. Onto Function / Surjective Function
A function is onto, or surjective, if every element of the codomain is reached by at least one input. In this case, $$R_f=Y.$$
3. One-to-One Correspondence / Bijective Function
A function is bijective if it is both injective and surjective. Every input is paired with exactly one output, and every codomain element is used exactly once.
| Type | Condition | Main idea |
|---|---|---|
| Injective | Different inputs give different outputs | No two inputs share the same output |
| Surjective | $R_f=Y$ | Every codomain value is reached |
| Bijective | Injective and surjective | Perfect one-to-one pairing |
EXAMPLE 5
Compare the linear function $f(x)=2x$ and the quadratic function $g(x)=x^2$.
| $x$ | $-2$ | $-1$ | $0$ | $1$ | $2$ |
|---|---|---|---|---|---|
| $y=2x$ | $-4$ | $-2$ | $0$ | $2$ | $4$ |
| $y=x^2$ | $4$ | $1$ | $0$ | $1$ | $4$ |
EXAMPLE 6 (Piecewise Function)
Consider the function $$f(x)= \begin{cases} x^2, & -2\leq x\leq 0,\\ x, & 1\leq x\leq 5. \end{cases}$$ Find its domain and range.
5. Specific Points on a Graph
For a graph $y=f(x)$, several key points are frequently used in analysis.
- $y$-intercept: set $x=0$ and find $y=f(0)$.
- $x$-intercepts / roots / zeros: solve $f(x)=0$.
- Local maximum: a peak point on the graph.
- Local minimum: a valley point on the graph.
- Intersection points: for two graphs $y=f(x)$ and $y=g(x)$, solve $$f(x)=g(x).$$
EXAMPLE 7
Consider $$f(x)=(x-3)^2-4,\qquad g(x)=x-5.$$ Find the key features of $f$, and find the intersection points of $f$ and $g$.
6. Solving Equations and Inequalities Using Graphs
Graphs can be used to solve equations and inequalities.
- Graph $y_1=f(x)$ and $y_2=g(x)$.
- The solutions of $f(x)=g(x)$ are the $x$-coordinates of the intersection points.
- The solution of $f(x)>g(x)$ is the interval where $f$ is above $g$.
- Graph $y=f(x)-g(x)$.
- The solutions of $f(x)=g(x)$ are the roots of $f(x)-g(x)=0$.
- The solution of $f(x)>g(x)$ is where $f(x)-g(x)>0$.
EXAMPLE 8
Consider again $$f(x)=(x-3)^2-4,\qquad g(x)=x-5.$$ Solve: $$f(x)=g(x)\qquad\text{and}\qquad f(x)>g(x).$$
Method A: Intersections
Method B: Combined Roots
EXAMPLE 9
Solve the equation $$2^x=2x+3$$ and the inequality $$2^x<2x+3.$$
We graph $$y_1=2^x\qquad\text{and}\qquad y_2=2x+3.$$ The equation is solved by finding the intersection points.