The Mathematics of Mecca

How advanced mathematics were used for Islamic religious purposes in the Middle Ages

Diagram of the geometrical method of determining the qibla. From an eighteenth century Ottoman Turkish copy of the sharḥ al-mulakhkhaṣ fī al-hayʾa ("Commentary on the Compendium on Astronomy by Mahmud al-Jaghmini"), the National Library of Israel collections

In the middle of the Grand Mosque in Mecca sits the Ka‘ba, the black-covered, square edifice that is the most sacred site in Islam. While the Ka‘ba predates the Prophet Muhammad’s revelation of the religion in the seventh century—the tradition ascribes its construction to Abraham or even Adam—it is a central symbol and a focal point of worship for Muslims around the world. This is no more apparent than during the annual hajj pilgrimage to Mecca, when millions of believers gather in the holy city. The vast courtyard of the Grand Mosque fills with white-clad pilgrims performing tawaf, the counter-clockwise circumambulation of the House of God.

However, the Ka‘ba is central to prayer throughout the year, not only during the hajj: just as Jews face Jerusalem during their worship, the Ka‘ba marks the direction of Muslim prayer, the qibla. In fact, Jews and Muslims do not only share the idea of orienting prayer in general, but Jerusalem in particular. Before the Prophet Muhammad declared Mecca to be the direction of prayer, the early Muslim community prayed towards Jerusalem, and the city has retained its sanctity as the third-holiest site after Mecca and Medina.

Early 18th-century European map of the Grand Mosque in Mecca, including the Ka’ba, the Eran Laor Cartographic Collection at the National Library of Israel

The qibla is built into the architecture of mosques, which include a niche, called the mihrab, in the wall facing Mecca. When praying at home or outside, individual worshipers must determine the qibla for themselves.

Today, finding the direction of the Ka‘ba from any location on the globe is a relatively easy affair: qibla compasses built into prayer rugs, smartphone apps, and Youtube guides can point the way.

But before modernity, finding the qibla was no easy matter, and precise determinations demanded serious mathematical skills.

Photograph of the mihrab prayer niche in the Khalid ibn al-Walid Mosque in Homs, Syria, taken in 1938 by A. Reid. From the Lenkin Family Collection of Photography, the University of Pennsylvania Libraries

Magnetic compasses were first introduced in the Islamic world from China in the thirteenth century, and their use in locating the qibla was described in royal Yemenite astronomer Al-Ashraf Umar ibn Yusuf’s  (d. 1296) On the Use of the Compass Bowl (tasa) for the Determination of the Qibla, written around 1290. The text describes the making of a compass using a bowl filled with water and an iron needle magnetized with a lodestone. After locating the compass’s true north, ibn Yusuf instructs readers to count twenty-seven degrees along the rim of the compass eastward; this is the qibla for the central Yemenite cities of Aden, Ta‘izz and Zabid. As Yusuf writes:

Pray in that direction, because, when the north line is known, you know the qibla of every locality of the climates according to (its) deviation and according to all the surrounding degrees on the circle of the entire rim of the bowl that are associated with it.

Geometrical models for determining the qibla also abounded. Numerous works of scientific astronomy, which build on and refine the work of the Hellenistic astronomer Ptolemy (c. 100-170 CE), whose writings were first translated to Arabic in the eighth century, also contain a chapter on determining the finding the azimuth of Mecca from a given locale. Rather than an extraneous, religious curiosity, qibla calculation was a standard topic in Islamic science.

European map of the Arabian Peninsula, including an inset drawing of the Ka’ba and the Grand Mosque in Mecca, the 1750s, the Eran Laor Cartographic Collection at the National Library of Israel

An example of such a geometrical model can be found in a manuscript from the National Library of Israel’s collection, written around the same time as Ibn Yusuf’s work. Composed by Ottoman astronomer Qadizade al-Rumi (1364-1346), the book is a commentary on Mahmud al-Jaghmini’s early thirteenth century Compendium on Astronomy (mulakhkhas fi al-hay’a), which amassed over sixty commentaries and translations into Persian, Turkish, and Hebrew. The Mulakhkhas, one of the most successful astronomical textbooks of all time, was intended as an introduction to astronomy for advanced students, conveying detailed information in a concise, consistent, and comprehensive way.

Jaghmini provides instructions for locating the qibla using a sundial. Marking the points on a circle where the shadow cast by the sundial reaches just before noon and again towards evening determines the east-west line and the north-south meridian. If one knows the difference between the longitude and latitude of Mecca and one’s own location, one can then geometrically find the qibla—at least approximately.

 

