Artificial Intelligence 🤖
Function Basics
Definitions

Definitions

Consider a set of ordered pairs, for example (1,2),(2,4),(3,5),(2,6),(1,3)(1,2),(2,4),(3,5),(2,6),(1,-3). The first elements in the ordered pairs, i.e. {1,2,3}1\{1,2,3\}^{1} (we will call these the xx values) form the domain while the second elements i.e. {2,4,5,6}\{2,4,5,6\} (we will call these the yy values) form the range. See Subsec. 1.1.1 for more on the domain and range. A relation is simply a set of ordered pairs.

Now, if we impose the following rule on a relation, it becomes a function: a function is a set of ordered pairs in which each xx-element has only one yy-element associated with it. The ordered pairs above are relations and not functions because certain xx-elements are paired with more than one unique yy-element [from above, the pairs (1,2)(1,2) and (1,3)(1,-3) as well as (2,4)(2,4) and (2,6)](2,6)]. We clarify these definitions with an example.

Example: Determine if each of the following are functions

y=x2y2=x.\begin{aligned} y & =x^{2} \\ y^{2} & =x . \end{aligned}

Solution

The first equation is a function since given an xx and squaring it gives only one possible value of yy. For the second equation, suppose x=4x=4; this yields y2=4y^{2}=4. We can use 2 and -2 as the possible yy values for a single xx rendering the second equation a relation and not a function.

Functional notation

Functions are usually referred to by the notation f(x)f(x) read as 'function of xx '. The first equation in Example 1.1 can therefore be written as

f(x)=x2f(x)=x^{2}

The f(x)f(x) notation is another way of representing the yy-value. Another common notation is the following:

f:xx2,f: x \mapsto x^{2},

1{ }^{1} Note that {} is the symbol for set. interpreted as 'the function ff maps xx to x2x^{2} '.

Domain & range

Here we revisit the concepts of the domain and range of a function. The domain, D\mathcal{D} of a function is the set of all values that can be plugged into a function such that the function exists and yields a real number. It follows that for the domain we need to avoid division by zero, square roots of negative numbers, logarithms of zero, and logarithms of negative numbers. The range, R\mathcal{R} of a function is the set of all possible values that a function can take (the output).

Example 1.2 Determine the domain and range of the following functions

(i) f(x)=x+2f(x)=\sqrt{x+2};

(ii) f(x)=2x3f(x)=\frac{2}{x-3};

(iii) f(x)=xexf(x)=x e^{x}.

Solution For the first equation, the domain is x2x \geq-2 and the range is f(x)0f(x) \geq 0. For the second equation, the domain is all real numbers, except for x=3x=3, i.e. D=\mathcal{D}= (,3)(3,)(-\infty, 3) \cup(3, \infty) and the range is all real numbers except zero. Note that an interval denotes by (a,b)(a, b) is an open interval while [a,b][a, b] is a closed interval with the endpoints included. Finally, for the third equation, the domain is the set of all real numbers, i.e. D=R\mathcal{D}=\mathbb{R} and the range is ye1y \geq-e^{-1} (the function has a minimum at x=1x=-1 corresponding to the value e1)\left.-e^{-1}\right).

Even & odd functions

A function is even if its graph is unchanged under reflection in the yy-axis [see Fig. 1.1(a)]. This is equivalent to,

f(x)=f(x)f(-x)=f(x)

Examples of even functions are x2,x,cos(nx)x^{2},|x|, \cos (n x). A function is odd if its graph is symmetrical about the origin (i.e. unchanged when reflected about both xx - and yy-axis [see Fig. 1.1(b)]. Equivalently,

f(x)=f(x).f(-x)=-f(x) .

Examples of odd functions are x,x3,sin(nx)x, x^{3}, \sin (n x). Note that the definitions of odd and even functions make sense if the domain D\mathcal{D} is symmetric, i.e. if xx is in D\mathcal{D}, so is x-x. A function can be neither even nor odd. However, any function f(x)f(x) may be expressed as the sum of an even and an odd function as follows,

f(x)=12[f(x)+f(x)even +f(x)f(x)odd ].f(x)=\frac{1}{2}[\underbrace{f(x)+f(-x)}_{\text {even }}+\underbrace{f(x)-f(-x)}_{\text {odd }}] .

An example is the exponential function which we can easily show that is neither even nor odd using Eqs. (1.1) and (1.2). For the exponential function, Eq. (1.3) yields

ex=ex+ex2+exex2e^{x}=\frac{e^{x}+e^{-x}}{2}+\frac{e^{x}-e^{-x}}{2}

where the hyperbolic cosine given by coshx=(ex+ex)/2\cosh x=\left(e^{x}+e^{-x}\right) / 2 is the even part and the hyperbolic sine given by sinhx=(exex)/2\sinh x=\left(e^{x}-e^{-x}\right) / 2 is the odd part.

(a)

(b)

Figure 1.1: (a) The graph of the even function f(x)=x2f(x)=x^{2} satisfying Eq. (1.1); it is symmetrical about the yy-axis. (b) The graph of the odd function f(x)=x3f(x)=x^{3} satisfying Eq. (1.2); it is symmetrical about the origin.