# Why are integers subset of reals?

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?

• In the first place, ${\mathbb Q}$ and ${\mathbb R}$ are successive extensions of ${\mathbb Z}$; so ${\mathbb Z}\subset{\mathbb R}$ to begin with. Dec 7, 2014 at 10:52
• Looking in the other direction, one reason not to consider $\mathbb Z\subset \mathbb R$ in a programming language is that 1 / 3 = 0 but 1. / 3. = 0.333.... This breaks the Liskov substitution principle. Dec 7, 2014 at 15:04
• I think it's worth mentioning that real numbers in typical programming language are fixed-size, that roughly means fixed-precision, so they are very different from real numbers as defined in mathematics. Floating-point number types are an engineering artifact without any relation to clear and well-defined mathematical concept. Google "What Every Computer Scientist Should Know About Floating-Point Arithmetic" for the details. Dec 8, 2014 at 19:39
• "Real" types in programming languages have almost nothing to do with the set of real numbers as defined by mathematicians. k-bit floating-point numbers in programming languages are an attempt to map real numbers onto 2^k distinct values and while the IEEE standards are fairly universal there exist other mappings with very different properties.
– Chuu
Dec 8, 2014 at 20:33
• You write your question as if programming languages had been around "forever" and then these math guys came along and decided that, suddenly, integers are a special kind of real number. It was actually precisely the other way around. Dec 8, 2014 at 22:19

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\ .$$

• The statement “2 does not divide 1” is true in the integers, but the corresponding statement is false in the reals. What you write is only correct for existential sentences (in the language of rings), not for more complicated statements. Dec 7, 2014 at 20:01
• The correct translation of "$2$ does not divide $1$" is that there is no element $x$ of $\{\ldots,-1.0,0.0,1.0,\ldots\}$ such that $1.0=2.0x$. This statement is true. Dec 7, 2014 at 20:48
• You want the remainder to be strictly smaller than the divisor. Dec 8, 2014 at 3:18
• @Lawtonfogle If by $2$ you mean the element of $\mathbb{Z}$ and by $3.0$ the element of $\mathbb{R}$ defined formally in the way David mentions, then $2+3.0$ is (strictly speaking) meaningless. You can't just add two things; there must be an addition operation you're using, and there's no standard addition operation that takes an integer on one side and a real number on the other. Dec 8, 2014 at 19:04
• Some programming languages have a thing called "coercion": a way to automatically cast elements of some types into other types when the need arises (i.e., when an operator which is defined on the other type is applied to an element of a smaller type). I am not sure how good the theory behind this is understood (issues like this tend to break into Univalent Foundations occasionally). But mathematicians tacitly use coercion all the time -- even viewing $\mathbb{Z}$ as a subset of $\mathbb{Q}$ is an instance of coercion if you define rational numbers as fractions! Dec 9, 2014 at 4:34

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.

