Why are integers subset of reals?

10.3k Views Asked by At

In most programming languages, integer and real (or float, rational, whatever) types are usually disjoint; 2 is not the same as 2.0 (although most languages do an automatic conversion when necessary). In addition to technical reasons, this separation makes sense -- you use them for quite different purposes.

Why did they choose to say $\mathbb{Z} \subset \mathbb{R}$ in math? In other words, why are 2 and 2.0 considered the same?

When you are working in $\mathbb{R}$, does it make any difference whether some elements, eg. 2.0, also belong to $\mathbb{Z}$ or not?

11

There are 11 best solutions below

14
On BEST ANSWER

If you want to do things very formally, the integers are in fact not a subset of the reals: they are entirely different constructs (which I guess is more or less what you are saying in your question). However, the reals do contain the set $$\{\,\ldots,\,-2.0,\,-1.0,\,0.0,\,1.0,\,\ldots\,\}$$ which "looks just like" the integers. The usual terminology is that the sets are isomorphic. If you take any true statement in the arithmetic of integers, and replace each integer by the corresponding real number, the result will be a true statement about the real numbers. For example, the statement $$2+3=5$$ corresponds to $$2.0+3.0=5.0\ .$$

5
On

There are very many reasons, but first of all, if the real numbers did not contain the integers then it would be very very very difficult to do elementary arithmetic.

Computers don't have any way to represent "real numbers", they can represent only integers and rationals.

2
On

Why shouldn't we say $\mathbb Z\subset \mathbb R$?

In some cases it makes a lot of a difference to be able to conslude that some number obtainined by calculations within $\mathbb R$ is an integer as that allows us to do much more.

0
On

Formally speaking, this depends on the context.

Sometimes it's nice to have everything as a subset. It's easy to have that an integer is a real number, since it allows us to talk about the subspace topology, and that the operations coincide with what we expect them to be.

Sometimes it's not as nice, in which case we prefer to talk about "embedding", namely there is an embedding (which is unique up to some properties preserved) which identifies a subset of the real numbers with the integers.

If you want to build things from the ground up, then you're right. You build the natural numbers, then you build the integers and then the rationals and finally the real numbers (and you can continue). Each step comes with some canonical embedding, which we can then extend and have a canonical way to identify the natural numbers with a subset of the real numbers, and so on.

But sometimes it's nicer to say "Okay, now that we have $\Bbb R$ and all those canonical subsets which behave like $\Bbb{N,Z,Q}$ and so on, let's redefine them as these subsets." now we can talk about subspaces directly and subrings and subfields and so on and so forth.

Similarly you might want to have $\Bbb R$ as a subset of $\Bbb C$, and sometimes as a subspace (and therefore a subset) of $\Bbb R^3$; and sometimes you will want to have these objects separated as "different types", and keep track on the embeddings.

If you want to focus on the example of $2$, then note that $\Bbb Z$ and $\Bbb Q$ and $\Bbb R$ are all rings (whatever that means) which has a unit, and $1$ is that unit, so each has a version of $1$ and $2$ is defined as a shorthand for $1+1$. Does it matter where you do this addition? No, it doesn't, since the term $1+1$ is syntactical in the language of rings, and will have similar properties in $\Bbb Q$ and $\Bbb R$, and the same properties in $\Bbb Z$. Since it doesn't matter for the basic properties of $2$ in which of these rings we consider it, we can just think about those rings coincide on these numbers.

3
On

My Short Answer:

The Integers are not strictly a subset of the Reals. In particular, $0$ in the integers is not exactly the same as $0.0$ in the real numbers. (I use a common programming language notation here.) They behave slightly differently. The main example is:

$$0^0=1 \text{ and}$$ $$0.0^0=1 \text{, but}$$ $$0.0^{0.0} \text{ is undefined}$$

My Long Answer:

The integers $\{\ldots,-2,-1,0,1,2,\ldots\}$ are isomorphic to a subset of the real numbers, namely $\{\ldots,-2.0,-1.0,0.0,1.0,2.0,\ldots\}$. This means that the two sets behave identically with respect to addition and multiplication. So we usually say that the two sets are identical, for all practical purposes.

