# Functions – Complete explanation and examples!

The time has come to find ourselves with a concept that will be met many times by those who study some engineering (although the same is used in other fields of study), and it is the concept of function or functions.

## What is a function?

A function $f$ is a correspondence rule that associates to each object $x$ in a set – called domain – a single value $f(x)$ of a second set. The set of all values thus obtained is called a range.

To denote a function we use a letter outside the parentheses and something that is inside the parentheses $f(x)$, where what is inside the parenthesis means the value that each variable will take. See how the $f(x)$ function is affected when we assign the following values of $f(1)$, $f(a)$ and $f(a + h)$:

$$\Rightarrow f(x) = x^{2} + 2 \qquad \begin{array}{l} f(1) = 1^{1} + 2 = 3 \\ f(a) = a^{2} + 2 \\ f(a + h) = (a + h)^{2}+2 = a^{2} + 2ah + h^{2} + 2 \end{array}$$

## The domain of a function

• The domain of the function is a set of allowed values for a function
• If not specified, it is assumed that they are all reals ($\mathbb{R}$), in any way you have to analyze the domain of the function because they are not always all the real
• Those numbers that cause a division by zero or square root of a negative number must be excluded from the domain

#### Examples of function domains

(a) $f(x) = x + 2$

The domain of the function is all real, $\mathbb{R}$

$$D: \ \mathbb{R}$$

(b) $f(x) = \sqrt{x – 8}$

The domain of this function are all values that make the result within the square root greater than or equal to zero. What is wanted is that the domain is greater than or equal to zero, the expression inside the square root is taken and an inequality is solved:

$$x – 8 \ge 0 \ \rightarrow \ x \ge 8$$

$$D: \ x \ge 8$$

So the domain of the function is any value greater than or equal to $8$.

(c) $f(x) = \cfrac{2}{x + 4}$

The domain of the function are all the values that make the result of the denominator of the fraction different from zero. Therefore, the domain of the fraction is all real, except $-4$:

$$x + 4 \neq 0 \longrightarrow x \neq -4$$

$$D: \ \mathbb{R} – \{-4\}$$

(d) $f(x) = \cfrac{x}{x^{2} – 9}$

As in the previous exercise, the result of the denominator of the fraction must be different from zero, we are going to calculate it:

$$x^{2} – 9 \neq 0 \rightarrow x \neq \pm 3$$

$$D: \ \mathbb{R} – \{3,-3\}$$

(e) $f(x) = \cfrac{1}{\sqrt{4 – x^{2}}}$

As you want to avoid that the result of the denominator of the fraction is zero and that the result of the square root is a negative number, you have to do the following:

$$4 – x^{2} > 0$$

We factor

$$(2 – x)(2 + x) > 0$$

And we will obtain the result of the domain of our function:

$$D:\ -2 < x < 2$$

(f) $f(x) = \sqrt{49 – x^{2}}$

It is necessary that the result within the root give numbers greater than or equal to zero, so that we have the following:

$$49 – x^{2} \ge 0$$

Now we factor

$$(7 – x)(7 + x) \ge 0$$

And graphically the domain of our function would look like this

$$D:\ -7\le x \le 7$$

## Ways to represent a function

There are 4 ways to represent a function

1. Verbally

Square x function, sine function, square root function of x, etc. etc.

2. Numerically

Tabulating function value by value

$$\begin{array}{c | c} x & y \\ \hline \\ \\ \\ \end{array}$$

3. Visually

4. Algebraically

$$f(x) = x + 1$$

## Range of functions

The range will be defined by the correspondence rule (consisting of assigning a single element of a certain set to each unique element of another set) and the domain.

It means that the range is the values you can take on the $y$ axis. For example:

The parabola $y=x^{2}$ has domain to all real numbers: $D: \ \mathbb{R}$ and range only has values from zero to infinity because they are the values that $y$ will take the function of our parabola $y=x^{2}$

## Which curves in the plane $xy$ are graphs of functions?

### Vertical line test

