Questions tagged [functions]

For elementary questions about functions, notation, properties, and operations such as function composition. Consider also using the (graphing-functions) tag.

A function $f$ defined on a set $X$ is an assignment of an element in some set $Y$ to each element of $X$. The set $X$ is called the domain of the function, and $Y$ is called the codomain. The elements of $X$ are the inputs to the function, and the elements of $Y$ are the potential outputs. For some input $x \in X$, its corresponding output in $Y$ is denoted $f(x)$. Not every element of $Y$ needs to be the output corresponding to some input, though: the subset of $Y$ containing the elements that are an output of the function is called the range of $f$. When a function $f$ has domain $X$ and codomain $Y$, this is signified by writing $f \colon X \to Y$, and the assignments of inputs to outputs are signified by writing $f\colon x \mapsto f(x)$.

If you have a function whose codomain is the domain of another function, you can compose those two functions. In symbols, if you have a function $f\colon X \to Y$ and a function $g \colon Y \to Z$, their composite is a function $g\circ f\colon X\to Z$ defined by the assignment $g\circ f\colon x \mapsto g(f(x))$.

For many examples of functions, the domain and range of the function are topological spaces, meaning that they are equipped with some notion of geometry. In this case, we like to think of the function $f\colon X\to Y$ geometrically as the subset of the points $(x,f(x))$ in the topological space $X \times Y$. This subset of all the input-output pairs is called the graph of $f$.

Often, mathematics textbooks will define a function slightly more rigorously than this, though. They'll say that a function $f \colon X \to Y$ is a relation $R$ on the set $X \times Y$ such that

  1. For each $x \in X$ there is some $y \in Y$ such that $xRy$. Each input needs an output.
  2. If $xRy$ and $xRz$, then $y=z$. Each input needs exactly one output.

Here are a bunch of examples of functions:

  • Many examples of functions covered in elementary and high school have as their domain and codomain the real numbers $\mathbf{R}$. A basic example is the function $f \colon \mathbf{R} \to \mathbf{R}$ defined by the rule $f(x) = x^2$. Thinking geometrically, the graph of $f$ is the set of all points $(x,x^2)$ in the plane $\mathbf{R}^2$, and this forms a parabola. Note that while the codomain of this function is $\mathbf{R}$, the range consists of only the non-negative real numbers.

  • Here's a silly example. For any set $X$ we can define an identity function $\mathbf{1}_X$ with domain and codomain $X$ such that $\mathbf{1}_X \colon x \mapsto x$.

  • Let $W$ denote the set of all strings of letters of the alphabet, so like $\text{npr}$ or $\text{asdfasdf}$ or $\text{butt}$, for example. And let $\mathbf{N}$ denote the set of natural numbers. We can define a function $\ell\colon W \to \mathbf{N}$ such that $\ell$ assigns to each word its length. So $\ell(\text{defenestration}) = 14$. Also $\ell(\text{butt})=4$.

  • Using the same set $W$ in the last example, let's define another function $\tau\colon W \to W$ such that $\tau$ "reverses" a word. So $\tau(\text{defenestration}) = \text{noitartsenefed}$, and $\tau(\text{butt}) = \text{ttub}$. A few neat properties of $\tau$ that deserve to be pointed out, $\tau \circ \tau = \mathbf{1}_W$, and also $\ell\circ\tau = \ell$.

34574 questions
222
votes
4 answers

Overview of basic results about images and preimages

Are there some good overviews of basic facts about images and inverse images of sets under functions?
195
votes
9 answers

How to define a bijection between $(0,1)$ and $(0,1]$?

