Pierre Fermat's father was a wealthy leather merchant and second consul of Beaumont- de- Lomagne. Pierre had a brother and two sisters and was almost certainly brought up in the town of his birth. Although there is little evidence concerning his school education it must have been at the local Franciscan monastery.
He attended the University of Toulouse before moving to Bordeaux in the second half of the 1620s. In Bordeaux he began his first serious mathematical researches and in 1629 he gave a copy of his restoration of Apollonius's Plane loci 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.
From Bordeaux Fermat went to Orléans where he studied law at the University. He received a degree in civil law and he purchased the offices of councillor at the parliament in Toulouse. So by 1631 Fermat was a lawyer and government official in Toulouse and because of the office he now held he became entitled to change his name from Pierre Fermat to Pierre de Fermat.
For the remainder of his life he lived in Toulouse but as well as working there he also worked in his home town of Beaumont-de-Lomagne and a nearby town of Castres. From his appointment on 14 May 1631 Fermat worked in the lower chamber of the parliament but on 16 January 1638 he was appointed to a higher chamber, then in 1652 he was promoted to the highest level at the criminal court. Still further promotions seem to indicate a fairly meteoric rise through the profession but promotion was done mostly on seniority and the plague struck the region in the early 1650s meaning that many of the older men died. Fermat himself was struck down by the plague and in 1653 his death was wrongly reported, then corrected:-
I informed you earlier of the death of Fermat. He is alive, and we no longer fear for his health, even though we had counted him among the dead a short time ago.
The following report, made to Colbert the leading figure in France at the time, has a ring of truth:-
Fermat, a man of great erudition, has contact with men of learning everywhere. But he is rather preoccupied, he does not report cases well and is confused.
Of course Fermat was preoccupied with mathematics. He kept his mathematical friendship with Beaugrand after he moved to Toulouse but there he gained a new mathematical friend in Carcavi. Fermat met Carcavi in a professional capacity since both were councillors in Toulouse but they both shared a love of mathematics and Fermat told Carcavi about his mathematical discoveries.
In 1636 Carcavi went to Paris as royal librarian and made contact with Mersenne and his group. Mersenne's interest was aroused by Carcavi's descriptions of Fermat's discoveries on falling bodies, and he wrote to Fermat. Fermat replied on 26 April 1636 and, in addition to telling Mersenne about errors which he believed that Galileo had made in his description of free fall, he also told Mersenne about his work on spirals and his restoration of Apollonius's Plane loci. His work on spirals had been motivated by considering the path of free falling bodies and he had used methods generalised from Archimedes' work On spirals to compute areas under the spirals. In addition Fermat wrote:-
I have also found many sorts of analyses for diverse problems, numerical as well as geometrical, for the solution of which Viète's analysis could not have sufficed. I will share all of this with you whenever you wish and do so without any ambition, from which I am more exempt and more distant than any man in the world.
It is somewhat ironical that this initial contact with Fermat and the scientific community came through his study of free fall since Fermat had little interest in physical applications of mathematics. Even with his results on free fall he was much more interested in proving geometrical theorems than in their relation to the real world. This first letter did however contain two problems on maxima which Fermat asked Mersenne to pass on to the Paris mathematicians and this was to be the typical style of Fermat's letters, he would challenge others to find results which he had already obtained.
Roberval and Mersenne found that Fermat's problems in this first, and subsequent, letters were extremely difficult and usually not soluble using current techniques. They asked him to divulge his methods and Fermat sent Method for determining Maxima and Minima and Tangents to Curved Lines, his restored text of Apollonius's Plane loci and his algebraic approach to geometry Introduction to Plane and Solid Loci to the Paris mathematicians.