INTRODUCTION
This paper consists of three sections, namely: the introduction, mathematical methods and the Qibla determinations,Footnote 1 and conclusion.Footnote 2
Finding the direction of Mecca, i.e. the Qibla, as a problem in spherical astronomy, was a central issue during the Arabic-Islamic civilization.Footnote 3 In this paper, the three methods which Abū al-WafāʾFootnote 4 demonstrated in his Almagest Footnote 5 and their necessary steps will be discussed. It will be helpful to start by presenting the three methods, and then to go back to the beginning and discuss the successive steps of the procedure as it appears in his Almagest; this will be done in the next section.
In Fig. 1, M is Mecca with latitude ϕ 1 and longitude λ1, while point B is a given northern location (west to M in the figure), and N is the North Pole. In the spherical triangle BNM, angle N is known (by observation), and it is equal to the difference in longitude, i.e. Δ λ = λ2 − λ1, which is equal to arc AC, and arc NB is known (by observation), and is equal to 90° − ϕ 2, and arc NM is also known (by observation), and is equal to 90° − ϕ 1, and angle B is the Qibla required.Footnote 6 All circles in Fig. 1 are great circles, and the given horizon is the horizon of B, and circle NBC is its meridian, while circle NM is the meridian of M.
The three formulas for the Qibla.
Finding the spherical angle B seems simple for a modern reader; it can be determined with the help of the explicit formulaFootnote 7 (this could be regarded as the easiest and the simplest to use in such a caseFootnote 8):
The formula in (1) is implicitly one of the three methods of Abū al-Wafāʾ, and he calls it “a method without using the distance,”Footnote 9 and this will be discussed in the conclusion, as it is a main point in this paper. The second method of Abū al-Wafāʾ is as follows: He applies his spherical law of sines on the spherical triangle BNM and obtains:

where
is the distance between B and M, and it is in principle unknown. So, his second method depends directly on the distance and Abū al-Wafāʾ works out two methods for determining the distance. His third method also depends on the distance and it is actually the same as the second, but this time he applies the sine rule (the rule of four quantities) and obtains:Footnote 10
To achieve these formulas with accurate answers Abū al-Wafāʾ goes through this long process (mentioned successively as they appeared in his Almagest):Footnote 11
• Construction of the table of sines. To do this, Abū al-Wafāʾ presents different proofs for sum, difference, half, and double formulas for sines, and invents a new method to approximate the sine of degree one. This will be discussed under point 1.1.
• Construction of the table of tangents and cotangents. To do this, Abū al-Wafāʾ presents the definitions of the trigonometric functions and the relationships among them. As noted in (1), his method employs the tangent. Under this point the unit circle appears for the first time. This will be discussed under point 1.2.
• The theorems of spherical trigonometry. Abū al-Wafāʾ works out four theorems, all of which are applied to determine the Qibla, as will be shown (Fig. 22). These are: the sine rule; the tangent rule; the cosine rule for a spherical triangle (with only one right angle); the law of sines for spherical triangles. This will be discussed under point 1.3.
• The instruments of observation. His main tasks are: the determination of the obliquity of the ecliptic and thus the latitude of the location, e.g. Baghdad (ϕ 2 in Fig. 1), and determination of the direction of true north (i.e. the line of meridian of the given location). This will be discussed under point 1.4.
• Determination of the distance between two given locations, e.g. locations B and M in Fig. 1 (i.e. δ in formula (2)) and a numerical example. Abū al-Wafāʾ produces two general methods and places them in chapter 15 of Book IV (just before the chapter on the Qibla). This will be discussed under point 1.5.
• The three methods for the Qibla with a numerical example (the Qibla at Baghdad). This will be discussed under point 1.6.
The materials and the results that were available to Abū al-Wafāʾ regarding the subjects related to the problem of the Qibla:
1) The Elements of Euclid (born c. 325 BC). It was the only reference mentioned in the Almagest of Abū al-Wafāʾ. Two results from the Elements are used, namely: the side of a hexagon inscribed in a circle is equal to the radius, and the idea of the golden ratio. Abū al-Wafāʾ uses them to determine some basic trigonometric values.
2) The Almagest of Ptolemy (d. c. 165). The name Ptolemy is mentioned in the Almagest of Abū al-Wafāʾ but not the Almagest itself. Abū al-Wafāʾ also mentions Hipparchus (d. c. 120 BC) but without referring to any of his works. Certainly, Abū al-Wafāʾ benefited from Ptolemy's method for constructing the table of chords, i.e. the abstract method for constructing a table.
3) The Zīj of al-Battānī (d. 929). According to al-Fihrist, Abū al-Wafāʾ, in his youth, studied the works of al-Battānī. Abū al-Wafāʾ does not refer to al-Battānī in his Almagest.
4) The Sphaerica of Menelaus (d. c. 130). Neither the book nor Menelaus are mentioned in the Almagest of Abū al-Wafāʾ. The quadrilateral (the rule of six quantitiesFootnote 12), known as the spherical theorem of Menelaus, is mentioned but not used. Abū al-Wafāʾ actually applies this theorem in an earlier work named Determination of the Arc of the Revolution by the altitude at noon and …, it is a treatise which he dedicated to someone called Abū ʿAlī Aḥmad ibn ʿAlī ibn al-Sukkar,Footnote 13 but in this treatise, when applying the quadrilateral, Abū al-Wafāʾ mentions the Sphaerics of Theodosius (d. c. 90 BC) and not Menelaus, and again refers in many places to the Elements.
5) Abū al-Wafāʾ might have benefited from the works of al-Nayrīzī (d. c. 940) and al-Khāzin (d. c. 971) in their commentaries on Ptolemy's Almagest, they used the quadrilateral and particular cases of it which later led to the discovery of the spherical sine rule (the rule of four quantities).Footnote 14
6) The astronomical instruments and observations. Abū al-Wafāʾ is considered by historians as the first to build a wall quadrant to observe the sky, but no doubt he benefited from the works of his predecessors, especially al-Battānī (in his zīj, al-Battānī describes a quadrant instrument).
7) In addition to the above, Abū al-Wafāʾ wrote works on different branches of mathematics, such as: arithmetic,Footnote 15 applied geometry,Footnote 16 algebra,Footnote 17 burning mirrors,Footnote 18 and commentaries on Euclid, Diophantus, and al-Khwārizmī, and others.
1. MATHEMATICAL METHODS AND THE QIBLA DETERMINATIONS
1.1. Construction of the Table of Sines
The first known table of chords, which is lost, was that of Hipparchus;Footnote 19 its degree of accuracy is unknown. The second known table was made by Menelaus; this table is also lost. But, the important extant table of chords was that of Ptolemy.Footnote 20 In this table, the values are given in three sexagesimal places for every half degree, but there is an error in the third sexagesimal place.
The earliest Indian “sine table”, with radius equal to 3438, is found in the work of Āryabhaṭa (476–550) on astronomy. The inventors of it are unknown, but it is of Indian origin.Footnote 21 They tabulated the values of half the chord, and gave it the name ardhajya, and shortened to jya. It became jayb Footnote 22 in Arabic. The Europeans translated it into sinus.Footnote 23 But Indians first knew the addition formulas for sines in the year 1150 by Bhaskara II.Footnote 24 After the sine function, the versed sineFootnote 25 was the next function that interested the astronomer, and not the cosine. The versed sine is still used by surveyors. Āryabhaṭa computed a table for it. During the time of Abū al-Wafāʾ, all six trigonometric functions were introduced.
Basic Values: Since the radius is always divided into 60 equal parts, the values of the sine function (defined as line BC in Fig. 2) lie between 0 and 60 (i.e. between 0 and 1 in a unit circle). Abū al-Wafāʾ calls the value 60 the greatest sine. For simplification purposes, throughout the paper a circle of radius 1 will be used.Footnote 26 In his Almagest, he has recourse to sin 90° = 1 in many places, but he never mentions this obvious result (he does not even mention it in his tables) sin 0° = 0.
The sine and the cosine.

In addition to this, he also gives this basic result: sin 30° = 0; 30.Footnote 27
Before deducing this value, Abū al-Wafāʾ, in the second section of chapter five of Book I, states that:Footnote 28
قد بيّن إقليدس في المقالة الرابعة من كتاب الأصول أن نصف قطر كل دائرة مساوٍ لضلع المسدّس الذي يقع فيها. وكنا وضعنا قطر الدائرة مائة وعشرين جزءاً متساوية ومحيطها ثلاثمائة وستين جزءاً متساوية. فمن أجل ذلك وتر سدس الدائرة ستون جزءاً وجيب نصفه ثلاثون جزءاً.
In the fourth bookFootnote 29 of the Elements, Euclid showed that the radius of a circle is equal to the side of the hexagon inscribed in it. And since we divided the diameter into 120 equal parts, and the circumference into 360 degrees, the chord of one-sixth of the circumference [i.e. the chord of 60 degrees] is equal to 60 parts, and the sine of half of it [i.e. the sine of 30 degrees] is equal to 30 parts.
The next basic value which is necessary for Abū al-Wafāʾ to construct his table of sines is sin 36° (or sin 18°).
One of these values is sufficient. Abū al-Wafāʾ computes both values in different ways with the technique of the inscribed regular polygon.Footnote 30 To determine the side of a regular pentagon (or regular decagon) inscribed in a circle, he again makes use of Euclid's Elements and applies the idea of the “golden section” (a line cut in extreme and mean ratio). To determine crd 36°, he states the rule in general as follows (taken from proposition 9 of book XIII of the Elements):