Diagram of the “Indian circle” method for calculating the cardinal directions using a sundial. From an 18th-century Ottoman Turkish copy of the sharḥ al-mulakhkhaṣ fī al-hayʾa (“Commentary on the Compendium on Astronomy” by Mahmud al-Jaghmini), the National Library of Israel collections

The manuscript includes two diagrams illustrating the method for the city of Samarkand, where Jaghmini lived, a major cultural center in the Middle Ages. The first diagram shows the positions of the sun (the red circles) and of the black shadows, as well as the east-west and north-south lines.

Diagram of the geometrical method of determining the qibla. From an 18th-century Ottoman Turkish copy of the sharḥ al-mulakhkhaṣ fī al-hayʾa (“Commentary on the Compendium on Astronomy” by Mahmud al-Jaghmini), the National Library of Israel collections

The second diagram shows the actual determination of the qibla. Since Samarkand is to the northeast of Mecca, one is then to indicate the respective difference with lines parallel to the east-west line and the north-south meridian. A line segment drawn from the center to the edge of the circle through the point of intersection of the two new lines indicates the direction of prayer. The diagram also shows the direction for the region of Khwarezm, another important region located in Central Asia.

The Ka‘ba of the Heart: The Hajj in Islamic Mysticism

Rumi, Ibn Arabi, and the radical Sufi conception of religion

An illustration of the Prophet's Mosque in Medina (left) and the Holy Mosque in Mecca (right). From an 18th century Ottoman Turkish manuscript of the Sufi prayerbook Dalāʾil al-khayrāt, the National Library of Israel collections

Sometime in the mid-ninth century CE, a Sufi initiate named Bayazid set off by foot from his home in north-central Iran toward Mecca, aiming to complete the hajj pilgrimage to the holy city—a journey of almost 2,500 kilometers. In every town and village through which he passed along the way, he sought out local mystics and saints, hoping to find his own true master. Finally, in an unnamed town, Bayazid encountered a poor, blind Sufi hunched with age. The sage asked him of his plans, and Bayazid told him he aimed to complete the hajj.

“Just walk around me seven times instead; that’s better than the hajj,” the old sheikh replied,

Complete your hajj thus! Reach your journey’s end! You’ve run to Safa, entered purity; you’ve done the Umrah; live eternally! He judges me much loftier, I swear, than that mere house of His. Let us compare: That Ka‘ba is the home of piety, but I contain His deepest mystery; inside the Ka‘ba no one’s ever stepped and my pure heart none but God will accept; when you have seen me, you have seen God too; You’ll circle then the Ka‘ba that’s most true.

 

The story of the sheikh who tells Bayazid, ‘I am the Ka’ba, so circumambulate me!'” from Jalal al-Din Rumi’s Sufi poem the Masnavi-ye Man’ai. From a 17th century Ottoman manuscript, the National Library of Israel collections

This story, taken from Jalal al-Din Rumi’s mystical epic the Masnavi-ye Man’ai (meaning the “spiritual couplets,” in Jawid Mojaddedi’s award-winning English translation) seems at first confounding. Rather than complete the pilgrimage to Mecca, a ritual duty every able-bodied and financially sound Muslim is expected to perform at least once, the mysterious sheikh tells Bayazid to abandon his journey. Instead of tawaf, the circumambulation of the Ka‘ba that is a central feature of the pilgrimage, the saint says to circle him; instead of running (sa‘y) between the two hills of Safa and Marwah, likewise an ancient part of the hajj (as well as any pilgrimage, called an umrah, performed outside the month of Dhu al-Hijja) the saint says he has already completed his task.

For Muslims throughout history until today, the journey to Mecca has been a lifelong goal, the height of spiritual fulfillment, and the holy city’s transcendental geography a constant source for contemplation. Is the sheikh—and, by extension, Rumi—advocating blasphemy?

Part of the answer lies in the fact that the Bayazid around whom Rumi weaves this fiction—just one of the thousands of stories that make up the Masnavi, whose importance in Islam is testified to by its sobriquet, “the Quran in Persian”—is none other than Bayazid Bestami (d. 874) one of the most important figures of early Sufism. While little is known of Bayazid’s life, in part because he was a recluse who left no written work behind, his bold, ecstatic sayings have been preserved. His fame rests on those sayings, which can strike readers today, who may have preconceived notions of Islam as conservative, strict, and legalistic, as surprising as the old sheikh’s instructions in Rumi’s story. Among others, Bayazid is reported to have said “Glory be to Me! How great is My majesty!” and to have otherwise compared himself to God, to declare that the Ka‘ba circumambulates him, and to have replied to the muezzin’s call to prayer of “God is great!” with the answer “I am greater!”

