Gion shrine problem

This problem was posted at Gion (now Yasaka) shrine in Kyoto in 1749. Here is its entry at the [url=https://sangaku-archive.org/works/1774_Kyoto_Gion_1262]Sangaku Archive[/url].
Statement
In the circular segment below, the chord has length [i]a[/i] and its perpendicular bisector (also known as the [i]sagitta[/i]) has length [i]m[/i]. Consider the square of side [i]s[/i] and circle of diameter [i]d[/i] as shown. Given the quantities[br][center][math]\large p=a+m+s+d[/math][/center][br]and[br][center][math]\large q=\frac{m}{a}+\frac{d}{m}+\frac{s}{d}[/math][/center][br]find [i]a[/i], [i]m[/i], [i]s[/i], and [i]d[/i].
At its heart, this problem's goal was to find a polynomial in one of the original variables ([i]a[/i], [i]m[/i], [i]s[/i], or [i]d[/i]) that has coefficients in terms of [i]p[/i] and [i]q[/i]. After plugging in these given values, one could then—at least in theory—solve the polynomial for that variable. This would be done numerically, using [i]sangi [/i]computing rods and an iterative polynomial root extraction technique adopted from China called [i]tian yuan shu[/i], or "the celestial element method." Recovering the values of the remaining three variables should then be easy.[br][br]The solution displayed on the Gion [i]sangaku[/i] was purportedly a polynomial in [i]a[/i] of degree 1024. We know about this original solution only indirectly: a brief description (including the degree, but no other details) was recorded on an 1815 [i]sangaku[/i] hung in Zenkōji Temple in Nagano Prefecture, which itinerant mathematician Yamaguchi Kanzan (?–1850) later transcribed into his now-famous travel journal.[br][br]The Gion shrine problem, as it came to be known, apparently attracted the attention of many Edo period mathematicians. The challenge was to find a "better" solution, i.e., a polynomial of lower degree. From a geometric perspective, the problem is fairly simple: there are three right triangles that relate the four previously-defined lengths ([i]a[/i], [i]m[/i], [i]s[/i], and [i]d[/i]), along with the radius [i]R[/i] of the large circular segment.
Applying the Pythagorean theorem thrice yields three equations in five unknowns:[br][center][math]\large[br]\begin{align}[br](a/2)^2+(R-m)^2&=R^2 \\[br]s^2 - (R-m+s)^2&=R^2 \\[br](d/2)^2+(R-m+d/2)^2&=(R-d/2)^2[br]\end{align}[br][/math][/center][br]Thus, two additional, independent pieces of data are needed to solve for the variables. For example, one could have designed the problem to have given quantities [math]\large m=6[/math] and [math]\large d=5,[/math] in which case finding [i]R[/i], [i]a[/i], and [i]s[/i] would be straightforward. Instead, the Gion shrine problem gives us [i]p[/i] and [i]q[/i], which are (complicated, in the case of [i]q[/i]) combinations of those unknowns. Untangling these five equations to get a polynomial in [i]a[/i] (for example) with coefficients only in terms of [i]p[/i] and [i]q[/i] (without any stray [i]m[/i]'s, [i]s[/i]'s, [i]d[/i]'s, or [i]R[/i]'s) is not a trivial exercise in algebra.[br][br]As such, this is a good example of a [i]sangaku[/i] problem requiring minimal geometric insight, but a great deal of algebraic sophistication—the ability to manipulate a system of nonlinear equations to eliminate variables while keeping exponents minimized. The Gion shrine problem would become famous for pushing skilled algebraists among the [i]wasanka[/i] to find a solution polynomial of the lowest possible degree.
This presumed competition was ultimately won in 1774 by mathematician Ajima Naonobu (1732—1798) of the Seki School in Edo. His solution, in the form of a 10th degree equation, is contained in a manuscript, and exhibits several notable features. Through a series of clever substitutions and recombinations of the original five equations, Ajima arrives at a simultaneous system of four equations (degree three, in a new composite variable containing [i]r[/i]) all equal to zero, with coefficients that depend only on [i]a[/i], [i]p[/i], and [i]q[/i]. This can be viewed (at least, through modern eyes) as a homogeneous [math]\large 4\times4[/math] linear system with a nontrivial solution; those who have studied linear algebra would rightly conclude that the [i]determinant[/i] of this system must be equal to zero. In fact, this is the conclusion Ajima draws: he computes the determinant from the coefficients of the system, thus eliminating [i]r[/i]. The result is a polynomial—of degree 10 in [i]a[/i]—equal to zero. (Ajima does not address [i]which[/i] of the ten possible real roots corresponds to the actual chord length.) As of this writing, no one has found a solution of lower degree.[br][br]The notion that the coefficients of a system could be combined into a new and useful algebraic object was not new at the beginning of the Edo period. The Chinese, for example, executed determinant-like computations centuries earlier. However, it wasn't until the late 17th century that two mathematicians from distant cultures independently developed comprehensive theories of determinants: Gottfried Wilhelm Leibniz (1646—1716), the German co-creator of calculus, in 1693; and Seki Takakazu in 1683.[br][br]Ajima would certainly have known about Seki's results, though he appears to have computed the determinant in the Gion shrine problem in an innovative way, using a method today called [i]cofactor expansion by complimentary minors[/i]. Cofactor expansion, the technique typically taught for calculating determinants in linear algebra courses today, is usually attributed to the French polymath Pierre-Simon Laplace (1749—1827). But, like the determinant itself, this idea was independently developed by mathematicians in Edo Japan.

Information: Gion shrine problem