DEV Community

Cover image for Natural Numbers
Kostas Kalafatis
Kostas Kalafatis

Posted on

Natural Numbers

What is a number?

In mathematics, there are several ways to approach this question. We can look at it semantically, by understanding what numbers mean. Alternatively, we can take the axiomatic approach, focusing on their fundamental properties and behaviors. Or, we can answer the question constructively by looking at how numbers can be constructed from simpler objects.

The Semantic Approach

Let's begin with semantics. What do numbers really mean? Many people assume that numbers are just a tool for counting things, but their meaning is more nuanced. Numbers can serve two different purposes depending on their context.

There are two main types of numbers: cardinal and ordinal. For example, when we see the number 3, it's meaning is not immediately clear. It could mean 3 as in I have three eggplants, or it could mean 3 as in I want the third eggplant. The 3 in three eggplants is a cardinal number, and the 3 in third eggplant is an ordinal number.

A cardinal number counts how many objects there are in a group. When we say I want **three* eggplants*, that three is a cardinal. An ordinal number counts where a particular object is in a group. When we say I want the **third* eggplant*, that three is an ordinal.

The cardinal/ordinal distinction really starts to make sense when you talk about the set theoretic basis of math. For now, the basic idea is enough: cardinals count objects, ordinals position them.

The Axiomatic Approach

