A mathematical function is a rule that maps each point in one set (the domain) to a point in another set (the codomain).
Functions can also be called maps, mappings, or transformations.
Functions are often denoted by single letters, such as f.
f(x) represents the value of the function f at the point x.
If X is the domain and Y the codomain of the function f, this is written as f : X \rightarrow Y or X \xrightarrow{f} Y.
To define a function, a formula can be used, e.g., f(x) = x^2, x \in R, where the domain is specified.
Alternatively, the notation x \mapsto x^2 can be used, read as “x maps to x squared,” but the domain must be indicated separately.
For small finite sets, a table can define a function:
Input | 1 | 2 | 3 | 4 |
---|---|---|---|---|
Output | 1/10 | 2/10 | 3/10 | 4/10 |
Functions can map any set to any set. For instance, one could have:
It's crucial to be precise about the domain of a function.
For example, f(x) = \sqrt{x} is only properly defined for x \geq 0.
The exponential function is denoted as
R \xrightarrow{\exp} (0, \infty)
The logarithmic function is denoted as
(0, \infty) \xrightarrow{\log} R
These functions are inverses of each other:
In this course, \log(x) always denotes the base e logarithm (natural logarithm).
Constant functions (e.g., x \mapsto c) and identity functions (e.g., x \mapsto x) are simple but important.
It is more correct to say x \mapsto x^2 rather than x^2 is a function.
*When using f for the PMF, S for the sample space, and x for points of S, if S \subset R, then we often use X for the identity random variable x -> x
\begin{aligned}
E(X) &= \sum{x \in S} xf(x) \ E{g(X)} &= \sum{x \in S} g(x)f(x)
\end{aligned}
How statisticians really think about probability and expectation.
Hence the binomial distribution has PMF
f(x) = \binom{n}{x} p^x (1 − p)^{n−x}, \quad x = 0, 1, …, n
The sample space is {0, 1, …, n} and the parameter space is [0, 1] just like for the Bernoulli distribution.