How to define a bijection between $(0,1)$ and $(0,1]$? Or any other open and closed intervals? If the intervals are both open like $(-1,2)\text{ and }(-5,4)$ I do a cheap trick (don't know if that's how you're supposed to do it): I make a…
user1411893
  • 2,173
163
votes
1 answer

What functions can be made continuous by "mixing up their domain"?

Definition. A function $f:\Bbb R\to\Bbb R$ will be called potentially continuous if there is a bijection $\phi:\Bbb R\to\Bbb R$ such that $f\circ \phi$ is continuous. So one could say a potentially continuous (p.c.) function is "a continuous…
144
votes
1 answer

Identification of a curious function

During computation of some Shapley values (details below), I encountered the following function: $$ f\left(\sum_{k \geq 0} 2^{-p_k}\right) = \sum_{k \geq 0} \frac{1}{(p_k+1)\binom{p_k}{k}}, $$ where $p_0 > 0$ and $p_{k+1} > p_k$ for all $k$. In…
105
votes
12 answers

Is there a bijective map from $(0,1)$ to $\mathbb{R}$?

I couldn't find a bijective map from $(0,1)$ to $\mathbb{R}$. Is there any example?
ieb
  • 1,067
82
votes
8 answers

How do I prove that a function is well defined?

How do you in general prove that a function is well-defined? $$f:X\to Y:x\mapsto f(x)$$ I learned that I need to prove that every point has exactly one image. Does that mean that I need to prove the following two things: Every element in the domain…
Kasper
  • 13,940
80
votes
7 answers

Functions that are their own inverse.

What are the functions that are their own inverse? (thus functions where $ f(f(x)) = x $ for a large domain) I always thought there were only 4: $f(x) = x , f(x) = -x , f(x) = \frac {1}{x} $ and $ f(x) = \frac {-1}{x} $ Later I heard about a fifth…
Willemien
  • 6,730
76
votes
6 answers

Why do engineers use derivatives in discontinuous functions? Is it correct?

I am a Software Engineering student and this year I learned about how CPUs work, it turns out that electronic engineers and I also see it a lot in my field, we do use derivatives with discontinuous functions. For instance in order to calculate the…
72
votes
7 answers

How to straighten a parabola?

Consider the function $f(x)=a_0x^2$ for some $a_0\in \mathbb{R}^+$. Take $x_0\in\mathbb{R}^+$ so that the arc length $L$ between $(0,0)$ and $(x_0,f(x_0))$ is fixed. Given a different arbitrary $a_1$, how does one find the point $(x_1,y_1)$ so that…
72
votes
6 answers

Nice expression for minimum of three variables?

As we saw here, the minimum of two quantities can be written using elementary functions and the absolute value function. $\min(a,b)=\frac{a+b}{2} - \frac{|a-b|}{2}$ There's even a nice intuitive explanation to go along with this: If we go to the…
67
votes
8 answers

Is there a way to get trig functions without a calculator?

In school, we just started learning about trigonometry, and I was wondering: is there a way to find the sine, cosine, tangent, cosecant, secant, and cotangent of a single angle without using a calculator? Sometimes I don't feel right when I can't do…
66
votes
18 answers

Is there a simple function that generates the series; $1,1,2,1,1,2,1,1,2...$ or $-1,-1,1,-1,-1,1...$

I'm thinking about this question in the sense that we often have a term $(-1)^n$ for an integer $n$, so that we get a sequence $1,-1,1,-1...$ but I'm trying to find an expression that only gives every 3rd term as positive, thus it would…
65
votes
6 answers

Create unique number from 2 numbers

is there some way to create unique number from 2 positive integer numbers? Result must be unique even for these pairs: 2 and 30, 1 and 15, 4 and 60. In general, if I take 2 random numbers result must be unique(or with very high probability…
drizzt
  • 719
64
votes
6 answers

Do harmonic numbers have a “closed-form” expression?

One of the joys of high-school mathematics is summing a complicated series to get a “closed-form” expression. And of course many of us have tried summing the harmonic series $H_n =\sum \limits_{k \leq n} \frac{1}{k}$, and failed. But should we…
63
votes
9 answers

On the functional square root of $x^2+1$

There are some math quizzes like: find a function $\phi:\mathbb{R}\rightarrow\mathbb{R}$ such that $\phi(\phi(x)) = f(x) \equiv x^2 + 1.$ If such $\phi$ exists (it does in this example), $\phi$ can be viewed as a "square root" of $f$ in the sense…
1
2 3
99 100