However, addition and multiplication are not all there is. Exponentiation (powers) can be defined in several ways, and for a variety of reasons (including historical and contextual) it is usually defined differently for the integers and for the reals.

Why do we usually say that $0^0=1$? The non-negative integers are isomorphic to the finite ordinal numbers, and some mathematicians such as von Neumann said that they are identical. So given non-negative integers $m$ and $n$ we can use any sets $M$ and $N$ with the appropriate sizes (cardinalities) and say that $m^n$ is the cardinality of the set of all functions from $N$ to $M$. This is proved in set theory to be possible and well-defined, and by this definition $0^0$ is indeed $1$. (The only function from the empty set to the empty set is the empty function--namely the empty set.)

Why do we usually say that $0.0^0=1$? For non-zero real values $x$, $x^0=1$, and it makes sense to let $0^0=lim_{x \to 0}x^0=1$. It is true that $0.0^n=0$ for positive integers $n$, but there is a break with that pattern for negative integers anyway. So who cares if $0.0^n$ differs from $0.0^0$? There is no good reason here to make $0.0^0$ undefined.

There are many other reasons for zero power integral zero being one. For example, we often write this as a polynomial for integral or real $x$: $$\sum_{i=0}^n a_ix^i$$

But the "constant" term there is $a_0x^0$, which makes sense only if $x^0=1$ for all $x$, integral or real, including zero.

For some more points, look at my favorite programming language, Object Pascal as implemented in Borland Delphi / Embarcadero Delphi. Zero power integral zero is implemented as IntPower$(0.0, 0)$, which evaluates as $1$, even if Power$(0.0,0.0)$ is undefined. Or look at the popular calculator TI-84 Plus, which evaluates $0^0$ and $0.0^0$ as $1$, though with a warning that it might be undefined.

Why do we usually say that $0.0^{0.0}$ is undefined? Here we look at $x^y$ for real $x$ and $y$ as the point $(x,y)$ approaches the point $(0,0)$ along various paths. If we set $y=kx$, $x^y$ approaches $1$ as both $x$ and $y$ approach zero from the right. If we set $x=0$, the limit is $0$. Other paths give other limits. Therefore we cannot say that $x^y$ has any limit as $x$ and $y$ approach zero, so we declare that $0.0^{0.0}$ is undefined.

Note that this reason, as well as others with which I am familiar, does not apply to $x^0$ where the zero is integral. So I conclude that integral zero and real zero are not exactly the same.


Note that this is similar to the real numbers not exactly being a subset of the complex numbers. For example, the cube root of real-valued $-1$ is $-1$ but the cube root of complex-valued $-1$ is $\frac 12+\frac{\sqrt 3}2i$. (Did I open another can of worms?)

4
On

Your question is in fact perfectly legitimate. Throughout most of the history of mathematics, the discrete realm of numbers was distinct from the continuous realm (the continuum), and of course the continuum was not thought of as made up of either points or numbers. Perhaps the first mathematician to have begun to bridge the gap was Simon Stevin already in the 16th century, and James Gregory in the 17th. There is some fine work on the latter by the historian Antoni Malet. See for example his thesis

Malet, Antoni; Studies on James Gregorie (1638-1675). Thesis (Ph.D.)–Princeton University. 1989.

and a number of other articles. The idea of uniting the two domains turned out to be fruitful as far as practicing mathematics is concerned, but as you correctly point out, in other fields such as computer science this assumption has to be re-examined!

5
On

Programming languages usually offer implicit conversions: you can usually use an integer in any context where a floating point number is required. This is very convenient.

Even in mathematics, we often need to convert integers into real numbers, and we have a canonical function $\mathbf{Z} \to \mathbf{R}$ for doing the conversion. This conversion is often done implicitly, so you rarely see actual notation for it.

In some styles of reasoning, particularly those motivted by algebra or category theory, we believe that "subset" is a bad notion: we should think about subobjects instead; loosely speaking, that means we think about monomorphisms relating objects. We might even coopt the notation $\subseteq$ for talking about subobjects instead of subsets.

Unfortunately, I don't believe there has been any work done in formalizing the mathematical usage of implicit conversions. I think there is work that can be done in that regard, just that I haven't seen anyone do it.

