Relations and functions

Relations

The following table gives average values of a woman's height and normal weight.

height in cm weight in lb
152 105
163 127
172 144
180 157

From the table, we see that a height of 152 cm corresponds to a weight of 105 lb, a height of 163 cm corresponds to a weight of 127 lb, and so on. Such a correspondence is called a relation.

The relation between height and weight is written as ordered pairs, {(152, 105), (163, 127), (172, 144), (180, 157)}, where the first component is the height and the second is the weight.

In a relation, the set of the first components in the ordered pairs is called the domain of the relation, and the set of the second components is called the range of the relation.

So, for the above example, the domain is $\{152,163,172,180\}$,

and the range is $\{105,127,144,157\}$.

Example: In the following figure, there is a relation between two sets of numbers displayed in a different way.

A relation shown as arrows mapping domain elements to range elements

For this relation, the ordered pairs are

{(3,10), (-6,-5), (8,-5),(1,1)},

That is, in each ordered pair, the domain element is written first, followed by the corresponding range element.

Functions

In a relation, if each element of the domain corresponds to exactly one element in the range, then we call that relation a function.

Example 1: Determine whether the following relation is a function.

A relation mapping car brands to car types

Answer: Yes, the above relation is a function, since each element in the domain corresponds to exactly one element in the range.

Example 2: Determine whether the following relation is a function.

A relation mapping items to vegetables and fruits, with one item mapping to two

Answer: The relation is not a function, since the element 'plum' in the domain corresponds to more than one element of the range.

We can draw the graph of a function from its ordered pairs, but not all graphs represent a function. We can use the 'vertical line test' to determine whether a graph is a function.

Vertical line test

A graph represents a function if no vertical line, drawn anywhere, crosses the graph more than once. If a vertical line crosses the graph more than once, then the graph is not a function.

Example 1: The following graph represents a function.

A graph that passes the vertical line test

No vertical line you can draw crosses the graph more than once.

A vertical line crossing the function graph only once

Example 2: The following graph does not represent a function, since you can draw a vertical line that crosses the graph twice (more than once).

A vertical line crossing the graph twice, failing the vertical line test

Function notation

Functions are often defined as equations.

For example, the equation $y=4x$ represents a function. It is written as

$f(x)=4x$, read as $f$ of $x$,

where $f$ is the name of the function and $x$ is the input value from the domain. You can use any letter to name the function.

Evaluating a function

If we have a function, say,

$f(x)=5x$

and if you substitute $x=5$, you get

$f(5)=5\cdot 5=25$

This is called evaluating the function; that is, we evaluated the function at $x=5$.

Finding function values from a graph

From the graph of a function, $f(x)$, we can find the function value for a given $x$ value. Also, if you know the function value, you can find the corresponding $x$ value(s).

Example: The graph of a function $g(x)$ is given below. (a) Find $g(0)$. (b) Find $g(-2)$. (c) Find the value of $x$ for which $g(x)=0$. (d) Find the value of $x$ for which $g(x)=3$.

The graph of a function g(x) used to read off function values

Solution:

(a) $g(0)$ is the $y$-value for $x=0$.

Therefore, $g(0)=3$

(b) $g(-2)$ is the $y$-value for $x=-2$.

Therefore, $g(-2)=2$.

(c) $g(x)=0$ means $y=0$. In the graph, $y=0$ at $x=4$, so the answer is $x=4$.

(d) $g(x)=3$ means $y=3$. In the graph, $y=3$ at $x=0$ and at $x=2$, so the answer is $x=0$ and $x=2$.

Domain and range of a function

If we have a function $y=f(x)$, then the domain of the function is the set of all $x$ values that, when substituted into the function, produce a real number.

The range of the function is the set of all $y$ values corresponding to the $x$ values in the domain.

When finding the domain of a function, keep the following guidelines in mind. If a function has a denominator, exclude the $x$ values that make the denominator zero. If a function has a square root, exclude the $x$ values that make the expression inside the square root negative.

Example 1: Find the domain of the function: $f(x)=\dfrac{x+3}{2x-3}$

Solution: When finding the domain, exclude the $x$ value that makes the denominator zero.

So, take the denominator, set it equal to zero, and solve for $x$:

$2x-3=0$

Solving for $x$, we get

$x=\dfrac{3}{2}$.

Now, the domain is all real numbers except $\dfrac{3}{2}$.

So, the domain is $\big(-\infty,\dfrac{3}{2}\big)\cup \big(\dfrac{3}{2},\infty\big)$

Example 2: Find the domain of the function $f(x)=\sqrt{1-4x}$

Solution: You can have only a positive value or zero inside the square root.

Therefore, $1-4x \ge 0$

Solving for $x$, we get

$x\le \dfrac{1}{4}$

So, the domain is all $x$ values less than or equal to $\dfrac{1}{4}$.

The domain in interval notation is $\big(-\infty, \dfrac{1}{4}\big]$.