A curve in the plane $xy$ is a graph of a function of $x$ if no vertical line intersects the curve more than once. Imagine that the following graphs are crossed with a vertical line:

The first is not a function because if we imagine that it is traversed by a vertical line, it will cut the graph in two points.

The second graph and the third graph are results of functions because the imaginary vertical line does not cross the graphs more than once.

## Symmetry of the functions

A function $f(x)$ is an even function if for every $x$ of the $f$ domain it is met: $f(-x)=f(x)$. This means that it is even if the function is symmetric with respect to the $y$ axis.

A function $f(x)$ is an odd function if for every $x$ of the $f$ domain it is met: $f(-x)=-f(x)$. It means that it is odd if the function is symmetric with respect to the origin.

#### Examples:

(a) $f(x) = x^{2}$

$$f(-x) = (-x)^{2} = x^{2} \quad \text{PAIR}$$

(b) $f(x) = x^{3}$

$$f(-x) = (-x)^{3} = -x^{3}\quad \text{ODD}$$

(c) $h(x) = 2x^{4} + 7x^{3} – x^{2} + 9$

$$h(-x) = 2x^{4} – 7x^{3} – x^{2} + 9 \quad \text{It isn’t EVEN and ODD}$$

(d) $f(x) = \cfrac{x^{3} -x}{x^{2} + 1}$

$$f(-x) = \cfrac{-x^{3} + x}{x^{2} + 1} = – \left ( \cfrac{x^{3} – x}{x^{2} + 1} \right ) \quad \text{ODD}$$

(e) $f(x) = |x|$

$$f(x) = \begin{cases} x & x \ge 0 \\ -x & x < 0 \end{cases}$$

$$\text{PAIR}$$

## Classification of functions

### Injective function

Each value of the domain corresponds to a value of the range (called codomain). It means that there are not two or more elements that have the same image.

They are also known as one by one functions.

$y=x^{3}$ is a one by one function

$y=x^{2}$ is not a one by one function

### Surjective function

Each element of the rank corresponds to at least one of the domain

The first graph is surjective because each value of $y$ corresponds to a value of $x$. Beecause a domain values corresponds to the whole range.

The second graph is not surjective because there are elements of the range (negative values of $y$) in which the graph is not included.

### Bijective function

It is a function that is injective and surjective, examples:

• $f(x) = 5x – 3$
• $f(x) = x^{3}$

## Monotony of a function: Increasing and decreasing

It is said that a function is increasing over an interval $I$ if:

$$f(x_{1}) < f(x_2) \ \text{always that} \ x_{1} < x_{2} \ \text{in} \ I$$

It is said that $f(x)$ is a decreasing function on $I$ if:

$$f(x_{1}) > f(x_{2}) \ \text{always that} \ x_{1} < x_{2} \ \text{in} \ I$$

## Types of functions

### Algebraic functions

#### Polynomial function

$$f(x) = a_{n}x^{n} + a_{n-1}x^{n-1} + \dots + a_{1} x + a_{0}$$

$$f(x) = 5x^{7} + 7x^{4} – 3x^{2} + 2 \quad \text{}$$

$$f(x) = x^{2} + 3 \quad \text{quadratic}$$

$$f(x) = 5x^{3} – x \quad \text{cubic}$$

An algebraic function is formed by a finite number of algebraic operators on the identity function and a constant function.

The algebraic operators are: addition, subtraction, multiplication, division, exponentiation, nth root.

#### Examples of polynomial functions

##### Rational function

$$f(x) = \cfrac{x^{2} + 3}{x – 1} \quad \Rightarrow \quad f(x) = \cfrac{P(x)}{Q(x)}$$

## Transcendental functions

### Trigonometric

#### Sine and cosine

$$f(x) = \sin x$$

$$g(x) = \cos x$$

$$-1 \le \sin x \le 1$$

$$-1 \le \cos x \le 1$$

#### Tangent

$f(x) = \tan \ (x) = \cfrac{\sin \ x}{\cos \ x}$

They have an interesting property that is the periodicity