Abū al-Wafāʾ does not present a proof for it but just a justification, as follows:
If the side of the hexagon (let it be r) and the side of the decagon (let it be x), inscribed in the same circle, are connected in a straight line, as in Fig. 3, then they form a line cut in extreme and mean ratio at the connection point, and then the following holds:

The positive solution of this quadratic equation gives the side of the decagon as stated above (here r is equal to half d); Abū al-Wafāʾ does not show how he solves the equation, but just mentions the rule. Abū al-Wafāʾ's original text is:Footnote 31
وأما وتر العشر فقد نُبين أنّا إذا أسقطنا من الخط القوي على خمسة أمثال مربع ربع القطر ربع القطر نفسه أن الباقي يكون ضلع المعشّر. وذلك أن ضلع المسدّس وضلع المعشر إذا اتصلا على استقامة كان مقسوماً على نسبة ذات وسط وطرفين. وأنه إن أُضيف إلى القسم الأقصر، من كل خط مقسوم بنسبة ذات وسط وطرفين، خط مساوٍ لنصف القسم الأطول فإن مربع ذلك يكون خمسة أمثال مربع نصف القسم الأطول. فإذاً متى أُسقط من الخط القوي على خمسة أمثال مربع ربع القطر- الذي هو نصف القسم الأطول من الخط المقسوم بنسبة ذات وسط وطرفين، وهو الخط المركب من ضلع المسدس وضلع المعشر- ربع القطر نفسه كان الباقي ضلع المعشر.
As for the chord of the decagon, we can show that if we subtract one-fourth of the diameter from the radical of the five times of the square on one-fourth of the diameter, then the remainder is the side of the decagon. This is because the side of the hexagon and the side of the decagon, if they are connected straight, they form a line cut in extreme and mean ratio.Footnote 32 And if we add half of the longest segment to the shortest segment – of a line cut in extreme and mean ratio – then the square on the sum equals five times the square on the half of the longest segment. And in this case, the line is composed of a side of the hexagon and a side of the decagon, if we subtract one-fourth of the diameter from the radical of the five times of the square on one-fourth of the diameter – which is half of the longest segment of the line cut in extreme and mean ratio – then the remainder is the side of the decagon.
The side of the decagon.

To determine the side of the pentagon, he presents three methods, two of them depend on the side of the decagon, and the third does not. One of the first two methods is identical to proposition 10 of Book XIII of the Elements (Abū al-Wafāʾ therefore did not give a proof for it):

The second method of Abū al-Wafāʾ for the side of the pentagon is:

The original formulation is:
وإن شئنا ضربنا ضلع المعشر في الجيب الأعظم ونقصنا ما اجتمع من نصف مربع القطر، فما حصل أخذنا جذره فما كان فهو ضلع المخمس.
We can also multiply the side of the decagon by the radius, and subtract the product from half of the square on the diameter, and take the root of the result. The result is the side of the pentagon.
His complete proof is:
In Fig. 4, let OB be the side of the decagon, i.e. OB = crd(decagon), and AC is the side of the square, i.e. AC = crd(square), then AB is the side of the pentagon,Footnote 33i.e. AB = crd(pentagon). Since AC 2 = OA 2 + CO 2, and CO 2 = CB · OB (because CB is cut into extreme and mean ratio at O), and since CB·OB = OB 2 + CO · OB, then
The side of the pentagon.
But AB 2 = AO 2 + OB 2. Therefore AC 2 = AB 2 + CO · OB.
His third method is formulated as follows (without giving a proofFootnote 34):
حساب ضلع المخمس بوجه ثالث من غير ضلع المعشر: وإن شئنا أسقطنا جذر خمسة أمثال مربع ثمن القطر من خمسة أثمان القطر، فما بقي ضربناه في القطر وأخذنا جذره، فما حصل فهو ضلع المخمس.
A third method for computing the side of the pentagon without using the side of the decagon: We can also subtract the radical of five times the square on one-eighth of the diameter from five-eighth of the diameter, multiply the remainder by the diameter, and take the root of the product. The result is the side of the pentagon.
In modern notation:

In the numerical examples, his answers are:
By this,
and
are both determined, and his results are correct to 11 decimal places. These basic values mentioned here will be taken into account in the approximation of sine 1.
Formulas: In section 3 of chapter 5 of Book I, Abū al-Wafāʾ uses the definition of the cosine (the complement of the sine to ninety degrees) and the Pythagorean Theorem (the right angle triangle OBC in Fig. 2) to deduce the following fundamental trigonometric relation:
and to obtain new values by using the already computed basic values, e.g.:
Again his result is correct to 11 decimal places.Footnote 37 In this regard, Abū al-Wafāʾ's original text is:
إذا كان جيب قوس معلومة معلوماً وأردنا أن نعلم جيب تمامها أسقطنا مربع الجيب من مربع الجيب الأعظم وأخذنا جذر الباقي، فما حصل فهو جيب تمام القوس.
If the sine of a given arc is known, and we want to determine the corresponding cosine, we subtract the square on the sine from the square on the greatest sine, and take the square root of the remainder. The result is the cosine.
In section 5 of chapter 5 of Book I, Abū al-Wafāʾ derives the half and double angle formulas for sines. These formulas are necessary and will both be used in his approximation of sin 1°. His proof on the double formula was as follows:
In Fig. 5, G and H are midpoints of arcs AB and AD respectively,Footnote 38 and GI and HJ are perpendicular. Since triangles ABE and ABD are similar, this means:Footnote 39
where
. This means:
and in general the double formula as stated by him is (he uses this in his numerical examples):
The double and half formulas for sine.
His original text is:
إذا أردنا ذلك ضربنا جيب القوس المعلومة في جيب تمامها دقائق، فما حصل فهو نصف جيب القوس.
If we want that, we multiply the given sine by the cosine minutes,Footnote 40 and the result is half the sine of the double.
To proof the half formula, Abū al-Wafāʾ does the following:
In Fig. 5, triangles ABE and ABD are similar; then

this means

i.e.

and in general the formula as stated by him is (he uses this in his numerical examples):
Notice that, and by definition: versin x = 1 − cos x. So, the formula actually is:
which Abū al-Wafāʾ does not mention in his Almagest.Footnote 41 Under the half formula, Abū al-Wafāʾ has already talked about the calculation of the value
by using the already determined values and by applying the half formula several times.Footnote 42 He did not mention why, but it seems he was preparing the reader for the approximation of sin 1° as he used it there. He also uses the same half formula as double formula, i.e.
this is equivalent to the formula (which he does not mention):
One might wonder why Abū al-Wafāʾ avoided dealing with this formula, and preferred the half formula with versed sine. This might be because the first could give negative values for some values of x.
As for the sum and difference formulas, Abū al-Wafāʾ presents two formulas with complete proofs, but because of the absence of the symbolism he cannot see that they are the same formula, and thus regards them as two different methods and gives a numerical example for each of them.Footnote 43 The two formulas are:

His original text for the second one is:
ضربنا جيب كل واحد منهما في جيب تمام الآخر دقائق، فما حصل جمعناهما إن أردنا جيب مجموع القوسين، وأخذنا تفاضلهما إن أردنا جيب تفاضلهما.
We multiply the sine of each of the two arcs by the cosine of the other minutes. If we want the sine of the sum, we add the products, if we want the sine of the difference, we take their difference.
And his proof is as follows:
In Fig. 6, where E is the center of the circle, BN is perpendicular to AE, and BD is perpendicular to CE. Since I and H are midpoints of BN and BD respectively, then
in the first figure, or
in the second figure.Footnote 44 This means thatFootnote 45
.
The sum and difference formulas for sine.
The triangles HGB and BEI are similar. This is because angles BGH and BIE are right angles, and angles H and E are equal, because they subtend BI. Therefore
But BH, BE and EI are known (
is given,
, and BE is the radius). So, GH is known.
Moreover, triangles BGI and EBH are similar. This is because angles H and G are right angles, and angles E and I are equal, because they subtend BH. Therefore
But BI, BE and HE are known (
is given,
and BE is the radius). So, IG is known. Therefore IH is known.Footnote 46
As an application to this formula, Abū al-Wafāʾ computed the following values:
where all places are correct.Footnote 47 Under this point, it is worth mentioning that Abū al-Wafāʾ also derives sum and difference formula for chords, and that his formulas differ from those of Ptolemy. Ptolemy's sum formula for chords is similar to the modern sum formula for cosine,Footnote 48 while Abū al-Wafāʾ's is similar to the sum formula for sine.
Approximation of sin 1°: To do this, Abū al-Wafāʾ makes use of the following lemma:
If the arcs AB, AC, AD,…< 90° are given such that: AC − AB = AD − AC = L, then
.
His proof was as follows:
In Fig. 7, let
where line AF is a diameter.
A lemma for the approximation of the sine of one degree.
Since angle CDH is bigger than BCI, make angle CDK equal to angle BCI. Since angles BCI and CDK are equal, and angles I and K are right angles, and BC equals CD, the triangles BCI and CDK are congruent. Therefore DK = CI.
But DJ < DM and DM < DK = CI ⇒ DJ ≪ CI.Footnote 49
Therefore DH − CG < CG − BE.
With the help of this lemma, the basic values, and the formulas, Abū al-Wafāʾ is able to approximate the value of one degree to a good degree of accuracy.Footnote 50 His method is as follows:
In Fig. 8,Footnote 51 suppose thatFootnote 52
, and
; divide arc BC into six equal arcs. This means that
and
.
The approximation of the sine of one degree.