An illustration of a Sufi gathering, from a 17th century Indian manuscript of the collected works of Persian poet Khaqani, the National Library of Israel collections

Bayazid’s statements are not a sign of madness or nihilistic atheism. Instead, Bayazid sought to express the experience of the individual consciousness becoming truly obliterated in the divine. The fact that Bayazid upends even the centrality of the Ka‘ba, the House of God that descended from heaven and toward which Muslims turn during prayer, makes his statement all the more powerful. Rather than transgressing Islam, Bayazid, and Rumi after him, is imagining an alternative spiritual interpretation of the religion, based on the transcendent and transformative knowledge of the unseen: that is, “the roots of the sources of the principles of the religion,” as Rumi described his Masnavi in the introduction to the work. It was not always the case, however, that such statements did not come with repercussions; Mansour Hallaj (d. 922) was executed, some scholars believe, for making just such statements.

The hajj, as well as Bayazid, plays a similarly prominent role in another central work of Islamic mysticism. Ibn Arabi (1165-1240), known as al-shaykh al-akbar, the greatest master, was born in Murcia in Muslim Al-Anadalus (modern-day Spain). A Sufi saint and prolific writer, he embarked on the hajj in 1201 and remained in Mecca for three years. While there, he began his most famous work, the Futuhat al-Makkiya (Meccan revelations). The thirty-seven volumes of the complex and deeply-layered book contain numerous ecstatic visions; in one, from chapter seventy-two, the Ka‘ba “raises its skirts” and rises up from its foundations, threatening Ibn Arabi and attempting to block his circumambulation. Just as the Ka‘ba, imagined as a young girl and addressed as “she,” is ready to jump, Ibn Arabi utters a poem of praise and the structure returns to its normal, fixed state. In thankfulness and humility at his deliverance, Ibn Arabi then composes eight love letters to the Ka‘ba, collected in the Taj al-Rasa’il wa-Minhaj al-Wasa’il (The Crown of Epistles and the Path to Intercessions).

The opening page of a late 17th century copy of Awrad al-Asbu’a, a collection of 14 devotional daily prayers authored by Sufi philosopher and mystic Ibn Arabi, the National Library of Israel collections

For Ibn Arabi as for other mystics, the Ka‘ba and the hajj are part of a symbolic system. The physical structure in Mecca represents the heart where the self and God truly reside; the journey to the true heart supersedes the journey to the physical heart, the Ka‘ba. As Ibn Arabi writes (in Stephen Hirtenstein’s translation):

 

When God created your body, He placed within it a Ka‘ba, which is your heart. He made this temple of the heart the noblest of houses in the person of faith. He informed us that the heavens… and the earth, in which there is the Ka‘ba, do not encompass Him and are too confined for Him, but He is encompassed by this heart in the constitution of the believing human. What is meant here by “encompassing” is knowledge of God (Futuhat ch. 355).

 

Nevertheless, the physical Ka‘ba demands respect—as Ibn Arabi terrifyingly learned—precisely because coming face-to-face with the Ka‘ba is coming face-to-face with the self: the most clarified self that is a locus for the manifestation of the divine. The rituals of the hajj are a tool for achieving this revelation and the geography of the sacred city is a map pointing towards it.

An illustration of the Holy Mosque in Mecca (right) and the Prophet’s Mosque in Medina (left). From an 18th century Indian manuscript of the Sufi prayerbook Dalāʾil al-khayrāt, the National Library of Israel collections

It is no wonder then that Muslims throughout the ages have made and used images of Mecca as a means of spiritual inspiration. The NLI collection contains numerous manuscript copies of a fifteenth century collection of blessings for the Prophet Muhammad known as the Dala’il al-khayrat wa-shawariq al-anwar fi dhikr salat ‘ala nabi al-mukhtar (“The Signs of Benefits and the Brilliant Bursts of Light in the Recitation of Prayers on the Chosen Prophet”). Composed by the Sufi mystic Muhammad b. Sulayman al-Jazuli (d. 1465), it was one of the most popular Muslim prayer manuals, with copies originating from Indonesia to Morocco. Many manuscripts of the text contain two illustrations: one of Mecca, including the Ka‘ba and other sacred sites, and the other of Medina, the location of the Prophet’s mosque. The images, from different times and places and composed in different styles, reflect the chronological and cultural diversity of the Muslim world. However, at the same time they speak to a shared and unifying desire: to approach the Ka‘ba in order to transcend the Ka‘ba and thereby to find one’s true self.

 