$$\begin{array}{c} \sin \ (x + 2 \pi) = \sin \ x \\ \cos \ (x + 2 \pi) = \cos \ x \\ \tan \ (x + \pi) = \tan \ x \end{array}$$

#### Exponential functions

$$f(x) = a^{x}$$

$x$ is a variable that is raised to a power

$$\begin{array}{c c c} f(x) = 5^{x} & x = 0 & f(0) = 5^{0} = 1 \\ & & f(1) = 5^{1} = 5 \\ & & f(2) = 25 \\ & & f(-10)=5^{-10}=\cfrac{1}{5^{-10}} \sim 0 \end{array}$$

Remember:

• If $x = n$ is a positive integer, then $a^{x}=a \cdot a \cdot a$
• If $x = 0$, then $a^{0} = 1$
• If $x = -n$, then $\frac{1}{a^{n}}$
• If $x =p / q$ and $q>0$, then $a^{x}=\sqrt[q]{a^{p}}$ or $(\sqrt[q]{a})^{p}$

Example:

$$f(x) = (0\text{.}5)^{x} = \left ( \cfrac{1}{2}\right)^{x} = \cfrac{1}{2^{x}}$$

#### Log functions

$$f(x) = \log_{a}x$$

$\log_{2}(x)$   $\log_{3}(x)$   $\log_{10}(x)$

Where $a$ is the base of a positive constant, that is $a>0$

A very important property to consider of the logarithms is the following:

$$f(1) = \log_{a}(1) = 0$$

Now, to what number does the base rise to reach the argument? Simple, observe:

$$\log_{a}x = n \ \Rightarrow \ a^{n} = x$$

#### Hyperbolic

$$\sinh \ (x) = \cfrac{e^{+x} – e^{-x}}{2}$$

$$\cosh \ (x) = \cfrac{e^{+x} + e^{-x}}{2}$$

$$\tanh \ (x) = \cfrac{\sinh \ (x)}{\cosh \ (x)}$$

#### Inverse trigonometry

$$\arcsin \ (x)$$

$$\arccos \ (x)$$

$$\arctan \ (x)$$

#### Specials, sectioned

$$f(x) = \ \begin{cases} g(x) & x < a \\ h(x) & a \le x \le b \\ k(x) & x > b\end{cases}$$

#### Examples of sectioned functions

$$f(x) = \ \begin{cases} x & x \le 0 \\ x + 1 & x > 0\end{cases}$$

Domain: $\mathbb{R}$

$$f(x) = \ \begin{cases} x + 2 & x \le -1 \\ x^{2} & x > -1 \end{cases}$$

##### Unitary step or step of Heaviside

$$H(x) = \ \begin{cases} 0 & x < 0 \\ 1 & x > 0\end{cases}$$

##### Sign function

$$\text{sgn}(x) = \ \begin{cases} 1 & \text{si } x > 0 \\ 0 & \text{si } x = 0 \\ -1 & \text{si } x < 0 \end{cases}$$

## Operations with functions

You can combine two functions to form new ones.

It is $f \ \land \ g \quad \Rightarrow \quad$ can be obtained $f + g, f – g, f \cdot g, \cfrac{f}{g}$

Each with domains $A\ \land \ B$

$$\begin{array}{c c c c c} & & & & \text{domain} \\ \Rightarrow & (f + g)(x) & = & f(x) + g(x) & A \cap B \\ & (f – g)(x) & = & f(x) – g(x) & A \cap B \\ & (f \cdot g)(x) & = & f(x) \ \cdot \ g(x) & A \cap B \\ & \bigg ( \cfrac{f}{g} \bigg ) (x) & = & \cfrac{f(x)}{g(x)} & \{ x \in \ A \cap B \ | \ g(x) \neq 0 \} \end{array}$$

Example $f(x) = \sqrt{x} \quad g(x) \sqrt{4 – x^{2}}$

