When was the first recorded occurence of irrational and imaginary number usage in number theory?

I saw a letter of Euler to Lagrange congratulating him on his usage of imaginary numbers in the "analysis devoted to rational numbers alone", was that the first known such usage? What was the likely inspiration of Lagrange(and Euler)?

• Never. The process was so tortuous and incremental that the "first usage" does not make much sense. It is smeared over a millenium from the Pythagorean incommesurability proofs for squares with prime sides (read in the modern way) to the 17th century when of irrationals were finally accepted as "numbers", see How were irrational numbers accepted by mathematicians? Euler's work in number theory largely followed Fermat's, in particular, he sorted out and settled most of Fermat's many hunches. – Conifold Feb 7 at 0:29

Irrational numbers were used by the ancient Greeks when they were discovered. The earliest texts did not survive but there are plenty of them in Euclid. Though they are not called numbers. The theory of proportions of Eudoxus-Euclid is equivalent to the theory of real numbers. Euclid's book X contains some very complicated theory of some irrational numbers.

Ancient theories only dealt with algebraic numbers (like square and cubic root of integers), they did not know that there are transcendental numbers. They did not know that $$\pi$$ is transcendental.

The first general result on all irrational numbers is due to Nicole Oresme (14th century): he proved that the fractional parts of $$na$$ are dense on $$[0,1]$$ for any irrational $$a$$.

Imaginary numbers occur for the first time in the theory of cubic and quartic equations (16th century). When the formulas for them were discovered, it was noticed that even in the case when the final answer is real, the intermediate calculation involves square roots of negative numbers. For example try to solve $$x^3-x=0$$ using the Cardano formula. So they started to develop arithmetic of complex numbers. This was a surprisingly long development achieving a clear and complete theory only in the end of 18th century. Before this was achieved, many looked at their use with a suspicion. This suspicion did not dissolve completely until the later part of the 19th century. (They say that Chebyshev was against the use of complex numbers. If this is true, he was probably the last great mathematician who did not recognize them. His students used them routinely).

• I don't think it is correct to say that the Greeks used irrational numbers. The Greek concept of number was restricted to positive integers. What we call irrational numbers today were geometric magnitudes to the Greeks. – Nick Feb 6 at 16:39
• Why is Lagrange and Euler cited in several books including the Beginnings and Evolution of Algebra as the first who used imaginary numbers in number theory? – GEP Feb 6 at 19:30
• @Nick He knows that there were no irrational (or even rational) numbers in ancient Greece, or that "the theory of proportions of Eudoxus-Euclid" is not equivalent to real numbers even in the nebulous sense that one can make of the first claim. This is just an emphatic affirmation of the platonist creed that they were "looking" at the same "right" (modern) numbers even if they were awkward about phrasing it. – Conifold Feb 7 at 0:14
• @GEP: this is not a question to me. Ask the authors of these books. Stating that someone did something for the first time is always risky. – Alexandre Eremenko Feb 7 at 3:12
• @GEP Neither Cardano nor others before Euler used imaginary numbers for number theory questions, i.e. questions about properties of integers, they were concerned with solving algebraic equations. As used in number theory, "number" still means "integer", not real or complex number. – Conifold Feb 7 at 8:17

Regarding the headline question, Newton, in his text Universal Arithmetick, gave what Leo Corry states may be the first definition of number that included both positive and negative integers, fractions, and irrationals.

Here is Newton's definition:

By number we understand, not so much a Multitude of Unities as an abstracted ratio of any Quantity, to another Quantity of the same kind, which we take for unity. And this is threefold; integer, fracted, and surd: An Integer, is what is measured by Unity; a fraction, that which a submultiple Part of Unity measures; and a Surd, to which unity is incommencurable.

On this definition, Corry writes:

The unit, the integers, the fractions, and the irrational numbers appear here - perhaps for the first time and certainly in an influential text in such clear-cut terms - all as mathematical entities of one and the same kind, the differences between them being circumscribed to a single feature clearly discernible in terms of a property of ratios. ... Moreover, and very importantly, numbers are abstract entities: themselves they are not quantities, but they may represent either quantities or a ratio between quantities.

Regarding imaginary number, Newton is more hesitant. He does not refer to them as "imaginary" or "fictions", as did Descartes and Wallis. Newton uses the term "impossible". Quoting Corry:

And what he meant by "impossible" he explained by reference to the solution to the equation $$x^2 + 2ax + b^2 = 0.$$ Here, we obtain two roots, namely $$a + \sqrt{a^2 - b^2} \text{ and } a - \sqrt{a^2 - b^2}.$$ Now, when $$a^2$$ is greater than $$b^2$$ - Newton wrote - the roots are "real". In the opposite case, when $$b^2$$ is greater than $$a^2$$, of course, the root is "impossible". But, interestingly, Newton nevertheless went on to stress that both expressions are roots of the polynomial, for the simple reason that when they are introduced in the equation in place of the unknowns, the equation is satisfied because "their factors eliminate each other". In other words, a square root of a negative number is an impossibility and hence does not represent a number in the proper sense of the word, but expressions containing such impossible entities are legitimate roots of an equation and allow for an appealing formulation of the fundamental theorem of algebra, as Newton conceived of it.

[Source: Leo Corry, A Brief History of Numbers.]

• Why is Lagrange and Euler cited in several books including the Beginnings and Evolution of Algebra as the first who used imaginary numbers in number theory? – GEP Feb 6 at 19:30
• @GEP Conceptual generality in Newton's text ends with his definition of number. The rest of the text is devoted to specifying rules and techniques. It may be that Euler and Lagrange treated the whole subject with conceptual generality. Newton's text is a curious one. Newton never intended to publish it and only agreed to its publication in order to gain support for his political ambitions. Consisting mostly of lecture notes from his early days at Cambridge and additional comments, it was edited and published by Whiston, Newton's successor at Cambridge. – Nick Feb 6 at 19:54
• @GEP I might add that Newton worked at a time when the relationship between algebra and geometry was still very much up in the air. Newton himself stated his preference for synthetic geometry over the analytic methods of Descartes. By the time of Euler and Lagrange, this relationship was much better understood. – Nick Feb 6 at 20:02
• Although we sometimes (following Diophantus, I guess) refer to number theory as arithmetic, this book seems to be about arithmetic in the primary-school sense, not number theory. It's a good example of treating rational and irrational numbers together (especially in the form of decimal fractions) and doing arithmetic with them (and algebra in the primary-school sense as well); and if it was the first to do this, then that's important. But I can't find anything like what Euler praised Lagrange for, an application of irrational numbers to a question about rational numbers or integers. – Toby Bartels Feb 7 at 18:44
• @TobyBartels Fair comment. My reasoning was that before one can have irrational numbers in number theory, we need a concept of number that includes irrationals. Mind you, I am more of a casual reader of the subject, as opposed to a student. Also, I believe that the line between number theory and arithmetic is ill-defined from a historical point-of-view. At one time wasn't number theory called "higher arithmetic"? – Nick Feb 7 at 21:15