monotonic function
Monotonic function
The images above show a monotonically non-decreasing or increasing function (left), and a monotonically non-increasing or decreasing function (right)
A monotonic function is a function which is either entirely non-increasing or non-decreasing.
Definition
A function is termed monotonically increasing if for all \[x\] and \[y\] such that \[x\le y\implies f(x)\le f(y)\], so \[f\] preserves its order. In simpler words, it means in a monotonically increasing function, if you choose any point \[x\], then for every point \[y\] that is equal to or greater than \[x\], the value \[f(y)\] will be at least as large as \[f(x)\]. This ensures that the function never decreases as you move from left to right.
Likewise, a function is monotonically decreasing if for all \[x\] and \[y\] such that \[x\le y\implies f(x)\ge f(y)\], so it reverses the order.
When a function preserves its order, it maintains the original sequence of elements, meaning that if one input is less than or equal to another (\[x\le y\]), their corresponding outputs will also reflect the same relationship (\[f(x)\le f(y)\]). Conversely, a function reverses order when it inverts the original sequence, so that if one input is less than or equal to another (\[x\le y\]), the corresponding outputs will be greater than or equal (\[f(x)\ge f(y)\]).
A stronger requirement for monotonic functions would be called strictly monotone, where the definition would be \[x<y\implies f(x)<f(y)\] or \[x<y\implies f(x)>f(y)\].