Abu Rayhan al-Biruni was born in Khwarazm, a region adjoining the Aral Sea now known as Karakalpakstan. The two major cities in this region were Kath and Jurjaniyya. Al-Biruni was born near Kath and the town were he was born is today called Biruni after the great scholar. He lived both in Kath and in Jurjaniyya as he grew up and we know that he began studies at a very early age under the famous astronomer and mathematician Abu Nasr Mansur. Certainly by the age of seventeen al-Biruni was engaged in serious scientific work for it was in 990 that he computed the latitude of Kath by observing the maximum altitude of the sun.
Other work which al-Biruni undertook as a young man was more theoretical. Before 995 (when he was 22 years old) he had written a number of short works. One which has survived is his Cartography which is a work on map projections. As well as describing his own projection of a hemisphere onto a plane, al-Biruni showed that by the age of 22 he was already extremely well read for he had studied a wide selection of map projections invented by others and he discusses them in the treatise. The comparatively quiet life that al-Biruni led up to this point was to come to a sudden end. It is interesting to speculate on how different his life, and contribution to scholarship, might have been but for the change in his life forced by the political events of 995.
The end of the 10th century and beginning of the 11th century was a period of great unrest in the Islamic world and there were civil wars in the region in which al-Biruni was living. Khwarazm was at this time part of the Samanid Empire which ruled from Bukhara. Other states in the region were the Ziyarid state with its capital at Gurgan on the Caspian sea. Further west, the Buwayhid dynasty ruled over the area between the Caspian sea and the Persian Gulf, and over Mesopotamia. Another kingdom which was rapidly rising in influence was the Ghaznavids whose capital was at Ghazna in Afghanistan, a kingdom which was to play a major role in al-Biruni's life.
The Banu Iraq were the rulers of the Khwarazm region and Abu Nasr Mansur, al-Biruni's teacher, was a prince of that family. In 995 the rule by the Banu Iraq was overthrown in a coup. Al-Biruni fled at the outbreak of the civil war but it is less clear what happened to his teacher Abu Nasr Mansur at this stage. Describing these events later al-Biruni wrote
Exactly where al-Biruni went when he fled from Khwarazm is unclear. He might have gone to Rayy (near to where the city of Tehran stands today) at this time, but certainly he was there at some time during the following few years. He writes that he was without a patron when in Rayy, and lived in poverty. al-Khujandi was an astronomer who was working with a very large instrument he had built on the mountain above Rayy to observe meridian transits of the sun near the solstices. He made observations on 16 and 17 June 994 for the summer solstice and 14 and 17 December 994 for the winter solstice. From these values he calculated the obliquity of the ecliptic, and the latitude of Rayy but neither are particularly accurate.
Al-Khujandi discussed these observations, and his large sextant, with al-Biruni who later reported on them in his Tahdid where he claimed that the aperture of the sextant settled by about one span in the course of al-Khujandi's observations due to the weight of the instrument. Al-Biruni is almost certainly correct in pinpointing the cause of al-Khujandi's errors. Since al-Khujandi died in 1000, we can be fairly certain that al-Biruni spent part of the time between 995 and 997 at Rayy. He must also have spent part of this time in Gilan, which is bordered by the Caspian Sea on the north, for around this time he dedicated a work to the ruler of Gilan, ibn Rustam, who had connections with the Ziyarid state.
We know certain dates in al-Biruni's life with certainty for he describes astronomical events in his works which allow accurate dates and places to be determined. His description of an eclipse of the moon on 24 May 997 which he observed at Kath means that he had returned to his native country by this time. The eclipse was an event that was also visible in Baghdad and al-Biruni had arranged with Abu'l-Wafa to observe it there. Comparing their timings enabled them to calculate the difference in longitude between the cities. We know that al-Biruni moved around frequently during this period for by 1000 he was at Gurgan being supported by Qabus, the ruler of the Ziyarid state. He dedicated his work Chronology to Qabus around 1000 and he was still in Gurgan on 19 February 1003 and 14 August 1003 when he observed eclipses of the moon there. We should record that in the Chronology al-Biruni refers to seven earlier works which he had written: one on the decimal system, one on the astrolabe, one on astronomical observations, three on astrology, and two on history.