He attended the University of Orléans from 1623 and received a bachelor in civil law in 1626, before moving to Bordeaux. In Bordeaux he began his first serious mathematical researches, and in 1629 he gave a copy of his restoration of Apollonius's De Locis Planis to one of the mathematicians there. Certainly in Bordeaux he was in contact with Beaugrand and during this time he produced important work on maxima and minima which he gave to Étienne d'Espagnet who clearly shared mathematical interests with Fermat. There he became much influenced by the work of François Viète.
In 1630, he bought the office of a councillor at the Parlement de Toulouse, one of the High Courts of Judicature in France, and was sworn in by the Grand Chambre in May 1631. He held this office for the rest of his life. Fermat thereby became entitled to change his name from Pierre Fermat to Pierre de Fermat. Fluent in six languages (French, Latin, Occitan, classical Greek, Italian and Spanish), Fermat was praised for his written verse in several languages and his advice was eagerly sought regarding the emendation of Greek texts.
Fermat's pioneering work in analytic geometry (Methodus ad disquirendam maximam et minimam et de tangentibus linearum curvarum) was circulated in manuscript form in 1636 (based on results achieved in 1629), predating the publication of Descartes' famous La géométrie (1637), which exploited the work. This manuscript was published posthumously in 1679 in Varia opera mathematica, as Ad Locos Planos et Solidos Isagoge (Introduction to Plane and Solid Loci).
Through their correspondence in 1654, Fermat and Blaise Pascal helped lay the foundation for the theory of probability. From this brief but productive collaboration on the Problem of points, they are now regarded as joint founders of probability theory. Fermat is credited with carrying out the first ever rigorous probability calculation. In it, he was asked by a professional gambler why if he bet on rolling at least one six in four throws of a die he won in the long term, whereas betting on throwing at least one double-six in 24 throws of two dice resulted in his losing. Fermat showed mathematically why this was the case.
Pierre de Fermat died on January 12, 1665 at Castres, in the present-day department of Tarn. The oldest and most prestigious high school in Toulouse is named after him: the Lycée Pierre-de-FermatFrench Sculptor Théophile Barrau made a marble statue named Hommage à Pierre Fermat as a tribute to Fermat, now at the Capitole de Toulouse..
Although Fermat claimed to have proven all his arithmetic theorems, few records of his proofs have survived. Many mathematicians, including Gauss, doubted several of his claims, especially given the difficulty of some of the problems and the limited mathematical methods available to Fermat. His famous Last Theorem was first discovered by his son in the margin in his father's copy of an edition of Diophantus, and included the statement that the margin was too small to include the proof. It seems that he had not written to Marin Mersenne about it. It was first proven in 1994, by Sir Andrew Wiles, using techniques unavailable to Fermat.
In number theory, Fermat studied Pell's equation, perfect numbers, amicable numbers and what would later become Fermat numbers. It was while researching perfect numbers that he discovered Fermat's little theorem. He invented a factorization method—Fermat's factorization method—as well as the proof technique of infinite descent, which he used to prove Fermat's right triangle theorem which includes as a corollary Fermat's Last Theorem for the case n = 4. Fermat developed the two-square theorem, and the polygonal number theorem, which states that each number is a sum of three triangular numbers, four square numbers, five pentagonal numbers, and so on.
Together with René Descartes, Fermat was one of the two leading mathematicians of the first half of the 17th century. According to Peter L. Bernstein, in his book Against the Gods, Fermat "was a Mathematician of rare power. He was an independent Inventor of analytic geometry, he contributed to the early development of calculus, he did research on the weight of the earth, and he worked on light refraction and optics. In the course of what turned out to be an extended correspondence with Pascal, he made a significant contribution to the theory of probability. But Fermat's crowning achievement was in the theory of numbers."