$$\sqrt{x} \ D: \ x \ge 0 \ [0, +\infty)$$
$$\sqrt{4 – x^{2}} \ D: \ [-2, 2]$$
$$D: [0,+\infty) \cap [-2,2] = [0,2]$$
$$\begin{array}{l c} (f + g)(x) = \sqrt{x} + \sqrt{4 – x^{2}} & [0,2] \\ (f – g)(x) = \sqrt{x}- \sqrt{4 – x^{2}} & [0,2] \\ (f \cdot g)(x) = \sqrt{x}\sqrt{4-x^{2}} = \sqrt{4x – x^{3}} & [0,2] \\ \bigg ( \cfrac{f}{g} \bigg )(x) = \cfrac{\sqrt{x}}{\sqrt{4-x^{2}}}& [0,2) \end{array}$$

## Composition of functions

It is $y = f(u) \ \land \ u = g(x) \quad \Rightarrow \quad y = f(g(x))$

Example $f(u) = \sqrt{u + 1} \qquad u = g(x) = x^{2} – 1$

$\Rightarrow \ f(g(x)) = \sqrt{x^{2} – 1 + 1} = \sqrt{x^{2}} = x$

$\Rightarrow$ Given two functions $f$ and $g$ the composite function is defined by:

$$(f \circ g)(x) = f(g(x))$$

### Example of composite functions

If $f(x) \sqrt{x} \qquad g(x) = \sqrt{2 – x}$

$f \circ g \ \Rightarrow \ f(g(x)) = \sqrt{\sqrt{2 – x}} = \sqrt[4]{2 – x}$

$$(-\infty,2]$$

$g \circ f \ \Rightarrow \ g(f(x)) = g(\sqrt{x}) = \sqrt{2 – \sqrt{x}}$

$$\begin{cases} 2 – \sqrt{x} \ge 0 \qquad x \ge 0 \qquad [0,4] \\ 2 \ge \sqrt{x} \\ 4 \ge x \end{cases}$$

$f \circ f \ \Rightarrow \ f(f(x)) = f(\sqrt{x}) = \sqrt{\sqrt{x}} = \sqrt[4]{x}$

$$x \ge 0$$

$g \circ g \ \Rightarrow \ g(g(x)) = g(\sqrt{2 – x}) = \sqrt{2 – \sqrt{2 – x}}$

$$\begin{array}{c} 2 – x \ge 0 \\ x \le 2 \end{array} \quad \text{y} \quad \begin{array}{c} 2 – \sqrt{2 – x} \ge 0\\ 2 \ge \sqrt{2 – x} \end{array} \quad \Rightarrow \quad \begin{array}{c} 4 \ge 2 – x \\ x \ge -2 \end{array} \quad [-2,2]$$

If $h(x) = x + 9 \quad g(x) = \cos x \quad f(x) = x^{2}$

$$f \circ g \circ g = f(g(h(x))) = f(g(x + 9)) = f(\cos (x + 9)) = \cos^{2}(x + 9)$$

## Inverse functions

Injective functions one by one with domain $A$ and image $B$ have an inverse function with domain $B$ and image $A$.

$f(x)=y \ \leftrightarrow \ f^{-1}(y)=x \quad$ *Don’t confuse with $[f(x)]^{-1} = \cfrac{1}{f(x)}$

We have $f(x) = x^{5} + 2$

$$\begin{array}{c c l l} &(1) & y = f(x) = x^{5} + 2 & \text{Domain} \mathbb{R} \ \text{, Image } \mathbb{R} \\ \text{Clear } x & (2) & x = \sqrt[5]{y – 2}& \mathbb{R} \land \mathbb{R} \\ & (3) & f^{-1}(x) = \sqrt[5]{x – 2} & \end{array}$$

We have $f(x) = \cfrac{1 + 3x}{5 – 2x}$

$$y = \cfrac{1 + 3x}{5 – 2x}$$
$$\downarrow$$
$$(5 – 2x)y = 1 + 3x$$
$$5y – 2xy = 1 + 3x$$
$$5y – 1 = 3x + 2xy = x(3 + 2y)$$
$$x = \cfrac{5y – 1}{2y + 3} \ \longrightarrow \ f^{-1}(x) = \cfrac{5x – 1}{2x + 3}$$