The following values
can be determined as follows:Footnote 53
by applying the half formula on the side of the decagon. The valueFootnote 54
was obtained before.Footnote 55 As for the value
he suggests two methods:
They can be expressed as
or as
, and by half formula
Now since
and
, then
and
therefore
Similarly
This meansFootnote 57

By taking the mean value he obtainsFootnote 58
Now sin 1° can be computed from
by applying the double formula and he obtainsFootnote 59
In the proof, Abū al-Wafāʾ mentions that one cannot determine
directly from arcs AB, AG, and AC (as done for example in the case of
). And therefore, the value
should be approximated:
وليس في قسي اب از اجـ قوس يمكننا أن نعرف جيب الفضل بينها وبين قوس اح فلأجل ذلك ينبغي أن نعلم جيب قوس اح بأقرب ما يمكن أن يكون من الصواب.
There is no arc among the arcs AB, AG, and AC from which we can determine the sine of the difference between it and arc AH [as in the case of arc AB]. Therefore we have to approximate the sine of arc AH, as accurate as possible.
Abū al-Wafāʾ does not give a justification for his comment, and what he means is that the half cannot be written as an integer combination of the given three arcs
, i.e. interpreted to modern notations.Footnote 60
The proof of this is trivial. What is noticeable is that it seems Abū al-Wafāʾ does not theoretically study the above problem deeply; otherwise he would only mention two of the three values, as the third can be expressed as an integer combination of the other two.
This original method of approximating sine of one degree by Abū al-Wafāʾ is considered to be one of his great contributions to trigonometry.Footnote 61 The best-known results achieved before and after him were:Footnote 62
1) The approximation made by Ptolemy in his Almagest, correct to two places. His method could be summarized as:

2) The approximation made by the Egyptian Ibn Yūnus (d. 1005) in his Great Hakemite Table in sexagesimal with base 60 was:

His method is inspired in a way from that of Ptolemy. The method included:

3) Al-Kāshī (d. 1436) in his Treatise on Chord and Sine approximated sin 1°, correct to 17 decimal places by means of an iterative method. The method involves the approximate solution of a cubic equation associated with the problem of trisection of an angle. The equation is of the form ax − b = x 3, where x is sin 1°. This method was considered as one of the best achievements in medieval algebra. But he was not the first to approximate the solution of the mentioned equation; al-Bīrūnī did that before him.
Table of sines: Abū al-Wafāʾ was not satisfied with the results achieved by his predecessors, and he aimed to correct the trigonometric tables. In the preface of his Almagest, he states clearly that:
واستقصينا أيضاً حساب جداولها، وصححناها، خلاف من
من أهل هذه الصناعة.
We also examined the tables and corrected them, in a way different than that of our predecessors who worked in this field.
His table of sines consists of 5 columns. The first column is for the arcs at intervals of a quarter of a degree up to 90 degrees, starting from a quarter of a degree. The second column is for the corresponding values of sines. After computing sin 1°, and with the help of the formulas, Abū al-Wafāʾ can easily fill the table by determining the values
for n = 1, 2, 3, … , 360, where the answers are correct at least to 8 decimal places.Footnote 63
The third column is for the increments per minute for each interval of the second column.Footnote 64 The fourth column is for the corresponding values of the versed sines. The fifth column is for the increments per minute for each interval of the fourth column. Unfortunately, all his trigonometric tables are lost. Regarding the values that are not in the table, Abū al-Wafāʾ, following his predecessors, uses linear interpolation to approximate their sine values. The average increments in columns three and five, which are called sixtieths, are used in the linear approximation. Since the obliquity of the ecliptic (23; 35) and the latitude of Baghdad (33; 25), which he determined by observation, as will be shown later, are not in the table of sines, he approximates their trigonometric values using linear approximation.Footnote 65 Abū al-Wafāʾ likewise make use of linear interpolation to approximate the inverse sine.Footnote 66
1.2. Construction of the Table of Tangents and Cotangents
Definitions and Relationships: Abū al-Wafāʾ introduces Fig. 9 to present the relationship among the six trigonometric functions and their definitions.Footnote 67 In Fig. 9, arc AB is given.Footnote 68 The tangent of arc AB is defined as the line AF, the cotangent is line CE (complement of the tangent to ninety degrees), the secant is defined as line OF, and the cosecant is defined as line OE, the sine is defined as line BD, and the cosine is defined as line OD (the complement of the sine to ninety degrees). What could attract attention, from an historical point of view, is that Abū al-Wafāʾ, when he introduces these functions and their relationships, ignores the versed sine; he also ignores it in his spherical theorems, and in his applications in astronomy,Footnote 69 and instead of it he uses the cosine on many occasions.
The definitions of the six trigonometric functions.
Using Fig. 9, Abū al-Wafāʾ can easily derive the following relations:Footnote 70

With these definitions and relations, Abū al-Wafāʾ is considered to be the first to introduce the trigonometric functions in these clear and definite forms:
إنّ نسبة الأظلال المعكوسة إلى المقاييس كنسبة جيوب القسي إلى جيوب
ونسبة الأظلال المستوية إلى المقاييس كنسبة جيوب تمامات القسي إلى
ونسبة الأظلال إلى أقطارها كنسبة جيوب القسي إلى الجيب الأعظم. ونسبة الأظلال المستوية إلى المقاييس كنسبة المقاييس إلى الأظلال المعكوسة.
وهنالك استبانَ: أن المقياس إذا فرض واحداً فإنّ نسبة جيب القوس إلى جيب تمامها هو الظل المعكوس، وإن نسبة جيب التمام إلى جيبها هو الظل المستوي.
The ratio of the tangent to the measure equals the ratio of the sine to the cosine. And the ratio of the cotangent to the measure equals the ratio of the cosine to the sine. And the ratio of the tangent to the secant equals the ratio of the sine to the greatest sine. And the ratio of the cotangent to the measure equals the ratio of the measure to the tangent.
It is now obvious that if we let the measure be one, then the ratio of the sine to the cosine is the tangent, and the ratio of the cosine to the sine is the cotangent.
With the help of these relations he constructs the table of tangents and cotangents and works out the spherical theorems (particularly the tangent rule).
Numerical Examples: In some of the examples, when he assumes the radius to be 1, his results are identical to our modern results, as these values which were appearing for the first time:

But when he tabulates the tangents and cotangents he uses a circle of radius 60 to make the calculations easy, as the 60 was common that time. But he immediately comments:
وحتى متى أردنا أن يكون طول المقياس جزءاً واحداً أخذنا الأظلال من الجدول المرفوع وجعلنا باقيها كسوراً منسوبة إليه.
Whenever we want the radius to be one, we consider the degrees in the table as minutes and the rest as fractions related to it.Footnote 71
Table of Tangents and Cotangents: This table is more elegant than that of sines. In this table, he tabulated the tangents and the cotangents in reverse order. One might wonder why he did not tabulate the sines and cosines in the same way.
The table consists of four columns. The first one is for arcs of interval one-fourth of degree, i.e. arcs of the form
for n = 1, 2, …, 360, and this first column is for tangents. The second column is again for the arcs but in the reverse order, this second column is for cotangents. The third column is the corresponding tangents, or the corresponding cotangents. The fourth column is for the average increment per minute for each interval in the third column (to be used for linear approximations). Regarding the table of tangents and cotangents, Abū al-Wafāʾ mentions that the first column ends with 90, and that the second column starts with 89; 45. The table is unfortunately lost, and it would have been interesting to know whether Abū al-Wafāʾ left the places of tan 90° and cot 0° empty or if he wrote “infinity”:
وقد حسبنا أيضاً الأظلال لربع جزء ربع جزء. ووضعنا له جداول جعلنا في أحدها القسي المتفاضلة بربع جزء ربع جزء المبتدئة من ربع جزء إلى تمام ربع دائرة وجعلناها للأظلال المعكوسة. وجعلنا في الجدول الثاني القسي المتناقصة بربع جزء ربع جزء المبتدئة من تسعة وثمانين جزءاً ونصف وربع وجعلناها للأظلال المستوية.
We also computed the tangents [and cotangents] of all arcs for every one-fourth degree, and tabulated them. We put in the first column the arcs at intervals one quarter of a degree, starting from one quarter up to a complete quadrant [i.e. up to 90 degrees]. This column is for tangents. In the second column, we put the arcs at intervals of one quarter of a degree, starting from eighty-nine and half and one quarter of a degree.Footnote 72 This column is for cotangents.Footnote 73
1.3. Spherical Theorems
After discussing plane trigonometry and constructing the trigonometric tables with high accuracy in Book I, Abū al-Wafāʾ discusses the spherical theorems in chapter 1 of Book II. This second book of his Almagest consists of ten chapters. In the first chapter, which is the most important from a historical point of view, Abū al-Wafāʾ introduces four spherical theorems (mentioned in the introduction), which he applies tens of times throughout his Almagest in spherical astronomy. During the Arabic-Islamic civilization, the sine rule was known as al-shakl al-mughnī (The theorem which dispenses one from the need [of Menelaus's theorem]). It was KūshyārFootnote 74 who first gave the theorem this name. The expression al-shakl al-mughnī was also dedicated to the law of sines, i.e. even though they looked different in form, they were both known under the same name.Footnote 75 This could cause confusion or misunderstanding in writing the history of these two spherical rules. Al-Khujandī called the sine rule Qānūn al-Hayʾa (The Law of Astronomy), but as far as we know, this name was neither common nor popular. In his Almagest, Abū al-Wafāʾ has no special name for these theorems, he just calls them theorems, shakl, and assigns to them numbers, and in his applications, he refers to the sine rule as theorem 1 and to the law of sines as theorem 7, according to their appearance in the first chapter of Book II. So, the mentioned names were probably given after Abū al-Wafāʾ completed his Almagest.
Menelaus's theorem (the rule of six quantities), which was known as al-shakl al-qaṭṭāʿ (the quadrilateral), was the only spherical theorem used in spherical astronomy till the time of Abū al-Wafāʾ.Footnote 76 Since the theorem contained six quantities and a compound ratio, expressed with words, and no symbols, the application of this theorem was in many cases difficult and cumbersome. When the theorem became known to Arabs, they made many studies on it, sometimes as commentaries on the Almagest of Ptolemy and the Spherica of Menelaus, and sometimes as independent treatises. The purpose of these studies was to facilitate the use of this theorem. In his book, The Keys of Astronomy, the young al-Bīrūnī mentioned many of those Arab scholars, and the most famous among them were Thābit ibn Qurra (d. 901), Abū al-ʿAbbās al-Nayrīzī, Abū Jaʿfar al-Khāzin, and Abū Naṣr ibn ʿIrāq. Thābit wrote a work on the compound ratio, and another one on the quadrilateral.
Before discussing the disputes about the history of the sine rule and the law of sines, we should note that Abū al-Wafāʾ in his Almagest ignored Menelaus's theorem completely, as if it did not exist.Footnote 77 He used it neither in his applications nor in his proofs for the new theorems. Later, after Abū al-Wafāʾ's death, some Muslim scientists, like Ibn al-Haytham, in solving the problem of the Qibla, applied Menelaus's theorem.
The answer to the question regarding who was the first to discover the rule of sine is limited to three scientists, namely: Abū Naṣr, al-Khujandī, and Abū al-Wafāʾ. Since all these were distinguished scientists, and there is a lack of sources, and they all strongly claimed the priority, it is enormously difficult to give a final judgment on who first discovered the sine rule. Therefore a list of the main elements that might be crucial in making a judgement, would be more practical and more helpful. They are as follows:Footnote 78
• Many scientists worked on Menelaus's theorem to make it easy to use, such as:
Thābit; books on the compound ratio and quadrilateral;Footnote 79
Abū al-ʿAbbās al-Nayrīzī; commentary on Ptolemy's Almagest;
Abū Jaʿfar al-Khāzin; commentary on Ptolemy's Almagest;
Abū Saʿīd al-Sijzī;
Abū Naṣr ibn ʿIrāq; the book Tahdhīb.
• In their commentaries, al-Nayrīzī and al-Khāzin demonstrated particular cases of Menelaus's theorem, each of which led to the sine rule (just by using a very simple trickFootnote 80). Unfortunately, they didn't transpose these particular cases to a general rule; i.e. they did not aim to make these cases to replace the quadrilateral.
• The sine rule employs only arcs, and the technique of proving it was common to all scientists (straight lines inside the sphere and the similarity between plane triangles), and a particular case of it is also a particular case of Menelaus's theorem.
Accordingly, the three scientists in this dispute could in reality have discovered the sine rule independently; especially if they were aware of the achievements of al-Nayrīzī and al-Khāzin. For example, in his proof, al-Khujandī used the above mentioned simple trick. And this independence could explain the strong claim by each of the three scientists.
As for the law of sines, the case is totally different:
• The dispute over priority was only between Abū al-Wafāʾ and Abū Naṣr.
• New concepts and terms were employed, namely: a spherical angle and the sine of a spherical angle. This theorem dealt with sides and angles of a spherical triangle, whereas the sine rule dealt only with spherical arcs. So, in this case, the crucial issue is the initial thinking of formulating a theorem for a general spherical triangle employing its angles.Footnote 81
• A new technique of proving was introduced, i.e. by working entirely on the surface of the sphere. Before using this technique in his proof of the law of sines, Abū al-Wafāʾ also used it twice: in proving the cosine rule and in deducing another form of the sine rule itself.
• Abū al-Wafāʾ was the first to apply it; he applied it 13 times in his Almagest.
• Abū Naṣr was strongly supported by his pupil, al-Bīrūnī, to be the first to discover the theorem.
Accordingly, it would be difficult to believe that they both formulated the theorem and proved it independently at the same time. Also worth mentioning is the fact that the law of sines can be derived from the sine rule by using simple tricks, and in this sense, the one who discovered the sine rule might think that he also had the right to claim discovery of the law of sines. The formulation is the key issue here.
The Sine Rule: Since it is his main tool in spherical astronomy,Footnote 82 Abū al-Wafāʾ presents different geometrical figures, different forms, and two different proofs for the sine rule.Footnote 83 One of his formulations is as follows:
إذا تقاطعت قوسان على بسيط كرة من دوائر عظام وعلّم عليها نقط كيفما اتفقت فإن نسبة جيوب القسي التي بين تلك النقط وموضع التقاطع بعضها إلى بعض كنسبة جيوب ميولها الأُوَل بعضها إلى بعض.
Let there be two intersected great circles and some points on one of them are chosen. Then the ratio of the sines of the arcs between these points and the intersection point to each other is equal to the ratio of the sines of the corresponding first inclinations to each other.
His first proof is as follows (notice that Abū al-Wafāʾ does not draw the lines, in dot form, but just lines as if the figure were two dimensionalFootnote 84):
In Fig. 10, all arcs are of great circles, and angles E and C are right angles, and point G is the center of the sphere. Line BH is perpendicular to GC, and line DI is perpendicular to GE. They are also perpendicular to plane ACG. And lines BJ and DK are perpendicular to line AG.
The spherical sine rule.
Since BH is parallel to DI and BJ is parallel to DK, the angles JBH and KDI are equal. But angles JHB and KID are right angles. Therefore the triangles JBH and DIK are similar. This means
But
.
Here is the proof of the sine rule as it is given by Abū al-Wafāʾ:Footnote 85
برهانه: أنّا نفرض مركز الكرة نقطة ز، ونصل خطوط ا؟ز جـ؟ز
ونخرج من نقطتي ب د عمودي ب؟ح دط على خطي جـ؟ز
فهما عمودان على سطح ا؟جـ؟ز. ونخرج منهما أيضاً عمودي
على خط ا؟ز، ونصل خطي
فلأن خطي
موازيان لخطي د؟ط د؟ك تكون زاويتا
ك؟د؟ط متساويتين،
قائمتان، فيكون مثلثا
متشابهين. وتكون نسبة د؟ك؟، وهو جيب قوس ا؟د؟، إلى
وهو جيب قوس ا؟ب؟، كنسبة د؟ط؟، وهو جيب قوس د؟ه؟، إلى
وهو جيب قوس
وذلك ما أردنا أن نبين.
ProofFootnote 86: Let point G be the center of the sphere. Draw the lines AG, CG, and EG. From points B and D draw BH and DI perpendicular to lines CG and EG [respectively]. They are also perpendicular to plane ACG. Also, draw BJ and DK perpendicular to line AG. And draw the lines HJ and IK. Since lines BH and BJ are parallel to lines DI and DK, angles JBH and KDI are equal. But angles JHB and KID are right angles. Therefore triangles JBH and DIK are similar. So, the ratio of DK, which is the sine of arc AD, to BJ, which is the sine of arc AB, equals the ratio of DI, which is the sine of arc DE, to BH, which is the sine of arc BC. This was what we should demonstrate.
This theorem allows Abū al-Wafā to deduce another form of the rule. In Fig. 11, all arcs are of great circles, angles E and C are again right angles. Make arcs AH and AI quadrants and apply the already proved sine rule to obtain

Another form of the spherical sine rule.
But
. Therefore
.
The Tangent Rule: This rule was credited to Abū al-Wafāʾ by his contemporaries and later Muslim scientists. Combining the rule together with the definitions and the relationships among the trigonometric functions mentioned before, the most significant in this rule is that Abū al-Wafāʾ, by applying it many times in spherical astronomy, made the functions tangent and cotangent as famous as sine and cosine.Footnote 87 Al-Bīrūnī noticed its importance and adopted it immediately, describing it as a great contribution to astronomy (and it is), and explained the rule in detail in his works distinguishing between the tangent as shadow and the tangent as function of an arc. At first, the tangent rule was controversial; e.g. al-Khujandī and Kūshyār did not believe that it was true, but the young al-Bīrūnī convinced them later. In his The Quadrilateral, al-Ṭūsī, again discussed the cause that made the theorem controversial in detail.Footnote 88 Abū al-Wafāʾ's formulation is as follows:
إذا تقاطعت قوسان على بسيط كرة من دوائر عظام وعلّم عليها نقط كيفما اتفقت فإن نسبة جيوب القسي التي بين تلك النقط وموضع التقاطع بعضها إلى بعض كنسبة جيوب ميولها الأُوَل بعضها إلى بعض وكنسبة أظلال ميولها الثانية بعضها إلى بعض.
Let there be two intersecting great circles, and choose some points on one of them. Then the ratio of the sines of the arcs between these points and the intersection point to each other is equal to the ratio of the sines of the corresponding first inclinations to each other, and also equal to the ratio of the tangents of the corresponding second inclinations to each other.Footnote 89
His proof is as follows:
In Fig. 12, point I is the centre of the sphere, and the spherical angles D and B are right angles, and all arcs are of great circles, and BH and DJ are perpendicular to plane ABD. HK and JM are perpendicular to AI. It is clear that
The spherical tangent rule.
Since HK and HB are parallel to JM and JD, angles KHB and MJD are equal. And angles HBK and JDM are right angles. Therefore triangles KHB and MJD are similar. This means:

Here is the proof of the tangent rule as it is given by Abū al-Wafāʾ:
برهانه: أنْ نخرج من نقطتي ب د عمودي ب؟ح د؟ي على سطح ا؟د؟ب. ونفرض مركز الكرة نقطة ط، ونصل خطي ط؟جـ ط؟ه ونخرجهما على استقامتهما حتى يلقيا خطي ب؟ح د؟ي على نقطتي ح ي. ونخرج من نقطتي ح ي عمودين على خط ا؟ط، وهما
ونصل خطي ب؟ك د؟م. فظاهر أن خط
هو ظل قوس ب؟جـ ، وأن خط
هو ظل قوس د؟ه، وأن خط
هو جيب قوس ا؟ب، وأن خط د؟م هو جيب قوس ا؟د. فلأن خطي
موازيان لخطي
تكون زاويتا
متساويتين، و[لأن] كل واحدة من زاويتي
قائمة فمثلثا
فنسبة
وهو جيب قوس ا؟د، إلى ب؟ك، وهو جيب قوس ا؟ب، كنسبة د؟ي، وهو ظل [قوس] د؟ه، إلى
وهو ظل [قوس]
وذلك ما أردنا أن نبين.
Proof:Footnote 90 From points B and D draw BH and DJ perpendicular to plane ADB, and let I be the centre of the sphere. Draw lines IC and IE, and extend them to meet BH and DJ at H and J. From points H and J draw HK and JM perpendicular to line AI. And draw lines BK and MD. It is clear that HB is the tangent of arc BC, and line JD is the tangent of arc DE, and line BK is the sine of arc AB, and line DM is the sine of arc AD. Since lines HK and HB are parallel to line MJ and JD, angles KHB and MJD are equal. And since angles HBK and JDM are right angles, triangles KHB and MJD are similar. Therefore the ratio of MD, which is the sine of arc AD, to BK, which is the sine of arc AB, equals the ratio of DJ, which is the tangent of arc DE, to HB, which is the tangent of arc BC. This was what we should demonstrate.
Abū al-Wafāʾ uses this rule tens of times in his applications, and by this he makes the tangent and cotangent as famous as the sine and cosine (see the last discussion under the law of sines).
The Cosine Rule: This was less applied than the first two. But it bears two important indications with respect to history. It first indicates that Abū al-Wafāʾ had thought about making rules for spherical triangles,Footnote 91 and also that Abū al-Wafāʾ deduced it directly by applying the sine rule. Later, al-Bīrūnī classified the spherical triangles by their angles in a good systematic way, giving a formula for each, and enabling one to determine the unknown sides and angles (of the spherical triangle) from the known sides and angles. This was also done by al-Ṭūsī in his The Quadrilateral by dividing a general spherical triangle into two right angled spherical triangles; this enabled him to determine all the unknown quantities of the triangle from any three known quantities (by applying the tangent rule or law of sines).Footnote 92 In his applications, Abū al-Wafāʾ generally mentions (twice on two different occasions) that because two sides of a spherical triangle are known and one angle is a right angle, the third side is also known. Abū al-Wafāʾ's formulation of the theorem is as follows:
إذا كان على بسيط كرة مثلث مختلف الأضلاع، به قسي من دوائر عظام، فيه زاوية واحدة قائمة، فإنّ نسبة جيب تمام القوس التي توتر الزاوية القائمة إلى جيب تمام أحد الضلعين اللذين يحيطان بالزاوية القائمة كنسبة جيب تمام الضلع الثالث إلى الجيب الأعظم.
In a spherical triangle of great circles, where only one of the angles is a right angle, the ratio of the cosine of the hypotenuse to the cosine of one of the adjacent sides equals the ratio of the cosine of the third side to the greatest sine.
His proof for the cosine rule is as follows:
In Fig. 13, all arcs are of great circles and angle C of the spherical triangle ABC is a right angle, and arcs AD and AE are quadrants, this means angles D and E are right angles.Footnote 93 By sine rule:

The cosine rule for a right-angled spherical triangle.
But
. This means:
The Law of Sines: Abū al-Wafāʾ used this theorem only 13 times out of about 250 applications in spherical astronomy, one of these 13 times was in solving the problem of the Qibla. He actually looked at it as a reserve theorem, and applied it only in case he wanted to work out another method or find an alternative; he preferred to use sine and tangent rules. According to the appearance of the applications in his Almagest, the first application ever of this theorem was in determination of the ortive amplitude. This theorem appears at the end of the first chapter of Book II but Abū al-Wafāʾ introduces the definition of a spherical angle at the beginning of the chapter:
جيب الزاوية هو جيب القوس التي فيما بين القوسين اللتين تحيطان بتلك الزاوية من الدوائر العظام إذا كانت نقطة تقاطعهما قطباً لها.
The sine of the angle is the sine of that great arc, which lies between the two great arcs of the angle, where the intersection point [the vertex of the angle] is its pole.
Later, at the end of the chapter, and after demonstrating the above spherical theorems, Abū al-Wafāʾ formulates the spherical law of sines as follows:
ونسبة جيوب الزوايا التي تحيط
قسي من دوائر عظام، من المثلثات التي على بسيط الكرة، بعضها إلى بعض كنسبة جيوب القسي التي توترها بعضها إلى بعض.
In a spherical triangle of great arcs, the ratio of the sines of the angles to each other equals the ratio of the opposite arcs to each other.
For the proof of the theorem, Abū al-Wafāʾ presents three geometrical figures for three different cases of a spherical triangle; Fig. 14 is one of them.Footnote 94 His proof is as follows:
The law of sines for spherical triangles.
In Fig. 14, ABC is a spherical triangle of great arcs, point B is a pole for circle DE, and point C is a pole for circle EG. This means that angles G and D are right angles, and point E is a pole for circle GD, and then angle J is right angle. Sine rule gives:

ButFootnote 95
and
. Therefore

Straight after he derived the spherical theorems, Abū al-Wafāʾ goes back to the relationship between the tangent and cotangent and proves that they are reciprocal, i.e. he discusses and proves the cases
where a is a constant, and he assumes that the radius of the circle is 1. These relations allows Abū al-Wafāʾ to derive “different” formulas for the same astronomical problem. These techniques were mentioned because they will be used in the conclusion.
As it appears, in his proofs Abū al-Wafāʾ was independent and did not make any direct or indirect use of old spherical theorems. In addition to this, despite the fact that he derived the above spherical theorems, and also those related to plane trigonometry, and made a great contribution to both spherical and plane trigonometry, and despite the fact that the “trigonometry” part of his Almagest is separated from the “astronomy” part, Abū al-Wafāʾ was not aiming to make the “trigonometry” an independent science. With respect to him, like his predecessorsFootnote 96 and contemporaries,Footnote 97 “trigonometry” was a part of spherical astronomy. But Abū al-Wafāʾ surely paved the way for his successors to achieve total independence from astronomy. The main steps were made by Muʿādh al-Jayyānī (d. 1097), a Spanish-Arab mathematician, in his treatise Kitāb Majhūlat qisiy al-kura (The Book on Unknown Arcs of a Sphere),Footnote 98 Naṣīr al-Dīn al-Ṭūsī (d. 1274) in his treatise on The Quadrilateral,Footnote 99 and Regiomontanus (d. 1476) in his De Triangulis.
1.4. Calculation of the latitude of a location
Observation Instruments: The first practical problems that faced Abū al-Wafāʾ was the determination of the maximum inclination (the obliquity of the ecliptic) and the latitude of Baghdad;Footnote 100 he found them by determining the summer and winter solstices by observation. In his Almagest, Abū al-Wafāʾ describes in words three instruments for observation without giving geometrical figures. He does not tell us which one he used or which one he recommended. Below there are geometrical figures of these instruments and descriptions on how they work. Abū al-Wafāʾ spent a good part of his life observing stars and planets, and he was chosen to be a member of Baghdad's observatory. This observatory was set up on the request of Sharaf al-DawlaFootnote 101 and opened c. 988. Sharaf al-Dawla died in 989 and the observatory was closed. The observatory included some instruments such as a quadrant more than 6 meters long (one of his instruments below is a quadrant). Abū al-Wafāʾ is considered among historians to be the first to build a wall quadrant for observation. The original description of the instruments by Abū al-Wafāʾ is:
وأرصاد هذه الارتفاعات تكون بآلات تتخذ من الأجسام الصلبة إذا قسمت بالأجزاء التي قسمت
الدائرة. وذلك أنّا إذا وضعنا في سطح دائرة نصف النهار دائرة مقسومة بثلاثمائة وستين جزءاً متساوية، وقسمنا أجزاءها بما أمكن من الأقسام، ووضعنا على محيطها هدفين على جزأين متقابلين يتحركان على محيط الدائرة، إما بعضادةٍ مركبة على مركز الدائرة، أو بتركيب هدفين على دائرة تحيط بالدائرة الأولى وتتحرك عليها، وحركنا الهدفين عند تظليل الدائرة نفسها حتى يدخل شعاع الشمس من ثُقبَيها، كنا قد وصلنا إلى ارتفاع الشمس نصف النهار بأقرب ما يكون من الحقيقة. وذلك أنّا إذا أخذنا الأجزاء التي بين مرأى الهدف الأعلى وبين الخط الذي يقسم الدائرة بنصفين بخطٍ موازٍ للأفق كانت تلك القوس ارتفاع الشمس نصف النهار. وأيضاً إنّا متى نصبنا في سطح دائرة نصف النهار لوحاً مربعاً، وجعلنا الزاوية العليا الجنوبية مركزاً، وخططنا ببُعد أحد ضلعيه ربع دائرة، وقسمناه بتسعين قسما متساوية، وأقسامها بما أمكن من الأقسام المتساوية، وركّبنا عليه عضادةً مساوية لبعد المركز من محيطها، أمكننا أن نأخذ
الارتفاعات نصف النهار. وذلك أنّا إذا حركنا العضادة عند توسط الشمس السماء حتى يدخل شعاعها من ثقبي الهدفين. وأخذنا ما بين مرأى العضادة وطرف الربع مما يلي السماء كان ذلك ارتفاع الشمس نصف النهار. وإن نصبنا في مركز هذا الربع شخصاً وقسمنا ظل هذا الشخص نصف النهار، عند الأجزاء المقسومة، بنصفين، كان القوس التي بين موضع القسمة وبين طرف الربع مما يلي السماء ارتفاع الشمس نصف النهار. وأيضاً فإنّا إن نصبنا شخصاً مخروطاً على خط نصف النهار وجعلناه على زوايا قائمة على سطح موازٍ لسطح الأفق، أو جعلناه موازياً لـه، كان يمكننا أن نصل من مقدار ظله عند توسط الشمس السماء إلى ارتفاعها في ذلك الوقت. وذلك أنّا إذا قوسنا ظل هذا الشخص نصف النهار في جدول الظل كان ما يخرج من التقويس الارتفاع المطلوب.
The instruments that are used in observations should be made of solid matters, which can be divided into degrees as in the circle. Now if we put a circle, in the plane of the meridian, divided into 360 equal parts where each part is divided into as many equal parts as possible, and if we put on its circumference two targets on two opposite degrees, and the targets can be rotated by an alidade fixed at the centre, or by putting the two holes on a circle surrounding the first circle, and if we rotate the two holes till the ray of the sun passes through the two holes, then this will give us the altitude of the sun at noon as accurate as possible. This is because the arc between the upper hole and the diameter, which is parallel to the horizon, is the altitude of the sun at noon. Also, if we put a square in the plane of the meridian, and make the upper south angle a center of a quadrant with radius equal to the side of the square, and divide it [i.e. the quadrant] into ninety equal parts, and each part into many equal parts, and if we locate an alidade equals the radius, at the center, then this will enable us to determine the altitude at noon. This is because if we rotate the alidade till the ray of the sun at noon enters the two holes, then the distance between the alidade and the upper end of the quadrant is the altitude of the sun at noon. Also, if we locate an object at the centre of the quadrant, and if we bisect its noon shadow, then the arc between the mid-point and the upper end of the quadrant is the altitude of the sun at noon. Also, if we locate an objectFootnote 102 on the line of meridian, parallel or perpendicular to the horizon, then its shadow will enable us to determine the altitude of the sun at noon. This is because if we determine the inverse tangent of the noon shadow, by using the table of tangents, then the result is the wanted altitude.
Complete Circle with two Holes: In Fig. 15, the circle ABCD is drawn on a plate of solid matter with center O in the plane of the meridian. The circumference is divided into 360 degrees, and each degree into 60 minutes, and so on as much as possible. The opposite points F and E (the holes) are connected by the arm FE. This arm, which is fixed at O, can be rotated, either by an alidade or by putting the holes E and F on a circle, which can be rotated, concentric with circle ABCD. The diameter BD is parallel to the horizon, and point A represents the zenith of the location.
The complete circle; an observation instrument.
By rotating the arm EF so that the ray of the sun enters both E and F, one can measure the altitude of the sun at noon by measuring the degrees between E and B. He also generalizes this method to all other stars and planets. In this case, if there is no ray, the star or the planet should be seen through both holes.
Quadrant with two Holes: In Fig. 16, the square ABCD is of solid matter, where AD and BC are parallel to the horizon, and point A (hole) is the center of the quadrant BED, and E is a hole. The quadrant is divided into 90 degrees, and each degree is divided into 60 minutes, and so on as much as possible. By rotating the alidade (along arm AE fixed at A) until the ray of the sun enters both A and E, the latitude of the sun at noon is determined by measuring arc ED. From a technological point of view, this instrument is better than the previous one. In this instrument, one uses a smaller area but with a larger arc, and thus achieves more accurate results. In his zīj, al-Battānī described in detail two instruments, one of which is similar to this one, which he called al-labina (a squared plate made of copper, stone, or wood), but it is not as definite and clear as that of Abū al-Wafāʾ. Al-Battānī's second instrument was al-ʿaḍāda al-ṭawīla (the long alidade and uses three rulers).
The quadrant; an observation instrument.
The Gnomon: This instrument is an old one, but is worth mentioning as Abū al-Wafāʾ determines the altitude of the sun at noon with the help of this method of calculation. Abū al-Wafāʾ employs his tangent (cotangent) in an attractive way:
وذلك أنّا إذا قوسنا ظل هذا الشخص نصف النهار في جدول الظل كان ما يخرج من التقويس الارتفاع المطلوب.
This is because if we determined the inverse tangent [or cotangent] of the shadow at noon, by using the table of tangents, then the result is the wanted altitude.
In Fig. 17, ED is the gnomon which is set horizontally and DF is its shadow, and AC is the gnomon which is set vertically and CB is its shadow. Abū al-Wafāʾ says only one sentence about this method: “If we determined the inverse tangent (cotangent) of the shadow, the result is the wanted altitude at noon”. That means:
The gnomon; an observation instrument.
Observing the Solstices at Baghdad: Abū al-Wafāʾ did not talk much about this point, but just mentioned, during several years of observation at Baghdad, that he determined the maximum altitude of the sun at noon at the summer solstice and it was 80 degrees and 10 minutes (i.e. 80; 10), and that he determined its minimum altitude at noon at winter solstice and it was 33 degrees. The difference, which is 47; 10, is the great arc between the solstices, and its half, which is 23; 35, is the maximum inclination of the sun from the equator (the obliquity of the ecliptic). According to al-Battānī, in his zīj, the difference between the maximum and minimum altitudes used by Hipparchus and Ptolemy is 47; 42, and his own difference, observed from the city al-Raqqa (a city in northern Syria), is 47; 10 (the same result as that of Abū al-Wafāʾ achieved). But al-Battānī's maximum altitude is 59; 36, and the minimum is 12; 26, observed by means of his mentioned instrument, the long alidade. Abū al-Wafāʾ's original text about this point and his next point is:
ولما قسنا الشمس سنين متوالية بمدينة بغداد ورصدنا ارتفاعها عند مصيرها إلى الانقلابين، وذلك في الأوقات التي صارت في أعلى ارتفاعها واخفضها، وجدنا أكثر ارتفاعها ثمانين جزءاً وعشر دقائق وأقلها ثلاثة وثلاثين جزءاً. وإذا أخذنا تفاضلهما كان سبعة وأربعين جزءاً وعشر دقائق. فعلمنا
القوس التي بين الانقلابين، وأن نصفها، وهو ثلاثة وعشرون جزءاً وخمس وثلاثون دقيقة، هو مقدار ميل كل واحد من المنقلبين عن دائرة معدل النهار.
During successive years in Baghdad, we observed the latitude of the sun at noon at the solstices, namely at its maximum and minimum altitudes. We found that the maximum altitude is eighty degrees and ten minutes, and the minimum is 33 degrees. If we now take their difference, then we will obtain forty seven degrees and ten minutes. We already know that this is the arc between the solstices, and half of it, which is twenty three degrees and thirty five minutes, is the maximum inclination.
Calculation of the Obliquity of the Ecliptic: In Fig. 18,Footnote 103 points W and S on the meridian circle are respectively the winter solstice (the minimum latitude of the sun at noon), call it m (arc WH), and the summer solstice (the maximum altitude of the sun at noon), call it M (arc SH). Point Z is the zenith of the location, and N is the North Pole; the figure is seen from east. After finding m and M by observation, to calculate the obliquity of the ecliptic, call it ε, Abū al-Wafāʾ suggests the following (and this is only for the northern locations):
or
The obliquity of the ecliptic.

And according to the data which he already determined, he obtains:
Calculation of the Latitude of Baghdad: After determining ε, he easily found the latitude of the given location, call it ϕ. He uses the following methods for northern locations (Fig. 18):
or
or
And according to his data, the latitude of Baghdad is:
Abū al-Wafāʾ's original text about the calculation of the latitude is:
إذا زدنا الميل الأعظم على ما نقص أكثر الارتفاعين للانقلابين نصف النهار عن ربع دائرة كان ذلك عرض البلد، إن كان الارتفاع في ناحية الجنوب في المساكن الشمالية. وإن كان في ناحية الشمال وزدنا الميل الأعظم على ارتفاع نصف النهار، كانت زيادة الحاصل على ربع دائرة عرض البلد. وإن كان أكثر الارتفاعين ربع دائرة، كان عرض البلد مساوياً للميل الأعظم.
If we add the maximum inclination to the difference between one-fourth of the circle and the greatest altitude at noon, then we get the latitude of the location, if the altitude is southern at northern locations.Footnote 105 And if it is northern, and we add the maximum inclination to the altitude at noon, and we subtract a quadrant from the obtained, then the remainder is the latitude. If the greatest altitude is a quadrant, then the latitude is the maximum inclination.
This number 33; 25 (the latitude of Baghdad) will be used in the example of the Qibla. Since it is neither in the table of sines nor in the table of tangents, Abū al-Wafāʾ approximates its trigonometric values and his results are as follows:
Determination of the Direction of True North: Despite the fact that the line of meridian (or the four directions at a given location) is basic for the problem of the Qibla (as a practical problem), in his Almagest, Abū al-Wafāʾ does not discuss it. On the contrary, al-Battānī, in his works, which Abū al-Wafāʾ studied in his youth, describes some practical methods for determining the line of meridian. One of these methods described by al-Battānī is as follows:
In Fig. 19, let circle ABD be horizontal, and place at its centre O a straight thin stick with sharp peak vertically.Footnote 110 When the shadow of the stick is decreasing (during the morning hours), mark a point (point A) on the circumference of the circle as soon as the shadow tries to enter the circle, and when the shadow is increasing (during the afternoon hours), mark another point (point B) on the circumference of the circle as soon as the shadow tries to go out the circle. Let point C be the midpoint of arc AB,Footnote 111 then the diameter DC is the meridian line, i.e. the directions of true south and true north. To locate the directions of east and west, draw a diameter perpendicular to DC.
The direction of the true North.
1.5. Determination of the Distance between two Locations
In his Almagest, Abū al-Wafāʾ discusses this subject in chapter 15 of Book IV, as it appears in the table of contents at the beginning of Book IV. But, this chapter is lost. In fact, the copyist forgot it, and after he finished copying chapter 14 he started immediately with chapter 16, this is according to the manuscript of the Almagest (MS Paris, BN, no Ar. 2494). But a good part of this lost chapter is found in another Arabic manuscript, also in Paris BN, no Ar. 5968, named Dustūr al-Munajjimīn. Footnote 112 The author of Dustūr al-Munajjimīn was only interested in the methods and the numerical examples Abū al-Wafāʾ produced, and dropped the proofs. It is not difficult to reconstruct Abū al-Wafāʾ's proofs. Following Abū al-Wafāʾ's way in proving the astronomical methods as appeared in his applications in Books II, III, and IV, one can easily discover how and which of the spherical rules Abū al-Wafāʾ used in his demonstrations to prove his two methods for distance between locations.
The Fig. 20Footnote 113 will clarify the terms defined by Abū al-Wafāʾ. Points B and M are two northern locations, and circle CAE is the horizon of B, and circle NBC is the meridian of B, and circle NMH is the meridian of M, and circle GED is the equator with pole N, and in this case E is a pole for the meridian of B. All circles are great circles. The figure is seen from the west and it coincides with the case Baghdad-Mecca.Footnote 114
The distance between two locations.
So, arc BM is the distance between B and M, which is the wanted; arc GH is the difference between their longitudes; the circle FME is the circle of the equation of longitude; arc FM is called the equation of longitude, call it λ e; arc FG is called the equation of latitude,Footnote 115 call it ϕ e; arc BG is the latitude of B, and arc MH is the latitude of M.
To determine arc BM, where the latitudes and longitudes of B and M are known,Footnote 116 Abū al-Wafāʾ works out two methods. The first method depends on the equation of latitude, arc FG, and the equation of longitude, arc FM. So, determining arcs FG and FM is a first step. Throughout his Almagest, Abū al-Wafāʾ follows this way to build his work:
1) Proving the astronomical problem with the help of a geometrical figure applying the proven spherical theorems. This part of the work is directed to geometers. He calls this part “Method”.
2) Stating the method generally. This part is directed to the calculators. He calls this part “Computation”.
3) Giving a numerical example on the problem (usually Baghdad was the location). This part is directed to beginners. He calls this part “Example”.
4) Finding, if possible, another method or more for the same astronomical problem i.e. repeating again the points 1 to 3.
The First Method for the Distance: To determine the distance BM, δ, Abū al-Wafāʾ applies the cosine rule on the right angle spherical triangle FBM (Fig. 20) and obtains:
Notice that arc BF is the difference between arcs BG and FG, i.e.
. Suppose that M(ϕ 1, λ 1) and B(ϕ 2, λ 2), where ϕ 1 < ϕ 2, the rule in general as stated by Abū al-Wafāʾ isFootnote 117:
إذا أردنا أن نعرف البعد ما بين البلدين ضربنا جيب تمام الفضل بين عرض أحد البلدين وتعديله في جيب تمام تعديل الطول دقائق، فما حصل فهو جيب البعد بين المسكنين.
If we want to determine the distance between the locations, we multiply the cosine of the difference between the latitude of one of the two locations and its equation of latitude by the cosine of the equation of longitude minutes, the result is the sine of the distance between the locations.
To determine λ e and ϕ e, he suggests the following: Since angles G and F are right angles, the sine rule gives