This article is part of the Maktoub digital Islamic manuscripts project at the National Library of Israel.  Supported by the Arcadia Fund, Maktoub will provide free, global access to more than 2,500 rare Arabic, Persian, and Turkish manuscripts and books preserved at the Library, and to the stories behind their creation.

 

If you liked this article, try these:

The Hejaz Railway: The Train That Connected an Empire

Abraham Shalom Yahuda: The Scholar, the Collector and the Collections

How a Handwritten 12th-Century Manuscript by Maimonides Ended Up at the National Library

The Hejaz Railway: The Train That Connected an Empire

These rare photos offer a glimpse of a monumental Ottoman project, designed to transport "hajj" pilgrims and unite a vast Islamic realm

Construction on the Hejaz Railway, 1907. Photo: Karl Lorenz Auler; from the  Pritzker Family National Photography Collection at the National Library of Israel

One black and white photograph shows train cars crossing a low, arched brick bridge in the midst of a desert, passing from nowhere to nowhere between sand and sky. In another, a line of workmen stand next to just-laid tracks. A third picture has been taken from inside the moving train, its shadow falling on the ground. Rails curve into the distance under the hulking presence of a massive desert rock.

These enigmatic photos are part of a one-of-a-kind album housed in the archives of the National Library of Israel. The album includes sixty-eight photographs taken in 1907 by Karl Lorenz Auler, with accompanying handwritten captions, of the famed Hejaz Railway. Stretching between Damascus and the Hejaz region of the Arabian Peninsula, the site of the holy cities of Mecca and Medina, and with a branch line to Haifa, the railway was built by the Ottoman Empire between 1900 and 1908 to connect these far-flung regions of its realm. Auler’s photos are important evidence of the construction in progress.

 

A railway bridge on the Hejaz Railway line, 1907. Photo: Karl Lorenz Auler; from the  Pritzker Family National Photography Collection at the National Library of Israel. Click image to enlarge

But what was Auler, a decorated Prussian military general, doing inspecting the Hejaz Railway for the Ottoman sultan? And how did the album end up here at the National Library?

The annual pilgrimage to Mecca, known as the hajj, is one of the most important rituals in Islam, a transformative and transcendental spiritual journey that every able-bodied and financially sound Muslim is obligated to perform at least once during his or her life. When the Prophet Muhammad made his first and only hajj in 630 CE, a few years before his death, he traveled by caravan and on foot across the desert from the first Islamic capital in the city of Medina, just over 400 kilometers away. But as the Islamic empire rapidly expanded over the next century, such journeys became longer and more dangerous. Disease and exhaustion were commonplace and bandits would regularly attack as pilgrims made their way through the desert.

Fortifications and a cistern at El-Mu’assem, near the Hejaz Railway line, 1907. Photo: Karl Lorenz Auler; from the  Pritzker Family National Photography Collection at the National Library of Israel. Click image to enlarge

In order to minimize these dangers, during the Middle Ages most pilgrims joined organized camel caravans that traveled on set routes. The caravans from the southern Iraqi city of Kufa, from Cairo, and from Damascus were the most important of these. The introduction of the steamship in the mid-nineteenth century eased the rigors of the journey, especially for pilgrims traveling from India, then under British colonial rule, and points east. However, this greater mobility directly contributed to the rise of a global pandemic. Cholera, native to India, was carried to Mecca by a hajj pilgrim in 1863, and from there spread worldwide. In alarm, European colonial powers imposed strict quarantine regimes on those arriving in and, especially, leaving Mecca.

Railroad cars traveling on the Hejaz Railway line, 1907. Photo: Karl Lorenz Auler; from the  Pritzker Family National Photography Collection at the National Library of Israel. Click image to enlarge

Bypassing these quarantines, and confronting European colonialism more generally, was a major impetus behind the construction of the Hejaz Railway. In the decades leading up to Emperor Abdulhamid II’s announcement, on May 1, 1900, of his intention to build the line, the Ottomans had lost almost all of their formerly extensive territories in southern Europe. French, British, and Russian interests were vying to break up the empire further, and to expand their rule into its heartland in the Middle East. At the same time, the Ottoman State was deeply indebted to European financiers, and had to rely on European creditors to fund their infrastructure and modernization efforts, including the construction of other railways to connect the vast empire.

Inauguration of the al-‘Ula Station, 1907. Photo: Karl Lorenz Auler; from the  Pritzker Family National Photography Collection at the National Library of Israel. Click image to enlarge
Camel unit parade at the al-‘Ula Station inauguration, 1907. Photo: Karl Lorenz Auler; from the  Pritzker Family National Photography Collection at the National Library of Israel. Click image to enlarge

