Post · 2 min read· pp. 40–41

1.2.4 Functions


Video Available Video Available

We often need the concept of functions in probability. A function ff is a rule that takes an input from a specific set, called the domain, and produces an output from another set, called co-domain. Thus, a function maps elements from the domain set to elements in the co-domain with the property that each input is mapped to exactly one output. For a function ff, if xx is an element in the domain, then the function value (the output of the function) is shown by f(x)f(x). If AA is the domain and BB is the co-domain for the function ff, we use the following notation:

f:A→B.f:A \rightarrow B.


Example

  • Consider the function f:R→Rf:\mathbb{R} \rightarrow \mathbb{R}, defined as f(x)=x2f(x)=x^2. This function takes any real number xx and outputs x2x^2. For example, f(2)=4f(2)=4.
  • Consider the function g:{H,T}→{0,1}g:\{H,T\} \rightarrow \{0,1\}, defined as g(H)=0g(H)=0 and g(T)=1g(T)=1. This function can only take two possible inputs HH or TT, where HH is mapped to $0$ and TT is mapped to $1$.

The output of a function f:A→Bf: A \rightarrow B always belongs to the co-domain BB. However, not all values in the co-domain are always covered by the function. In the above example, f:R→Rf:\mathbb{R} \rightarrow \mathbb{R}, the function value is always a positive number f(x)=x2≥0f(x)=x^2 \geq 0. We define the range of a function as the set containing all the possible values of f(x)f(x). Thus, the range of a function is always a subset of its co-domain. For the above function f(x)=x2f(x)=x^2, the range of ff is given by

Range(f)=R+={x∈R∣x≥0}.\textrm{Range}(f)=\mathbb{R}^{+}=\{x \in \mathbb{R} | x \geq 0 \}.

Figure 1.14 pictorially shows a function, its domain, co-domain, and range. The figure shows that an element xx in the domain is mapped to f(x)f(x) in the range.

Function

Fig.1.14 - Function f:A→Bf: A \rightarrow B, the range is always a subset of the co-domain.