But arc NH is a quadrant and arc NM is the complement of arc MH, this means:
And in general as stated by Abū al-Wafāʾ is:
ضربنا جيب تفاضل الطولين في جيب تمام أقل العرضين دقائق، فما حصل فهو جيب تعديل الطول.
We multiply the sine of the difference in longitude by the cosine of the minimum of the two latitudes minutes, the product is the sine of the equation of longitude.
As for ϕe, since angles G and H are right angles, the sine rule gives

But arc EF is a quadrant and arc EM is the complement of arc MF, this means

And in general as stated by Abū al-Wafāʾ:
قسمنا جيب أقل العرضين على جيب تمام تعديل الطول دقائق، فما حصل فهو جيب تعديل العرض.
We divide the sine of the minimum of the two latitudes by the cosine of the equation of longitude minutes; the result is the sine of the equation of latitude.
The Second Method for the Distance: The method does not employ λ e and ϕ e, and it is generally described by Abū al-Wafāʾ as follows:Footnote 119
where Δϕ is the difference in latitude, and Δ λ is the difference in longitude. The original text is as follows:
وجه ثان في معرفة البعد بين المساكن: ضربنا ظل عرض البلدين أحدهما في الآخر، فما حصل فهو دقائق، زدناه على الجيب الأعظم وحفظناه. ثم حصلنا فضل ما بين الطولين جيباً معكوساً، وضربناه في جيب تمام فضل ما بين العرضين، وقسمنا ما اجتمع على المحفوظ، فما حصل أسقطناه من جيب تمام فضل ما بين العرضين، فما بقي أسقطنا قوسه من
فما بقي فهو البعد بين البلدين.
Another method for computation of the distance between locations: We multiply the tangents of the latitudes by each other; the product is in minutes.Footnote 120 And add it to the greatest sine, and keep it. Then we determine the versed sine of the difference in longitude, and multiply it by the cosine of the difference in latitude, and divide the result by the kept result. Then we subtract the result from the cosine of the difference in latitude, and then we subtract the corresponding arc of the result from 90, and the remainder is the distance between the locations.
Example: Baghdad – Mecca: Abū al-Wafāʾ's data for Baghdad are:Footnote 121ϕ 2 = 33; 25, λ 2 = 70; and for Mecca: ϕ 1 = 22, λ1 = 67.
His calculation for determining λ e is:
His calculation for determining ϕ e is:
His calculation for determining the distance between Baghdad and Mecca is:
1.6. Determination of the Qibla
Abū al-Wafāʾ discusses this subject in chapter 16 of Book IV of his Almagest. He starts the chapter by introducing the terms supplied with a geometrical figure. The important terms are the distance between Mecca and the given location and the direction of the Qibla, which is usually called the azimuth. Fig. 21, which he produced, is actually part of his complete figure (Fig. 20). In Fig. 21, arc CAE is the horizon of the given location B with meridian circle DFC, M is Mecca and circle FME is the circle of the equation of longitude. Then arc BM is the distance between the location B and Mecca, and arc AC is the direction of Mecca.Footnote 127 Abū al-Wafāʾ demonstrates three methods to find arc AC. Two methods depend on the distance between the locations, but the third does not.
The direction of the Qibla.
Besides the pure mathematical solutions of the problem of the Qibla, scientists during the Arabic-Islamic civilization discussed other “non-mathematical” methods. One of these famous methods, discussed for example by al-Ṭūsī, was as follows: since the latitude of Mecca is less than the maximum inclination (the obliquity of the ecliptic), the sun passes above Mecca twice in a year.Footnote 128 Such a thing happens when the declination of sun is equal to the latitude of Mecca. So, when the sun at noontime is above Mecca (at its zenith), the direction of the sun is the direction of Mecca. But this method works only for the hemisphere of Mecca, because on the opposite hemisphere the sun will not be visible. In applying this method one should take into consideration the time difference between Mecca and the given location.
The First Method for the Qibla: Since the angles E and J are right angles, the sine rule gives:Footnote 129

