Everything and More: A Compact History of Infinityby David Foster Wallace 320pp, Weidenfeld, £14.99

Even those of us to whom calculus was a distant peak we had no prospect of climbing can remember a time of innocence when numbers were full of mysterious interest. If a number is divisible by three, the sum of its digits is also divisible by three, eg 714, 1,002, 108,762 . . . If a number is divisible by 11, the sums of its alternate digits will always be equal (121, 671, 2541 . . .). Twos and fives need no help, and the only number that yields to no such tricks is seven. And incidentally, why is the sum of two odd numbers, like the sum of two even numbers, always an even number?

I am fairly sure I was not taught these things at school, perhaps because they are not really much use and don't lead anywhere. But the calculating child is emulating the Greek mathematicians. What the Greeks discovered, and the mathematical universe they believed in, might also seem nowadays to be of little practical value. They knew about pi of course, but geometrically, not as a number with endless decimal points, and couldn't get their heads round square roots, let alone infinity. Yet without their work the modern world would be almost inconceivably different.

Moreover the child's discoveries resemble, if only a little, those of more recent mathematicians, which may often, though by no means always, be of no use. And sometimes even geniuses have enormous difficulty in answering what look like childlike questions. They assume they must answer them logically, for the history of mathematics is one of logical development and amendment, sometimes in startling leaps and bounds. The matter of priority, of who first took the leaps, is important; it is of small value to work out Fermat's last theorem if somebody has done it before; and there was a classic row between Newton and Leibniz about which of them first identified what Newton called "fluxions" and Leibniz "calculus". Paranoia is not unknown among mathematical geniuses.

The humanist looks at these enterprises with some bewilderment. It is tempting to argue that when the notion of infinity is not related to God or the sublime but to the manipulation of infinitesimals and, say, of all the numbers between 0 and 1, something - but certainly not passion - has been forfeited. Our humanist may be tempted to regard the whole business as dealing in fictions which, as can sometimes happen, open up new ways of thinking, so that genius must of necessity prefer the freedom of fiction to the convention of fact. It is interesting that Georg Cantor, probably the greatest mathematician of the infinite, refused to believe in the Stratford Shakespeare. Resisting the obvious was his profession, as it was Freud's.

These books both tell the story of the development of mathematical thought from its beginnings to modern set theory, and Georg Cantor is the hero of both. They are not unalike in tone; both use a jaunty approach with the odd witticism to keep the class happy, but they differ in method. Brian Clegg begins at the beginning, introducing one great name after another until, with Newton and Leibniz in the 17th century and Cantor in the 19th, he has cleared the way for even better-informed great ones still to come. David Foster Wallace starts straight in with Cantor but takes a look back at his predecessors when he thinks it necessary to do so.

It is with the later names that the terrain grows very difficult. If I had to choose between these books I'd take Clegg, who is easier to read. For all his justified confidence in his mastery of the matter, Wallace seems to be irrationally afraid of his readers. If they've done "college math" they may know too much and be bored by his exposition. If they haven't, they may sink into bewilderment. He has a system that shows you either what to skip if you're likely to know it already, or what you can omit if it looks like being impossibly hard.

Clegg, untroubled by such considerations, offers no such aids; he is making it as simple as possible, and it's up to you to hang on in there when the going gets tough. (The idiom is American in both books.) Wallace is the more forceful - more generous, if that's how you feel about them - with equations, and at least as persuasive in propagating his belief that calculus is the most important thing in mathematics since Euclid. He won't divide the credit between Newton and Leibniz, wanting a proper admiration for a good many others, including Kepler and Galileo. He greatly admires the powers of abstraction that enable these great ones to think the virtually unthinkable, which is what you have to do if you take on infinity, especially all the infinities that follow from Cantor. "The important thing is that the problems and controversies about infinity... involve whether infinite quantities can actually exist as mathematical entities." He condemns other expositors for being "pitilessly dense and technical", but tends that way himself, and occasionally gets bracingly, even coarsely, cross with the duller reader: "If this fails to make the basic idea clear, you are asked to just please eat it."

The neat word "infinity", literally meaning the condition of being without an end, has acquired great complexity in maths and an unmathematical grandeur in more general usage. We remember "infinite riches in a little room" and Hamlet counting himself a "king of infinite space", but neither refers to anything more complicated than mere size. "Infinite", in this kind of ordinary usage, is remote in sense from the mathematical symbol for infinity, the invention of the English mathematician John Wallis in the 18th century. In early times it was believed that numbers existed in complex relations with the real world, but now that can't be so because there are all sorts, like rational, irrational and transcendental, and they may be as large or small as suits the thinker, who has to deal with different dimensions of infinity, a multiplicity of infinities, some larger than others. We may need the gentler tones of Clegg to follow this.

One reason why Clegg is readable is that he likes to gossip about personalities. Strictly speaking, he tells us more about the lives of mathematicians than we need to know, but not more than we care to know, for the passages of gossip are a sort of time-out from the business of numbers. He tells us about Lancashire counting songs, of the assumptions, true and false, of the Pythagoreans, and how the Greeks, while being fixated on geometry, using an impossibly cumbersome system of numeration, and having no zero and no algebra, really did pretty well. Aristotle, for whom Wallace has a particular dislike, confused ancient thought about infinity by arguing that it did not exist except potentially, and even that seemed doubtful. To use it you have to think it real as well as not real.

Throughout his book Clegg returns again and again to this sequence of fractions: one, one half, one quarter, one eighth... The sequence is familiar from Zeno's paradoxes; it proves you can never get from 1 to 2, Achilles cannot catch the tortoise because before he can reach the next point the tortoise has moved on. The infinitesimal gap between the farthest you have the patience to extend the sequence of fractions, and the number 2, is where calculus was waiting to be born. We can never reach 2, so one has to speak of "convergence", when the point reached is 1.9999 and so on for ever . . . Galileo called these values "non quanti", and it is difficult but important to see that the translation "infinitely small" is wrong; it means they cannot be quantified, though they can be used in calculations - so well, indeed, that Clegg can say calculus "had an impact on science and engineering similar to that of the later IT revolution".

And so to set theory, with its further enablements and paradoxes. Unlike Pascal, these authors rejoice in both infinite largenesses and smallnesses. Imagine the smallest possible number and call it ghost. Now divide it by 2. "We've just produced a number that is bigger than zero (because the two of them added together make ghost) yet is smaller than ghost. So ghost wasn't the smallest number that could be." But what would happen if these numbers were a very different kind of number, that obeyed not ordinary arithmetic but the arithmetic of infinities? That's what these books are about. And the dazed humanist begins to see why Clegg calls his final chapter "Endless Fascination".

· Frank Kermode's books include The Sense of an Ending, originally published in 1967.