On all these counts, the Hejaz Railway was to be different. While the line had little economic benefit—indeed, it only functioned regularly during the hajj season—it had numerous political and religious goals. The project was financed entirely by Muslims, and donations for the “sacred line” were collected around the world. This widely-publicized fact, as well as the construction itself, burnished Abdulhamid II’s power and his pan-Islamic image as the sole independent Muslim ruler confronting European interests. In addition to easing the rigors of the hajj itself, the line would also ensure that the Ottoman military could swiftly deploy troops and supplies to protect shipping in the Red Sea and to defend against colonial expansion and moves towards autonomy by local leaders, especially in Mecca.

Poor pilgrims on their way to Mecca, beg for permission to take the train, 1907. Photo: Karl Lorenz Auler; from the  Pritzker Family National Photography Collection at the National Library of Israel. Click image to enlarge

 

Local Bedouin and a railway worker at Wadi al-‘Ula, near the Hejaz Railway line, 1907. Photo: Karl Lorenz Auler; from the  Pritzker Family National Photography Collection at the National Library of Israel. Click image to enlarge

 

A Bedouin man offers an ostrich for sale next to the newly laid Hejaz Railway, 1907. Photo: Karl Lorenz Auler; from the  Pritzker Family National Photography Collection at the National Library of Israel. Click image to enlarge

While the railway was designed to showcase Ottoman leadership, German engineers and advisors were crucially involved in the railway’s planning and construction. This role built on a decades-long relationship of military and economic cooperation; for a host of reasons, Abdulhamid saw Germany as the empire’s preferred European partner.

It was in this context that Karl Auler became connected to the project. Auler, born in 1854, was a Prussian infantry general who, like many other officers, served as a military adviser to the Ottomans between 1901 and 1908. Appointed to the rank of major general by Abdulhamid, “Auler Pascha,” as he was known, was sent in 1904 to survey the progress on the railroad, and to study local geography and ethnography. Auler focused on two stretches of the line: between Damascus and Ma’an in southern Jordan, including the branch line to Haifa, and from Ma’an to Al-‘Ula in Arabia, 300 kilometers north of Medina. Auler’s reports, which remain among the most important sources on the Hejaz Railway, discuss the topography of the route; the local flora and fauna, including the termites who would eat away at the track’s wooden sleepers; the challenges in providing sufficient water and fuel; and the (possibly stereotyped) reaction of locals to the railway’s construction (in Peter Christiansen’s translation):

 

“The vividness with which they expressed their joy will remain unforgettable to me. As the men incessantly repeated a salutation in unanimous chorus, ‘May God give victory to our Sultan!’ there was an accompaniment of rhythmic clapping of hands while the women, with their characteristic high trills, produced strong pigeon-like cooing sounds in the highest treble.”

 

Auler’s reports, published in 1906 and 1908 in the influential journal Petermanns Geographische Mitteilungen, were illustrated with photographs that he himself took along the route. The album in the National Library collection, it seems, contains prints from a later, 1907 journey which, for whatever reason, he deemed unsuitable for publication. While the subjects of the two sets of photos largely overlap, the album includes more portraits—of local Bedouin, workers, officials, and others—providing fascinating glimpses of individuals and daily life.

View from the train of Wadi Abu Taka on the new Hejaz Railway, 1907. Photo: Karl Lorenz Auler; from the  Pritzker Family National Photography Collection at the National Library of Israel. Click image to enlarge

How did the photographs get to the National Library of Israel? While we do not know what Auler did with the photographs after returning to Germany in 1908—he served in the First World War and then retired to the city of Ulm—somehow they made their way to Gotthold Weil (1882-1960), a noted German-Jewish scholar of Islam, especially Turkish and Arabic, and a former director of the National Library of Israel. Weil taught in Berlin and Frankfurt before immigrating to Palestine in 1934, and though Auler does not seem to be mentioned in Weil’s personal archive, now housed at the library, the two German Turkophiles would have had much in common. The one-of-a-kind album may even have been given by Auler to Weil as a personal gift. He donated it to the library’s collection in 1936.

 

You can view the rest of the photographs from this historic photo album, here.

This article is part of the Maktoub digital Islamic manuscripts project at the National Library of Israel.  Supported by the Arcadia Fund, Maktoub will provide free, global access to more than 2,500 rare Arabic, Persian, and Turkish manuscripts and books preserved at the Library, and to the stories behind their creation.

 

If you liked this article, try these:

Abraham Shalom Yahuda: The Scholar, the Collector and the Collections

How a Handwritten 12th-Century Manuscript by Maimonides Ended Up at the National Library

A Personal Story of Migration as Told in a 1000-Year-Old Jewish-Afghan Letter