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.

Set X Set Y 1 2 3 a b c d
$$f(1)=a,\qquad f(2)=b,\qquad f(3)=d.$$ This is a valid function.

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.

1 2 3 a b c d
$$f(1)=a,\qquad f(2)=b,\qquad f(3)=b.$$ This is a valid function because every 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.

1 2 3 a b c d
$$1\mapsto a,\qquad 2\mapsto b,\qquad 3\mapsto\text{nothing}.$$ This is not a function because one domain element is missed.

EXAMPLE 4: Not a Function (One-to-Many)

The following relation is not a function because the input $1$ maps to two different outputs.

1 2 3 a b c d
$$1\mapsto a\qquad\text{and}\qquad 1\mapsto b.$$ This is not a function because one input has 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

DOMAIN $X$ CODOMAIN $Y$ RANGE $x$ $f(x)$ Function $f$

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$
For $f(x)=2x$: $$D_f=\mathbb{R},\qquad R_f=\mathbb{R}.$$
For $g(x)=x^2$: $$D_g=\mathbb{R},\qquad R_g=[0,\infty).$$

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.

The graph is defined only for $$-2\leq x\leq 0\qquad\text{or}\qquad 1\leq x\leq 5.$$ Therefore, $$D_f=[-2,0]\cup[1,5].$$
The first piece $y=x^2$ gives $0\leq y\leq 4$, and the second piece $y=x$ gives $1\leq y\leq 5$. Hence, $$R_f=[0,5].$$

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$.

The $y$-intercept of $f$ is found by setting $x=0$: $$f(0)=(0-3)^2-4=9-4=5.$$ Therefore, the $y$-intercept is $$(0,5).$$
The $x$-intercepts of $f$ are found by solving $f(x)=0$: $$\begin{aligned} (x-3)^2-4&=0\\ (x-3)^2&=4\\ x-3&=\pm 2\\ x&=1\quad\text{or}\quad x=5. \end{aligned}$$ Therefore, the $x$-intercepts are $$(1,0)\qquad\text{and}\qquad (5,0).$$
Since $f(x)=(x-3)^2-4$ opens upward, its minimum is the vertex: $$(3,-4).$$
To find the intersection points, solve $f(x)=g(x)$: $$\begin{aligned} (x-3)^2-4&=x-5\\ x^2-6x+9-4&=x-5\\ x^2-6x+5&=x-5\\ x^2-7x+10&=0\\ (x-2)(x-5)&=0\\ x&=2\quad\text{or}\quad x=5. \end{aligned}$$ Substituting into $g(x)=x-5$ gives $$(2,-3)\qquad\text{and}\qquad (5,0).$$

6. Solving Equations and Inequalities Using Graphs

Graphs can be used to solve equations and inequalities.

Method A: Intersection method
  • 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$.
Method B: Combined graph method
  • 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).$$

From Example 7, the intersection points occur when $$x=2\qquad\text{or}\qquad x=5.$$ Therefore, $$f(x)=g(x)\quad\Longleftrightarrow\quad x=2\text{ or }x=5.$$
The inequality $f(x)>g(x)$ is true where the graph of $f$ lies above the graph of $g$. Equivalently, solve $$f(x)-g(x)>0.$$
Since $$f(x)-g(x)=x^2-7x+10=(x-2)(x-5),$$ and the quadratic opens upward, it is positive outside the roots. Therefore, $$f(x)>g(x)\quad\Longleftrightarrow\quad x<2\quad\text{or}\quad x>5.$$
Hence the solution is $$x\in(-\infty,2)\cup(5,\infty).$$
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.

Using GDC intersection gives approximately $$x\approx -1.30\qquad\text{and}\qquad x\approx 3.25.$$
Therefore, the solutions of the equation are $$x\approx -1.30\quad\text{or}\quad x\approx 3.25.$$
The exponential curve is below the line between the two intersection points, so $$2^x<2x+3\quad\Longleftrightarrow\quad -1.30< x <3.25.$$