The general form as stated by Abū al-Wafāʾ is:
where q is the wanted Qibla. Footnote 130 Abū al-Wafāʾ's own formulation is:
حساب سمت القبلة من البعد بين المساكن: إذا أردنا أن نعرف سمت قبلة مسكن قسمنا جيب تعديل الطول بين البلد ومكة على جيب البعد بينهما [دقائق]، فما كان فهو جيب سمت القبلة.
Computation of the azimuth of the Qibla using the distance between the locations: If we want to determine the azimuth of the Qibla at a given location, we divide the sine of the equation of longitude by the sine of the distance between them minutes. The quotient is the sine of the azimuth of the Qibla.
The Second Method for the Qibla: In the spherical triangle BMN, the law of sines gives:Footnote 131

where arc MN is the complement of MH (the latitude of Mecca).
The general form as stated by Abū al-Wafāʾ is:Footnote 132
Abū al-Wafāʾ's own formulation is:
ضربنا جيب تفاضل الطولين في جيب تمام عرض مكة، وقسمنا ما اجتمع على جيب البعد بين البلدين، فما حصل فهو جيب سمت القبلة.
We multiply the sine of the difference in longitude by the cosine of the latitude of Mecca, and divide the product by the sine of the distance between them. The result is the sine of the azimuth of the Qibla.
The Third Method for the Qibla: This third method, which will be discussed in the conclusion, is different than the first two methods. It does not use the distance between the locations, but the equation of longitude, λ e, and the equation of latitude, ϕ e, and latitude of the location, ϕ 2. Here, Abū al-Wafāʾ demonstrates methods for computation of λ e and ϕ e different than the previous ones; this time he only applies the tangent rule.
In Fig. 20, angles H and G are right angles, and tangent rule gives:Footnote 133