It is important to mention that the graphs of the inverses are symmetrical.

## Transformation of functions

Many times when adding some constant summand, subtracting, multiplying or dividing a function, we wonder how it would look graphically when we add that constant. Well, it’s easier than it looks, and that’s what we’re going to see below.

### Horizontal and vertical displacement

We start by moving the functions horizontally and vertically, let’s see the following image:

We have a function $f (x)$, we are going to move it in the following ways:

• Left: to move a function to the left, you have to add a constant to the value of $x$
• Right: to move a function to the right, a constant must be subtracted from the value of $x$
• Above: to make a function go up, you have to add a constant to the whole function
• Bottom: to make a function go down, you have to subtract a constant from the whole function

With that we are ready to move our function as we want.

### Example of horizontal and vertical movement of functions

We have the following function $f(x)=x^{4}+x^{3}+x^{2}$ (the graph only takes a piece of the function to make the graph look cleaner)

And if we want to move that function one unit to the left, then we have to add all the $x$’s to the number 1, likewise if we want to move the function to the right, all the $x$’ s will be you have to subtract the number 1. To move the function one unit up or down, you just have to add a unit that adds or subtracts to the whole function. Let’s move it

Upward shift: $f(x)=x^{4}+x^{3}+x^{2}+2$

Downward shift: $f(x)=x^{4}+x^{3}+x^{2}-2$

Offset to the left: $f(x)=(x+2)^{4}+(x+2)^{3}+(x+2)^{2}$

Offset to the right: $f(x)=(x-2)^{4}+(x-2)^{3}+(x-2)^{2}$

## Stretches and reflections

It is very common for you to sometimes see functions that look a lot like or are reflected with respect to the $x$ axis or the $y$ axis. It is very easy to stretch, tighten or reflect a function, we will see it below.

Look at the following graph with our function $f(x)$:

• $cf(x)$ compress the function
• $\frac{1}{c}f(x)$ stretch the function
• $-f(x)$ reflects the function with respect to the axis $x$
• $f(-x)$ reflects the function with respect to the $y$ axis

### Example of stretching and reflections of functions

Let’s take a piece of the function $f(x)=(x+2)^{4}+(x+2)^{3}+(x+2)^{2}$ and let’s stretch it and reflect it:

• Compressed function: $5(x+2)^{4}+5(x+2)^{3}+5(x+2)^{2}$
• Stretched function: $0\text{.}1(x+2)^{4}+0\text{.}1(x+2)^{3}+0\text{.}1(x+2)^{2}$
• Reflected function with respect to the axis $y$: $(-x+2)^{4}+(-x+2)^{3}+(-x+2)^{2}$
• Reflected function with respect to the axis $x$: $-(x+2)^{4}-(x+2)^{3}-(x+2)^{2}$

## Modeling with functions

#### Example 1

$$P = \text{perimeter}$$

$$P = 3a$$

$$a = P/3$$

Of the area $A = b \times h / 2 \quad b = a = \cfrac{P}{3}$

$$h = \sqrt{a^{2} – (1/2 \ a)^{2}} = \sqrt{a^{2} – \frac{1}{4} a^{2}} = \cfrac{\sqrt{3}}{2}a = \cfrac{\sqrt{3}}{3} \ \cfrac{P}{3} = \cfrac{P}{2\sqrt{3}}$$

$$A =\cfrac{1}{2} \bigg ( \cfrac{P}{3} \bigg ) \bigg ( \cfrac{1}{2\sqrt{3}} \bigg ) = \cfrac{1}{12\sqrt{3}} P^{2}$$

#### Example 2

$$h = \sqrt{4r^{2} – r^{2}} = \sqrt{3} r$$

$$2h = 2\sqrt{3}r$$

$$V(r) = \pi r^{2} \cdot 2 \sqrt{3} = 2\sqrt{3}r^{3}$$