$$\newcommand{\N}{\mathbb{N}} \newcommand{\Q}{\mathbb{Q}} \newcommand{\Z}{\mathbb{Z}} \newcommand{\R}{\mathbb{R}} \newcommand{\w}{\widetilde{#1}} \newcommand{\set}{\left\{ #1 \right\}} \newcommand{\setb}{\left\{ #1 \, \middle| \, #2 \right\}} \newcommand{\seq}{\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.

• (+1) Excellent answer. Jan 24, 2022 at 9:44

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.

• Many programming languages have implicit conversions, but the more mathematical ones actually tend not to – I think it would be a horrible mess to properly formalise such conversions. What languages like Haskell use instead is just as powerful and convenient, but immediately safe&sound, mathematically: in Haskell, a literal like 5 has no particular type at all. Rather, a type is inferred from the context (Hindley-Milner type system). So in 5 + length "bla", you have 5 :: Int, but in 5 + pi you have 5 :: Double. Dec 7, 2014 at 20:46
• Arguably, rather a lot of work in the last 50-60 years of programming language research has concerned "formalizing the mathematical usage of implicit conversions" well enough to program a computer to understand something that a human with mathematical training would understand, while striking a reasonable balance between internal consistency and approximating the way real mathematics is written. E.g. in the guise of type inference for type systems with a subtyping relation. Dec 7, 2014 at 20:54
• @Henning: Good point: I hadn't thought about it from that angle; my opinion on that point could very well just be a function of following my own mathematical interests rather than a function of reality.
– user14972
Dec 7, 2014 at 21:26
• As @HenningMakholm remarks, there is a lot of work on formalizing the mathematical (or logical) principles of such embeddings, usually called coercions. This is of particular interest in computer assisted mathematical formalization, see e.g. Luo or Wenzel.
– cody
Dec 12, 2014 at 1:09

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.

@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.

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).

• Thanks for the answer! In my question, the programming languages' way was just an example. The real question is what's the benefit of making Z subset of R. It seems quite easy to take an alternative road and build up Z and R so that 2 is not the same as 2.0. But what would I lose then? Dec 10, 2014 at 8:07
• I don't think I can answer that in a comment what you would loose when 2 is not the same as 2.0. But you would at least loose this nice relation that so many mathematicians already got used to and like: ℕ ⊂ ℤ ⊂ ℚ ⊂ ℝ ⊂ ℂ
– Arne
Dec 12, 2014 at 21:59

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.

• I didn't mean to ask why 2.0 belongs to R, rather why are 2 and 2.0 considered the same in maths. Dec 7, 2014 at 10:37
• @Aivar: It is not clear from the question as it is currently written that this is the sort of information you are interested in; please edit accordingly. Dec 7, 2014 at 11:20
• 2 and 2.0 are the same mathematically because the latter means $2 + 0/10$. Dec 7, 2014 at 17:33
• Computers are quite capable of representing some irrational numbers. I can use a pair of rationals to represent $a + b\sqrt 2$, for example. Dec 8, 2014 at 15:24
• Computers have a way to represent whatever is computable. For example, all algebraic numbers are, although they are mostly irrational. Dec 8, 2014 at 20:29

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.

• Could you please give an example where it matters Dec 7, 2014 at 10:35
• @Aivar: I'm not sure if this is what Henrik is suggesting, but we can prove that $e$ is irrational by (1) assuming $e = \frac{b}{a}$ for integers $a$ and $b$, and then (2) 'finding' an integer between $0$ and $1$, which we know is impossible. See here.
– user88319
Dec 7, 2014 at 19:51

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!

• I think the notion of commensurable and in incommensurable pairs of lengths was studied in ancient Greek mathematics. So they were aware of things (ratios) that could be either rational or irrational; I think it is fair to say that in some sense the inclusion of the rational ratios (and therefore the integer ones) as strict subset of all possible ratios already occurs there, even though the number concept was rather different from ours. Dec 8, 2014 at 17:06
• @MarcvanLeeuwen, thanks for your thoughtful comment. I am not sure I agree with the implication implied by your "So". We think of these as irrational numbers, but I don't think they did, as you seem to acknowledge in your final comment on the difference between the number concepts. Dec 9, 2014 at 8:48
• Disclaimer: I am not a historian. Was not Eudoxus' theory of incommensurables an attempt to unify what we would nowadays call rationals and irrationals? Dec 9, 2014 at 10:24
• @David, good question. My impression is that what you are suggesting is a modern interpretation of what is attributed to Eudoxus. Seems like a good candidate for a separate question. There are a few historians of math active at MO so I would suggest posting it there. Dec 9, 2014 at 10:29

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}$$

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?)

• That's an... interesting perspective. I can see some sense to what you're saying ($m^k$ in the integers can be thought of---cardinality-wise---as the set of all functions from $k$ to $m$, so there is only one of those for $0 = \{\}$), but that is a little idiosyncratic. I would say that $0^0$ is always defined or undefined based on context, personally. Dec 7, 2014 at 14:45
• To me $0^0$ is defined (and equals $1$ no matter which $0$ you take, i.e., also $0.0^{0.0}=1.0$. It's just that the power function is not continuous near those border cases of its domain (that is $a_n\to 0$, $b_n\to 0$ does not imply $a_n^{b_n}\to 1$ or even that all $a_n^{b_n}$ are defined). - Would you extend your distinction to say that the indicator function $1_{\mathbb Q}$ has the properties $1_{\mathbb Q}(\sqrt 2)=0$, $1_{\mathbb Q}(\frac12)=1$, but $1_{\mathbb Q}(0.5)=0$? Dec 8, 2014 at 7:01
• I see your point on $0.0^{0.0}=1$ but apparently few others agree with that. On your second point, $1_{\mathbb Q}$ is a function of the real numbers that equals zero for any value that is in the subset of $\mathbb R$ that is isomorphic to the rational numbers. I.e. the function is defined on real numbers, and there $0.5=1/2$, so clearly $1_{\mathbb Q}(0.5)=1$. Dec 8, 2014 at 11:05