Abū al-Wafāʾ's own formulation is:
قسمنا ظل عرض مكة على جيب تمام تفاضل الطولين دقائق، فما خرج من القسم فهو ظل تعديل العرض.
We divide the tangent of the latitude of Mecca by the cosine of the difference in longitude minutes. The quotient is the tangent of the equation of latitude.
In Fig. 20, angles F and G are right angles, and tangent rule gives:

Abū al-Wafāʾ's own formulation is:
ضربنا جيب تمام تعديل العرض في ظل تفاضل الطولين دقائق، فما حصل فهو ظل تعديل الطول.
We multiply the cosine of the equation of latitude by the tangent of the difference in longitude minutes. The product is the tangent of the equation of longitude.
In Fig. 20, angles C and F are right angles, and tangent rule gives:Footnote 134

Abū al-Wafāʾ's own formulation of this method was:
قسمنا ظل تعديل الطول على جيب فضل ما بين عرض البلد وتعديل عرضه دقائق، فما حصل فهو ظل سمت القبلة.
We divide the tangent of the equation of longitude by the sine of the difference in latitude between the location and the equation of latitude minutes. The result is the tangent of the azimuth of the Qibla.
Abū al-Wafāʾ calls this method:
معرفة سمت القبلة من غير أن نعرف البعد بين المساكن.
Computation of the azimuth of the Qibla without knowing the distance between the locations.
The following diagram, Fig. 22, sketches the main steps of Abū al-Wafāʾ's work.
Abū al-Wafāʾ's methods for the Qibla.
Summary: Given a northern location B(ϕ 2, λ 2), and Mecca M(ϕ 1, λ 1), where e.g. ϕ 1< ϕ 2.Footnote 136 The distance between M and B is denoted by δ, and Δλ = |λ 2 − λ 1|, and q is the Qibla. Abū al-Wafāʾs work can be summarized as follows:
Example (The Qibla at Baghdad): Given Baghdad with latitude ϕ 2 = 33; 25 and longitude λ2 = 70, and Mecca with latitude ϕ 1 = 22 and longitude λ1 = 67. Abū al-Wafāʾ produces three numerical examples, an example for each method. The example on the third is as follows:
Starting with the equation of latitude, ϕ e, his calculation is:
As for the equation of longitude, λe, his calculation is:
And for the Qibla his calculation is:
According to his data for longitudes and latitudes of Baghdad and Mecca and his methods, and according to our trigonometric tables, the more accurate answer for the Qibla is:
2. CONCLUSION
For a given northern location the problem of the Qibla can always be reduced to find e.g. angle B in Fig. 23 (p. 52) where the three other marked quantities are known.Footnote 141 An explicit mathematical formula for angle B employing only the three known quantities would be an easy solution, as for example the so-called four-parts formula,Footnote 142 and it is in general:
The four-parts formula.
cos (inner side) cos (inner angle)
= sin (inner side) cot (other side) – sin (inner angle) cot (other angle).
This formula can be derived from the law of sines and law of cosines by simple algebraic means.Footnote 143 Applying the formula on triangle BMN gives:Footnote 144
which is formula (1) mentioned in the introduction. In the following derivation, it will be shown that formula (1) is actually Abū al-Wafāʾ's third method; only what Abū al-Wafāʾ achieves and uses in his Almagest will be employed.
Using the definition of λ e and difference formula for sines on his third method of the Qibla Footnote 145
one obtains
Dividing the numerator and the denominator of the right side by cos ϕ e one obtains
Substituting the value of tan ϕ e one obtains
Using the definition of the tangent one obtains

