# Can I define a function randomly

$D \subset \mathbb R$ and we have two functions $U: D \to \mathbb R$ and $L: D \to \mathbb R$, with the given property that $\forall x \in D: U(x) > L(x)$.

Because $U(x) \neq L(x)$ there are infinitely many rational numbers between them. I want to choose one, and call it $q(x)$. It does not matter which one.

Infact I want to define a function $q:D \to \mathbb Q$ such that $L(x) < q(x) < U(x)$. Is it possible to define such a function without explicitly saying what $q(x)$ is?

Note: $D$ does not have to be countable.

• "rational numbers… …I want to choose one, and call it $q(x)$". I'm confused - are you finding a function or a number? – Jam Jun 15 '18 at 9:52
• I'm trying to define a function, by choosing a rational number between two given numbers. It does not matter which rational I choose. – Oria Gruber Jun 15 '18 at 9:53
• I still think it's unclear what you mean - does this function only give rational outputs? Or does the function explicitly pass a given rational? Or is it a constant function? I don't see why picking a rational number would define a function - If I said the number $1/2$, would this define a function? – Jam Jun 15 '18 at 9:56
• Have you come across Axiom of Choice? Your function $q$ exists by Axiom of Choice. – Kavi Rama Murthy Jun 15 '18 at 9:57
• @Jam the function only gives rational outputs. It could be a constant function, sure. But we don't know if $q(x) = \frac{1}{2}$ for all $x$ is a good choice, since we also require that $L(x) < q(x) < U(x)$, and we don't explicitly know that $\frac{1}{2}$ is between $L(x)$ and $U(x)$ for any given $x$. – Oria Gruber Jun 15 '18 at 10:00

You can take the shortcut via the Axiom of Choice, which handles precisely this case (even for domains $D$ much larger than $\Bbb R$).
Or you can even define $q(x)$ constructively: Given $x$, let $$n=\min\left\{\,k\in\Bbb N\biggm| k>\frac1{U(x)-L(x)}\,\right\}$$ and $$m = \min (\Bbb Z\cap (nL(x),nU(x))).$$ Then $$L(x)<\frac mn<U(x).$$