The axiomatic part is a lot more interesting. Here, we define concepts like numbers using a set of rules, known as axioms. These axioms lay out how the numbers (or whatever we're working with) act. Mathematicians love axiomatic definitions because they eliminate any confusion about what's possible and how it works. While they might not be as intuitive, they're incredibly precise and perfect for logical reasoning.

Let's begin our exploration of numbers with the most basic kind: the natural (or counting) numbers. These are the whole numbers we first learn as kids. They start with zero and going on forever: 0, 1, 2, 3, 4, and so on. They are like the building blocks of all numbers, and for computer scientists, they're particularly special because everything we can compute is ultimately based on them. Formally, these numbers are defined by a set of rules called Peano arithmetic, which lays out exactly how they work.

Peano arithmetic specifies a list of axioms that define the natural numbers.

  • Initial Value Rule: There is one special object called 0, and 0 is a natural number.
  • Successor Rule: Every natural number n has a successor in the natural numbers, called its successor, s(n). Zero is the only natural number that is not the successor of any natural number.
  • Uniqueness Rule: If the successor of two natural numbers is the same, then the two original numbers are the same.
  • Equality Rules: While these are not considered to be part of the Peano axioms in modern treatments, the following rules describe the equality relation:
    • Reflexive: For every natural number x then x = x. Or in other words, every natural number is equal to itself.
    • Symmetric: For all natural numbers x and y, if x = y then y = x.
    • Transitive: For all natural numbers x, y and z, if x = y and y = z, then x = z.
    • Closed under equality: For all a and b, if b is a natural number and a = b, then a is also a natural number.
  • Induction Rule: For some statement P, P is true for all natural numbers if
    1. P is true about 0 (that is, P(0) is true)
    2. If you assume P is true for a natural number n (P(n) is true), then you can prove that P is true for the successor s(n) of n (or P(s(n)) is true)

And of the above is just a fancy way of saying that natural numbers are numbers with no fractional part starting at 0. Most people get the Peano rules right away, except for the last one about induction. It's a tricky concept – it can feel a bit circular at first. But it's crucial because natural numbers go on forever. Induction is the tool that lets us take what we know about a finite number of things and apply it to the whole infinite set.

Forgetting the technical jargon, the induction rule basically says: if something works for your first number, and you have a way to describe what happens when you add 1 to it, you can apply this pattern to all the numbers that follow. This pattern lets us write proofs that hold true for all natural numbers, or even define things that work for all of them. We can use similar techniques to tackle all integers, fractions, or even all real numbers. Let's start with an example of a definition, which is easier to understand than a proof.

Let's illustrate how induction is used in a definition by looking at addition. Addition is simply a function "+" that takes two natural numbers and produces another natural number, their sum. We can formally define addition with the following rules:

  • Commutativity: For any pair of natural numbers a and b,
    n+m=m+nn + m = m + n

or in simple terms, it means you can swap the numbers around, and the result stays the same.

  • Identity: For any natural number n,
    n+0=0+n=nn + 0 = 0 + n = n

or in simple terms, adding 0 to any number doesn't change the value.

  • Recursion: For any natural number n,
    m+s(n)=s(m+n)m + s(n) = s (m + n)

The last rule is based on a concept called recursion. It can be a bit tricky if you're not familiar with it, so let's break it down.

Essentially, we're defining addition by using the Peano arithmetic concept of adding 1 to a number. If we rewrite the rule slightly, it becomes:
m+n=1+(m+(n1)). m + n = 1 + (m + (n - 1)).

Remember, this is a definition, not a procedure. It explains what addition means, not how to calculate it.

This rule works because of the Peano induction rule. Without it, we wouldn't have a way to define addition for any two numbers. Induction gives us a way to express the meaning of addition for any pair of natural numbers.

Now, let's tackle a proof. I know proofs can seem intimidating, but don't worry! They're not so bad, and we'll start with a very simple one.

Using Peano's Induction

Let's have some fun with a simple proof using natural numbers and addition. Suppose we have a natural number N. Can you guess the sum of all the integers from 1 to N? It's actually N times (N + 1) divided by 2. Let's prove this using induction.

First, we start with a base case, a starting point we can prove on its own. In this case, our base case is 0 because the first part of the induction rule requires us to show it works for 0. Luckily, this is easy:

(0(0+1))/2=0. (0 * (0 + 1)) / 2 = 0.

So, our equation holds true when N is 0.

Now, for the inductive part. Let's assume the rule is true for a number N. We need to prove it's also true for N + 1.

This is where the magic of induction happens. We want to show that if the rule works for 0, it must work for 1, and if it works for 1, it must work for 2, and so on. We don't want to prove each of these cases individually, so we simply say, "If it's true for N, it must be true for N + 1."

By using a variable in this inductive structure, we're essentially saying, "If it's true for 0, then it's true for 1; if it's true for 1, then it's true for 2", and so on.

Here's what we want to prove:

(0+1+2+3+...+n+n+1)=(n+1)(n+2)2 (0 + 1 + 2 + 3 + ... + n + n + 1) = \frac{(n + 1)(n + 2)}{2}

To begin, we know that

(0+1+2+3+...+n)=n(n+1)2 (0 + 1 + 2 + 3 + ... + n) = \frac{n(n+1)}{2}

So we can substitute that in get this

n(n+1)2+n+1=(n+1)(n+2)n \frac{n(n+1)}{2} + n + 1 = \frac{(n+1)(n+2)}{n}

Now, we can expand the multiplication on both sides

n2+n2+(n+1)=n2+3n+22 \frac{n^2 + n}{2} + (n + 1) = \frac{n^2 + 3n + 2}{2}

Get the common denominator on the left side

n2+n+2n+22=n2+3n+22 \frac{n^2 + n + 2n + 2}{2} = \frac{n^2 + 3n + 2}{2}

Finally, simplify the left side

n2+3n+22=n2+3n+22 \frac{n^2 + 3n + 2}{2} = \frac{n^2 + 3n + 2}{2}

And there you have it! We've proven the equation holds true for all natural numbers. So, that's the axiomatic definition of natural numbers – numbers greater than or equal to zero, each with a successor, and where you can use induction. It's amazing how almost everything we do with natural numbers, including basic arithmetic we learn as kids, can be built upon this foundation.

So, can we now define what a number is? Well, kind of. One thing we learn in math is that numbers don't have just one meaning. There are many types of numbers: natural numbers, integers, rational numbers, real numbers, complex numbers, and so on. The entire universe of numbers begins with what we just explored: the natural numbers. And ultimately, the meaning of these numbers boils down to either quantity or position.

They're all either cardinal numbers (representing quantity) or ordinal numbers (representing position), or combinations of both. In essence, a number is a construct that represents either a quantity or a position.

Top comments (0)