or the four-parts formulaFootnote 146
i.e.
Abū al-Wafāʾ, as quoted before, calls this method “a method without knowing the distance”. These are the main steps that allow him to reach his easy formula (the order could be unimportant but the scientific atmosphere is the point):
1) The discovery of the cosine rule: as an introduction for thinking of a theorem for a general spherical triangle where the angles are involved.
2) The discovery of the general spherical law of sines: as an introduction to thinking of the case as in Fig. 23 (three consecutive known quantities).
3) The new definitions of the trigonometric functions: as an introduction for the discovery of the tangent rule.
4) The discovery of the tangent rule: as an introduction to working the easy formula for the Qibla (his third method).
This advancement, or this turning point, in trigonometry happened in the last decade of the tenth century with the works of Abū al-Wafāʾ and some of his contemporaries, like Abū Naṣr. With this turning point, trigonometry had made a huge step towards its modern form.Footnote 147
ACKNOWLEDGMENT
The author would like to thank Prof. Roshdi Rashed (Paris 7 University) warmly for his great support and enormous help in so many ways. The author would also like to take this opportunity to thank Prof. Kirsti Andersen (Aarhus University – Denmark) for her help in discussing the trigonometry part of the paper; to thank Ch. Burnett and D. Grupe for improving the English language; and to thank King Fahd University of Petroleum and Minerals for its continuous support, including the proof-reading by, EFL instructor, Rodney Munn.



