#### Functions and graphs primer

October 9, 2016

A function is a rule that maps each of the elements in a domain to one and only one element in a range. The set of all possible elements in the input is the domain D of a function; the set of all possible elements in the output is the range R of a function.

According to this trivial definition, a function takes a set of elements and applies its rule to map to another set of elements, so that each and every domain element is mapped once and only. There are, of course, cases in which an element in the range is the mapping of multiple elements in the domain (like in a constant function).

Typically, although the domain is not mentioned one should always keep in mind that the domain is the set of elements for which the function may be evaluated. There are cases in which the domain has to be carefully considered, like in fractions (remember division by zero) and in even roots (remember the elements in even roots have to be greater or equal to zero). Take a look,

$\displaystyle f(x) = \frac{2x+3}{x-1}, \; D=R-\{1\} \\ f(x) = \sqrt{x-1}, \; D=\{x \geq 1 \}$

In some cases, the domain is not restricted by the definition of the function but it might be restricted by the application (i.e. in which set of elements it might “make sense” to apply the function, in real world applications).

It is possible to combine and to construct composite functions in various forms, like,

$\displaystyle f(x) + g(x), \; f(x) \cdot g(x), \; f(g(x)) \; [\text{or } ((f \circ g)(x)]$

For various obvious (and non-obvious) reasons it s possible to visualize a function by creating graphs. Typically a graph can be considered as a visualization of the set of points created by the rule of a function in a coordinate system created by the domain and range of the function.

Simple functions of one independent variable, which do not involve powers, etc, like

$\displaystyle f(x) = y = -\frac{3}{2}x+2 \quad [\text{or in general } f(x) = y = ax + b]$

are visualized as straight lines and are called linear. In addition, in these functions it is easy to pinpoint the role of their ingredients a, b as being the slope of the line (the rate of change in the function in respect to the independent variable x) and the y-intercept (where the line crosses y-axis) respectively. It is easy to also pinpoint the x-intercept by equating the function with zero, so putting all together we have

$\displaystyle f(x) = ax + b \\ \text{the slope is } a \left[= \frac{\Delta f(x)}{\Delta x} \right] \\ \text{the y-intercept is } b \left[ = f(x=0) \right] \\ \text{the x-intercept is } f(x) = ax + b = 0 \Rightarrow x_i = -\frac{b}{a}$

Thus, for example

$\displaystyle f(x) = y = -\frac{3}{2}x+2 \quad \\ \text{has slope } a=-\frac{3}{2} \\ \text{has y-intercept } b=2 \\ \text{has x-intercept } x_i = -\frac{2}{-\frac{3}{2}} = \frac{4}{3}$

Wanna see how this function’s graph looks like? Take a look,

One may easily deduce that

$\displaystyle f(x)=c, \text{ c being a constant, is a horizontal line} \\ x=c, \text{ c being a constant, is a vertical line}$

What comes naturally after the study of linear functions is the study of quadratic or second degree functions, that is functions in which the independent variable is raised to the second power.

The standard form of the quadratic functions is

$\displaystyle f(x) = ax^2 + bx + c, \quad a,b,c \in R, \; a \neq 0$

How do quadratic functions look like in graphs? Well, they are parabolas.
If a is positive then the parabola opens up (has a lowest point). If a is negative then the parabola opens down (has a highest point). This lowest or highest point is usually called the vertex. The y-intercept is the constant c,

$\displaystyle f(x=0) = ax_{x=0}^2 + bx_{x=0} + c \Rightarrow f(x=0) = y_i = c$

The x-intercepts can be calculated,

$\displaystyle f(x) = 0 \Rightarrow ax^2 + bx + c = 0 \Rightarrow x_i = \frac{-b \pm \sqrt{b^2-4ac}}{2a}$

which gives the obvious hint that one quadratic function might have none, one, or at most two x-intercepts!

In addition, the parabola that represents a quadratic function is symmetrically horizontally mirrored around a vertical line that crosses the vertex of the parabola! But where is this vertex? Here it is

$\displaystyle x_v = -\frac{b}{2a}, \; y_v = f\left(\frac{-b}{2a}\right) = \frac{4ac-b^2}{4a}$

*** The computation of the vertex is easy if one considers that this is an extremal of the function and the function is differentiable, thus

$\displaystyle \dot{f} = 2ax+b \xrightarrow[extremals]{for} \dot{f} = 0 \Rightarrow 2ax+b=0 \Rightarrow x = -\frac{b}{2a}$

…but this is a matter of another post regarding differentiation and derivatives.

How do these functions look like in graphs? Here, take a look

Increasing the power of the independent variable leads to third degree or cubic functions.

The standard form of the cubic functions is

$\displaystyle f(x) = ax^3 + bx^2 + cx + d, \quad a,b,c,d \in R, \; a \neq 0$

How do cubic functions look like in graphs? Well, they look like recumbent sigmoids S-shapes lying down…
If a is positive then the curve’s right-hand tail opens up, whereas if a is negative then the curve’s right-hand tail opens down. The y-intercept is the constant d,

$\displaystyle f(x=0) = ax_{x=0}^3 + bx_{x=0}^2 + cx + d \Rightarrow f(x=0) = y_i = d$

The x-intercepts can be calculated,

$\displaystyle f(x) = 0 \Rightarrow ax^3 + bx^2 + cx + d = 0 \Rightarrow x_k = -\frac{1}{3a} \left ( b + \zeta^k C + \frac{\Delta_0}{\zeta^k C} \right ), \\ k \in \{0,1,2\}, \; \zeta = -\frac{1}{2} + \frac{1}{2} \sqrt{3} i, \; i \text{ being the complex numbers symbol} \\ \Delta_0 = b^2 -3ac, \; \Delta_1 = 2 b^3 -9abc + 27 a^2 d, \; C = \sqrt[3]{\frac{\Delta_1 \pm \sqrt{\Delta_1^2 -4 \Delta_0^3}}{2}}$

which gives the obvious hint that one cubic function might have none, one, two, or at most three x-intercepts! Since this is extremely tedious, we usually employ factorization (if possible to be easily employed). We would even be really happy if the function was initially given in a factorized form like say,

$\displaystyle f(x) = (x+2)(x-3)(x+4)$

which otherwise would have been given as,

$\displaystyle f(x) = x^3 + 3x^2 -10x -24$

and it would be really messy…
Following the latter representation we readily know that the curve of this function opens up at the right-hand side (a>0) and that the y-intercept is

$\displaystyle f(x=0) = y_i = -24$

Following the factorized representation we readily know the x-intercept points, which are, in this case, three,

$\displaystyle x_k = \{ -4, -2, 3 \}$

And here is how this thing shows up in a graph

Apparently, the third-degree functions are the last of those functions for which to conclude about their appearance in a graph just by looking at their definition (and doing some simple calculations)

The whole concept of such functions generalized to what is called the polynomial functions.

Polynomial functions are the generalized form of n-th degree functions.

The standard form of the n-th degree polynomial functions is

$\displaystyle f(x) = a_nx^n + a_{n-1}x^{n-1} + \cdots + a_1x + a_0 \\ n \in N, \; a_0,\cdots ,a_n \in R, \; a_n \neq 0$

When moving to degrees higher than 4, although there are some clues on how some of them might look there is no formal or informal way to picture them. The things we know is that polynomial functions represent smooth curves without sharp corner edges and breaks.

For example, here is a graph (x-axis is scaled for better illustration) of a fifth degree polynomial function that is defined as

$\displaystyle f(x) = (x+5)(x-1)(x-2)(x+3)(x-4)$