However, in more traditional, set-theoretic style notation, we try to arrange so all of the implicit conversions are identity maps. This is a very powerful simplification, both in the use of and in the organization of implicit conversions. But it can obscure what's going on -- it can be very difficult to make the transition to contexts where the conversions need to be explicit.


Of course, none of this really reflects history. I expect the most accurate response to "why are things this way?" is simply that once upon a time people believed there was One True Number System, and "being an integer" is merely a property that some numbers have and others don't.

0
On

It's practical to consider the reals and the integers as points on the same geometrical line, even though the axiomatic construction of reals may seem far away from the integers.

In programming language all types has to be declared and treated different. Even different representations of integers are treated different (as Integer and BigInteger).

And there are no reals at all in programming, just float: truncated reals.

0
On

@David's explained that $\{\dots, -2.0, -1.0, 0.0, 1.0, 2.0, \dots\}$ can be considered the set of integers because the sets have the same mathematical properties. I'm complementing this by adding another point of view, trying to explain why I don't see this only as a mathematical isomorphism but something more intuitive.

Natural numbers ($\mathbb{N}$) are the objects that can be used for counting things: you can for example have $0$, $1$, or $2$ apples.

Integers ($\mathbb{Z}$) are an extended version of these objects used for counting: now you can also subtract them as you wish. Why $\mathbb{N}$ is considered as a subset of $\mathbb{Z}$? Because it is natural to use them in a similar way: if you have five apples, and you eat two of them, how many apples do you have in the end? $5 + (-2) = 3$.

Now consider real numbers ($\mathbb{R}$). Here's an example: For which $x\in\mathbb{R}$ is $\sin(\pi x)$ zero? When $x$ has a certain property. If $x>0$ has this property, how many zeros does $\sin$ have in $(0,\pi x]$? The answer $x$ is an object of $\mathbb{R}$, but it is now used for counting things! So it is a natural number.

2
On

The statement $ℤ ⊂ ℝ$ is in fact true, $ℤ ⊂ ℚ$ is also true. $3 = 3.0 = \sqrt{9} = \frac{6}{2}$ It does not really matter how you represent the number, they are all the same number: three. What does in fact matter is the domain you are operating in. For example $\sqrt{2}$ is not defined in the space of $ℤ$, nor is $2-3$ defined in $ℕ$. While they are all perfectly defined in $ℝ$ All these sets $ℕ, ℤ, ℚ, ℝ$ are infinite, while $ℝ$ is also nondenumerable.

entirely different set of numbers are the sets representable by computers, eg int32 (32 bit integer) and float32 (32 bit IEEE floating point number). because 32bits can only have $2^{32}$ distinct states, we can say $|int32| ≤ 2^{32} ∧ |float32| ≤ 2^{32}$. And both sets have numbers non-representable in the other format. Folloing statements are true

\begin{align*} int32 &⊂ ℤ \\ float32 &⊂ ℚ ∪ \{-∞,∞,NaN\} \\ -∞,∞,NaN &\notin ℝ \\ int32 &\not⊂ float32 \\ float32 &\not⊂ int32 \\ \end{align*}

A $1$ from int32 is still just a 1. A $1$ in float32 is also just one. Same is for all numbers in $int32 ∩ float32$. They are just different representations. You have to be careful when casting to another type, because when your number is not representable in the other type, you have loss of information.

just because in some programming languages 2.0 and 2 are different things, doesn't mean that 2.0 and 2 are different in math. Math on computers is very different from math in algebra class.

to come back to your question: do not mix up ℤ and ℝ from math with float and int in programming languages. And on a computer you are never really working in ℝ. Some symbolic prgramming languages allow you to deal with π exactly, but here the computer just curcumvents the calculation by applying transformation rules (like you would do on a paper).

1
On

