More than twenty years elapsed between Newton's first conception of gravitation and the publication, in 1686-7, of Newton's great work on gravity and physics, the Philosophiae Naturalis Principia Mathematica, known to posterity as the Principia. In these two decades, scientific inquiry did not stand still, and other minds had pondered versions of Newton's initial idea--that the force of attraction holding planets in their orbits varied inversely with the square of their distance from the sun. One of these minds belonged to Robert Hooke. In 1680, while Newton labored furiously on his theory of gravitation, trying to make it work out in all particulars, Hooke wrote a letter to him in which he suggested that a formula involving inverse squares might explain the attraction between planets. He made the same case four years later, in a conversation with Halley and Christopher Wren. Whether Hooke was actually close to hitting on something like Newton's law of universal gravitation has been a matter of debate among historians for generations. Hooke would always feel, later, that he had been robbed of his discovery, but this seems untenable, as Wren and Halley's response to his suggestion makes clear. They agreed with his suggestion, but pointed out that a mathematical demonstration was needed, and Wren famously offered Hooke and Halley forty shillings if either would bring him a mathematical proof of gravitation. It was a challenge that Hooke would be unable to meet--but one that Newton would succeed at, and within two years.
In August of 1684, Halley visited Newton in Cambridge, and idly asked what shape the orbit of a planet would take if its attraction to the sun followed the inverse square of the distance between them. Newton, who had been working on this problem for years now, immediately replied that the orbit would be an ellipse--exactly the shape that Johannes Kepler, the 16th century German astronomer, had hypothesized as the shape of the planets' path. Astronomy and physics thus coincided. Meanwhile, in the 1670s, a Frenchman named Jean Picard had recalculated the Earth's size and distance from the sun, producing more accurate values than what scientists had calculated before--values that worked well with Newton's mathematical formulas. Newton could now test the inverse square law, using a comparison between an apple on a tree branch and the moon. The moon was roughly sixty times as far from the center of the earth as the apple was, and so the moon, in Newton's scheme, would be pulled toward Earth at 1/602 (or 1/3600) of the apple's rate of fall. This calculation harmonized closely with Kepler's calculations of planetary orbits, and Newton felt confident enough to tell Halley, in November 1684, that the apple and the moon both experience a pull from the same force, and that this universal gravity applied to all bodies in the solar system.
Halley, recognizing the importance of this discovery, urged Newton to publish his findings. In February 1685, Newton sent to the Royal Society a brief treatise entitled Propositions de Motu, which laid out the general principles that he had discovered. Throughout the following year, he worked to produce a full exposition, and in April, 1686, he published the first volume of the Philosophiae Naturalis Principia Mathematica, or "Mathematical Principles of Natural Philosophy." The second two books would be published in September 1687, at Edmund Halley's expense--the Society being short on funds at the time. The work would make Newton the most famous scientist in Europe.
Upon the publication of the first book, Hooke immediately pointed out that he had anticipated Newton's law of inverse squares, and flatly accused Newton of plagiarism. Newton, furious as ever in defense of his discoveries, denied having taken anything from Hooke, and went so far as to threaten to withdraw from publication the third book of the Principia, complaining that "philosophy is such an impertinently litigious Lady that a man had as good be engaged in Law suits as have to do with her." Halley, who had invested so much of himself in Newton's great work, mollified him, and tried to make peace between Newton and Hooke. But the break was final. Newton did insert a brief acknowledgement of "our friends Wren, Hooke, and Halley" in his discussion of the law of inverse squares, but this pat on the head did nothing to mollify Hooke. Hooke's beloved niece died the same year that Principia was published, and he went into a slow decline. As Newton's reputation grew and his own shrank, he grew bitter and came to loathe the very sight of his rival; he now took every opportunity to slight the other man. Thus Hooke, knowing full well that Newton would be the next man to be elected president of the Society, refused to retire from his position until death claimed him in 1703; until the very end, he refused to give his rival any satisfaction.