$ \newcommand{\N}{\mathbb{N}} \newcommand{\Q}{\mathbb{Q}} \newcommand{\Z}{\mathbb{Z}} \newcommand{\R}{\mathbb{R}} \newcommand{\w}[1]{\widetilde{#1}} \newcommand{\set}[1]{\left\{ #1 \right\}} \newcommand{\setb}[2]{\left\{ #1 \, \middle| \, #2 \right\}} \newcommand{\seq}[1]{\left( #1_i \right)_{i=1}^\infty} \newcommand{\qc}{\Q^\omega_c} $ I want to address a perhaps more general question, which was brought up in a question that was later redirected to this post. (I recognize that this ultimately won't touch on much of the computer science stuff that OP's question was geared towards.)

That question, essentially, being:

In the formal construction of the number systems, we readily see they're not subsets of each other. Yet often have this hierarchy and claim that $\N \subseteq \Z \subseteq \Q \subseteq \R \subseteq \cdots$; question being, why?

Naively, these inclusions hold. So why do they not hold in the formal construction? We can also ask the converse: why do we observe the inclusions not holding formally, but claim they do anyways?


Introduction:

Firstly, there isn't a meaningful reason to consider them not subsets of each other. There's usually not much to benefit by doing so..

Yes - formally, in the usual Peano constructions - they're not subsets. After all:

  • $\N$ is just a collection of sets containing empty sets nested in a fancy manner.
  • $\Z$ is just a collection of equivalence classes on $\N^2$ (sets of sets).
  • $\Q$ is just a collection of equivalence classes on $\Z \times \N$ (so sets of sets of sets).
  • And if you want to go even further, you can construct $\R$ in various ways, e.g. equivalence classes of sequences (so sets of sets of sets of sets).

When formally defined in this fashion, yes, there is no subset relation between them.

However, bear in mind what this construction is trying to encapsulate and formalize. The definitions of $\N,\Z,$ etc. came after the sets themselves. We simply wanted to formalize their construction. This is perhaps the most key insight here: we wanted to define something, essentially, that is isomorphic to our naive definitions, yet still grounded rigorously.

Luckily, each have a natural embedding into the one above it, as we'll discuss.

Sadly, the embeddings are not as obvious as "just look at it", because it has to be grounded rigorously. One nice thing that the Peano construction does is it starts with something we can define very easily from the $\mathsf{ZFC}$ axioms alone: the empty set, $\varnothing$. (Read more on it, e.g. here). This logical minimalism then lets us simply define structures (e.g. equivalence relations) and symbols (e.g. $+,-,1,0,3,-3,1/2$) as need be to get as far as we need. This ultimately comes at the cost of not having a "just look at it" inclusion, but instead the prospect of embeddings (something that is virtually identical to what we want contained inside).

So let's dive in to the details...


The Constructions:

First, recall the constructions. We'll speed through them for the most part and not go too deep into the woods as to how one might define operations within these (though these can be found elsewhere fairly easily).

  • For simplicity, we will say $0$ is not a natural number. We define the symbol $0 := \varnothing$ and define the symbol $n$ (for $n$ one of our usual Arabic numerals) to be given by $n+1 := \set{n} \cup n$. Again, this is just defining the sets, the symbols for the Arabic numerals, i.e. we have

$$\begin{alignat*}{99} 1 &:= \set{\varnothing} &&= 0 \cup \set 0 \\ 2 &:= \set{\varnothing, \set{\varnothing}} &&= 1 \cup \set{1} \\ 3 &:= \set{\varnothing, \set{\varnothing}, \set{\varnothing, \set{\varnothing}}} &&= 2 \cup \set{2} \\ &\vdots \end{alignat*}$$

  • $\Z$ is formed from an equivalence relation on $\N \times \N$. We'll denote this by $\sim_s$ to remind us of subtraction. Then $(a,b) \sim_s (c,d)$ iff $a+d=b+c$. $\Z$ is the collection of equivalence classes here, i.e. $\Z := \N^2/\sim_s$ from definition.

    • You can think of pairs $(a,b) \in \N^2$ as somehow representing the naive difference $a-b$, and we simply are setting all such pairs equivalence to each other. (Notice that $$a+d = b+c \iff a-b = c-d$$ in the naive sense.)

    • From here, we again begin defining symbols as shorthand. For the symbol $n$, we define $n$ to be the class of $\Z / \sim_s$ where $a-b = n$. Or put more properly, $a-b$ (be it positive or negative, and we simplify it in the naive way) represents the equivalence class of all pairs equivalent to $(a,b)$.

  • $\Q$ is likewise formed from an equivalence relation on $\Z \times \N$. Call this $\sim_d$ to remind us of division. Then $(a,b) \sim_d (c,d)$ iff $ad=bc$. The equivalence classes of this give us $\Q$, i.e. we define $\Q := (\Z \times \N) / \sim_d$.

    • Again, similar to the previous, pairs $(a,b) \in \Z \times \N$ are representative of the fractions $a/b$. I'll leave the justification to you.

    • And again, similar to the previous, we define symbols as shorthand. The symbol $a/b$ represents the equivalence class of all pairs equivalent to $(a,b)$.

  • $\R$ can be defined in several ways. Perhaps the simplest is by taking equivalence classes of Cauchy sequences in $\Q$, and saying they have equivalent limits. Define $$\Q^\omega := \setb{ (q_i)_{i=1}^\infty }{ q_i \in \Q } = \text{all rational sequences}$$ Define the subspace $$\Q^\omega_c := \setb{ q := \seq q \in \Q^\omega }{ q \text{ is Cauchy}}$$ Let $a := \seq a, b := \seq b \in \qc$ be two such sequences. We say they are equivalent, denoted $\sim_\ell$ (to bring to mind limits) if they converge to the same value, i.e. $$a \sim_\ell b \iff \lim_{n \to \infty} a_n = \lim_{n \to \infty} b_n$$ Then $\R := \qc / \sim_\ell$, the equivalence classes of these sequences.


The Embeddings:

Now:

  • $\N$ embeds into $\Z$ naturally by letting $b=d=0$ in the previous statements. That is, we can define the set $$\w \N := \setb{ (a,b) \in \N^2 }{ b = 0 } = \set{ (a,0) \in \N^2} \subseteq \N^2$$ Notice how, consequently, each $a \in \N$ is associated to a pair in $\w\N$, and any pair $(c,d)$ is related to something in $\w\N$, i.e. $(a,0) \sim_s (c,d)$ iff $c-d=a$ (in the naive sense). We can then, in $\Z := \N^2 /\sim_s$ associate each $a \in \N$ to some equivalence class, one which contains $(a,0)$, giving our embedding.

  • Similarly consider embedding $\Z$ into $\Q$. This largely arises from associating $b=d=1$. That is, we may define $$\w\Z := \setb{ (a,b) \in \Z \times \N }{ b = 1 } = \setb{ (a,1) }{ a \in \Z } \subseteq \Z \times \N$$ $\w\N$ likewise has an association within this, but it's not necessary owing to the previous embedding. Thus, like before, any $(a,1) \in \w\Z$ has its own equivalence class in $\Q := (\Z \times \N)/\sim_d$, those where (naively) we have the fractions which (naively) simplify to $a/1$, or simply $a$.

  • The embedding $\Q$ into $\R$ is similarly obvious. We simply take $$ \w\Q := \setb{ q := \seq q \in \qc }{ q_i = q_1 \; \forall i \ge 1, q_1 \in \Q } \subseteq \qc $$ That is, $\w\Q$ is just all of the constant rational sequences. Clearly the uniqueness of limits in $\R$ ensures that each $q \in \w\Q$ thus has its own equivalence class.

You can proceed even further with this with other constructions of $\Bbb C$, etc., as you deem necessary but I'll leave it here.


What does this give us?

In summary, what we have seen is that, in a given structure ($\Z,\Q,\R$), there are substructures like those below them in the hierarchy:

  • $\Z$ has an analogue of $\N$ in it, which we called $\w\N$
  • $\Q$ has an analogue of $\Z$ in it, dubbed $\w\Z$
  • $\R$ has an analogue of $\Q$ in it, dubbed $\w\Q$

These substructures are isomorphic to what they were originally, in the sense they have all of the same properties as well.

The key point being that, by the time we have all of these analogous structures in $\R$, there are already copies within $\R$ that behave like the original objects $\N,\Z$, etc., which are subsets (even if the originals are not), and still satisfy all of the properties we want.

So when we then get to the point of wanting to use these in mathematics, we find no issue tying this loop all back together and simplify refer to $\w\N$ as $\N$, $\w\Q$ as $\Q$, and so on. Perhaps it overloads the notation a bit to do so, but since these isomorphic copies follow the same rules as both the naive counterparts we love and know, and as the formal counterparts too, there's rarely ever any issue in doing this -- except when, perhaps, dealing with all of these constructions directly.