2025 Sangaku (算額) Puzzle


Happy New Year 🥳 and welcome to the first Casual Chronicle of 2025. This one combines the number 2025 with some Japanese history and culture, in particular, mathematics. We will take a short dive into the world of Sangaku: Japanese geometry material from the Edo period (1603-1867)
Sangaku, or “mathematical tablets,” were wooden plaques adorned with intricate geometric puzzles which were left as offerings in Shinto and Bhuddist temples. These tablets often featured problems that demonstrated advanced mathematical proofs or conjectures involving Euclidean geometry theorems and algebraic relationships. The presenters and makers of these beautiful and colourful drawings on wooden tablets were very diverse: samurai, merchants, farmers, etc. Over the centuries many tablets were lost in a fire and others just didn’t weather the elements, but around 900 of the original tablets have survived.
This geometric-based intellectual pursuit was combined with religious devotion, making Sangaku a unique blend of culture and science. Skilled geometers dedicated their Sangaku as thanks to god for discovering a theorem: but the proofs of the theorems often were not given, leaving it as a challenge to others. This casual chronicle will take up that challenge on a Sangaku-inspired puzzle involving the number 2025.
The number 2025 has numerous properties as found in Numbers-a-Plenty, which also has the Sangaku problem we are going to explore. Here it is:
Consider the configuration below, featuring two pairs of equal tangent circles. These circles are also tangent to the external semicircle and an oblique chord. In this setup, 2025 is the smallest integer radius of a semicircle such that the inscribed circles also have integer radii (here, 400 and 648).
Some history first….
The Edo period was a time when Japan was significantly isolated from the rest of the world. While trade and travel in and out of Japan was essentially banned the European world was undergoing profound transformations laying the groundwork for modern mathematics: Galileo's method, Descartes' geometry, Fermat's number theory, Pascal's triangle, Newton's and Leibniz's calculus, Reimann’s topology. While there is little known of Japanese mathematics prior to the Edo period, there is evidence that during the Edo period there was extensive borrowing of Chinese texts, and eventually the tradition of the wasan, “Japanese Calculation” was popular: consistent with Euclidean principles but never referencing them.
At the end of the Edo period Japan opened up to the world entering the Meiji Restoration and the “new math” from Europe was blended into the wasan tradition, and eventually the wasan tradition was considered obsolete.
Methods and is this really a “Proof”:
The problem we look at here could be done using trigonometric methods, but since this article is all about Sangaku, we will not use those methods, since they did not exist for the Sangaku. I have no idea if this is how the Sangaku would approach it, I am not an expert on those methods (being able to read old Japanese would help!). Nevertheless this solution will only involve algebra and Pythagoras’ equation.
Regarding “proof”…. I’m not sure if there is an analytical way to prove the integers are minimal, so I wrote some symbolic computation in python and when the number crunching needed more speed some simple C++ to verify the integer values are indeed the minimal values. So is this a proof ? Of course it is, combined with algebra and python/C++ to speed up calculations. I can’t imagine how a wasan method would solve it.
Let’s start with a solution:
Let’s get started by clarifying the geometry… first give the circles names and label the radii.
Clearly the chord height, which for this problem we define as the perpendicular distance from the center at O, is crucial to solving this: and only integer values of the height of the chord can be used as we will see later. This solution is long, but will be split into two parts: 1) deal with the radius of the orange circles and then 2) do the same with the blue circles.
The first step is to look at the circles above the chord, and express the value of their radius in terms of the radius of the big circle and the chord height.
Circles \(O_1\):
Here is the diagram isolating the upper circles with some important labeling:
We have a diameter line \(AF\) for big circle \(O\) with radius \(R\)
Oblique chord \(AC\), midpoint \(B\), perpendicular height \(h\) from \(O_{center}\).
Small circles \(O_{1a}\), \(O_{1b}\) tangent on \(AC\) with radius \(r_1\).
\(O_{1a}\) and \(O_{1b}\) tangent to each other and \(O\).
Derive a formula for \(r_1\) in terms of \(R\) and \(h\)
Define Right Triangle
Let center of \(O_{1a} = D\) [ed. not shown] and center of \(O_{1b}=E\). Let \(M\) be midpoint of \(DE\). We now have a right triangle \(OME\) where:
$$OE^2 = OM^2 + ME^2$$
Define Triangle in terms of \(R,\; r_1,\; h \) :
$$\text{We have: }OE=R-r_1,\:OM=h+r_1,\:ME = r_1$$
$$\Rightarrow (R - r_1)^2 = (h + r_1)^2 + r_1^2$$
Now solve for \(r_1\):
$$\text{Expand and gather terms: } R^2 - 2Rr_1 + r_1^2 = (h^2 + 2hr_1 + r_1^2) + r_1^2$$
$$R^2 - 2Rr_1 = h^2 + 2hr_1 + r_1^2$$
$$h^2 + 2hr_1 + r_1^2 - (R^2 - 2Rr_1) = 0$$
$$\text{Which gives the quadratic: }ax^2 + bx + c \Rightarrow r_1^2 + (2h + 2R)r_1 + (h^2 - R^2) = 0$$
$$\text{Where: } a = 1;\; b = (2h+2R);\; c=(h^2-R^2)$$
$$r_1 = \frac{-b\pm\sqrt{b^2-4ac}}{2a}$$
$$r_1 = \frac{-(2h+2R)\pm\sqrt{(2h+2R)^2-4(1)(h^2-R^2)}}{2(1)}$$
$$r_1 = \frac{-2(h+R)\pm\sqrt{4(h+R)^2-4(h^2-R^2)}}{2}$$
$$r_1 = \frac{-2(h+R)\pm2\sqrt{(h+R)^2-(h^2-R^2)}}{2}$$
$$r_1 = -(h+R)\pm\sqrt{(h+R)^2-(h^2-R^2)}$$
$$\text{Just consider positive values } \Rightarrow r_1 = -(h+R)+\sqrt{(h^2+2hR+R^2)-h^2+R^2}$$
$$r_1 = -(h+R)+\sqrt{2hR+2R^2}$$
$$r_1 = (\sqrt{2}\sqrt{R}\sqrt{h+R})-h-R$$
So we now can determine \(r_1\)for values of \(h\) and \(R\).
Using Symbolic Computation:
That big long algebraic process can be derived with symbolic computation methods. Here is the output from Python Sympy:
The code is quite compact and makes it all look easy. There are some non-intuitive calculations that must be done with symbolic computations. Note that we assign OE_equation to display it but then when the real OE1 for the solution is defined then we must re-assign OE_equation. The code follows the same construction and solution for \(r_1\)above:
import sympy as sp
from IPython.display import display, Math
R, r1, h = sp.symbols('R r1 h', positive=True, integer=True)
EM, OE, OM, AC = sp.symbols('EM OE OM AC', positive=True)
display(Math(r"\text{Triangle } OME:"))
display(Math(sp.latex(sp.Eq(OE**2, OM**2+EM**2 ))))
OE1 = sp.sqrt(EM**2 + OM**2)
OE2 = R - r1
OE_equation = sp.Eq(OE1, OE2)
display(Math(r"OE = " + sp.latex(OE_equation)))
display(Math(sp.latex(sp.Eq(EM, r1)) + r"\;;\;" +
sp.latex(sp.Eq(OM, r1+h))))
EM = r1
OM = h + r1
OE1 = sp.sqrt(EM**2 + OM**2)
OE_equation = sp.Eq(OE1, OE2)
display(Math(r" \Rightarrow " + sp.latex(OE_equation)))
r1_solution = sp.solve(OE_equation, r1)
display(Math(r"r_1 = " + sp.latex(r1_solution[0])))
Circles \(O_2\):
Now we consider the second pair of circles. For the first pair of circles we used a right triangle and Pythagorean theorem, for these we setup some coordinates and use tangency of the circles and the distance from their centers to the chord. Here is a diagram isolating the lower circles with some relevant labeling:
Diameter line \(AF\) for big circle \(O\) with radius \(R\).
Oblique chord \(AC\), midpoint \(B\), perpendicular height \(h\) from \(O_{center}\).
Small circles \(O_{2a}\) and \(O_{2b}\) tangent on \(AF\)with radius \(r_2\).
\(O_{2b}\) tangent on left to \(O\).
\(O_{2a}\) tangent on left to \(O_{2b}\) and above to \(AC\).
Derive a formula for \(r_2\)in terms of \(R\)and \(h\).
If we put \(AF\) on the x-axis then the two circles tangent to x-axis with centers of\(x_a\) and \(x_b\) have coordinates of their centers as follows: \(O_{2a}=(x_a, r_2); \: O_{2b}=(x_b, r_2)\)
Center of Circle \(O_{2a}\)and \(x_a\):
It is tangent to the big circle of radius \(R\) so the distance from \((0,0)\) to \((x_a, r_2)\)is \(R-r_2\). And we have:
$$x_a^{2}\;+\;r_2^{2}\;=\;(R - r_2)^{2}\;=\;R^{2}\;-\;2\,R\,r_2\;+\;r_2^{2},$$
Which simplfies to:
$$x_a^2 \;=\; R^2 \;-\;2\,R\,r_2.$$
Since \(O_{2a}\)is to the left of zero, we must take the negative square root: \(x_a=-\sqrt{R^2-2Rr^2}\)
Center of Circle \(O_{2b}\) and \(x_b\):
It is tangent to \(O_{2a}\), so the distance between their centers is \(2\, r_2\). Because both have y‐coordinate\(=r_2\), their x‐coordinates differ by \(2\,r_2\). Thus using \(x_a\)from above we have
\(E_1: \quad x_b=x_a+2r_2\;=\; -\sqrt{(\,R^2 - 2\,R\,r_2)}\;+\;2\,r_2.\)
Tangency of \(O_{2b}\) to the chord\(AC\):
Circle \(O_{2b}\)must also be tangent to the chord \(AC\). Let’s use an equation for a chord of height \(h\) (from center) thru a circle with radius \(R\): (the proof of this, as my professor Ralph Stanton often said “will be left to the student”):
(update: Look for a proof for this in another CCC on Ralph Stanton”)
\(h\,x + (\sqrt{R^2-h^2})\,y = hR\)
Using that equation of a line for the chord, we can now find the distance \(d \) from a point to that line by using it in the standard equation of distance from a point to a line:
$$d = \frac{\bigl|hX + \sqrt{R^2-h^2}Y-hR\bigr|}{\sqrt{h^2 + (R^2-h^2)}} \;=\; \frac{\bigl|\, h\,X \;+\;\sqrt{R^{2}-h^{2}}\,Y \;-\;h\,R \bigr|}{R}.$$
The circle is tangent to the chord so \(d = r_2\) and the point \((X,Y)=(x_b, r_2)\) so we have:
$$\bigl|\, h\,x_b \;+\;\sqrt{R^{2}-h^{2}}\;r_2 \;-\;h\,R \bigr| \;=\; R\,r_2.$$
We can remove the absolute value on the LHS, and since we know the circle is below the chord add a minus sign on the RHS, and then use \(x_b\) from \(E_1\)from above to solve for \(r2\):
$$h\,x_b \,+\,\sqrt{R^{2}-h^{2}}\;r_2 \,-\,h\,R \,=\, -\,R\,r_2.$$
$$h\Bigl[(-\sqrt{(\,R^2 - 2\,R\,r_2)}\;+\;2\,r_2\Bigr] + \sqrt{R^2-h^2}\,r_2 -hR = -Rr_2$$
$$\text{... 🧮 ✍️ ..}$$
$$r_2 = \frac{2Rh(R+h+\sqrt{R^2-h^2})}{\Bigl(R + 2h + \sqrt{R^2-h^2}\Bigr)^2}$$
So now we have \(r_2 \) and \(\\r_1\)defined for \(R\) and \(h\).
Using Symbolic Computation:
Again, that big long algebraic process can be derived with symbolic computation methods. Here is the output from Python Sympy:
Here’s the code:
import sympy as sp
from IPython.display import display, Math
R, h = sp.symbols('R h', positive=True)
r2 = sp.Symbol('r2', real=True)
x_a = sp.Symbol('x_a', real=True)
x_b = sp.Symbol('x_b', real=True)
# Tangency to big circle: O2a at (x_a, r2)
rhs = (R - r2)**2
lhs = x_a**2 + r2**2
eq1 = sp.Eq(lhs, rhs)
display(Math(sp.latex(eq1) + " = " + sp.latex(sp.expand(rhs))))
xa_equation = sp.solve(eq1, x_a**2)[0]
display(Math(r"x_a^2 = " + sp.latex(sp.expand(xa_equation))))
# Tangency O2^a <-> O2^b: same y=r2 => x_b - x_a = 2*r2
eq2 = sp.Eq(x_b - x_a, 2*r2)
display(Math(r"x_b = " + sp.latex(sp.solve(eq2, x_b)[0])))
# Tangency O2^b <-> chord:
eq3 = sp.Eq(
h*x_b + sp.sqrt(R**2 - h**2)*r2 - h*R,
-R*r2
)
display(Math(sp.latex(eq3)))
solutions = sp.solve([eq1, eq2, eq3], [x_a, x_b, r2], dict=True)
display(Math(r"\text{Solve for }r_2:"))
for sol in solutions:
display(Math(r"r_2=\quad" + sp.latex(sol[r2])))
Determine \(r_1, r_2\) values for \(R=2025\):
So now we can see what integer values of \(r_1, r_2, h\) satisfy the equations for \(R=2025\). We can just use those equations with \(h\)values from \(1 : 2025\):
\(\\r_1:\)
display(Math(r"\text{Integer solutions for }h=1:2025: R=2025"))
for h_i in range(1, 2025):
r1 = r1_solution[0].subs({h:h_i, R:2025}).evalf()
if int(r1) == r1 and r1 > 0:
print(f"h={h_i}, r={int(r1)}")
Output:
\(r_2:\)
display(Math(r"\text{Integer solutions for }h=1:2025: R=2025"))
for h_i in range(1, 2025):
r2_val = solution[r2].subs({h:h_i, R:2025}).evalf()
if int(r2_val) == r2_val and r2_val > 0:
display(Math(r"r_2 = " + f"{int(r2_val)}" + " \quad " + f"h={h_i}"))
Output:
Smallest Integer Solutions for \(R=2025\)?
So we see that for \(R=2025\) there are numerous integer values for \(r1, r2\).
How can we determine that 2025 is the smallest ? We would have to check all values of \(R\) from 1 through 2025 with all \(h\)values from 1 through 2025. I tried that with python sympy but that \(O(n^2) \) complexity never finished.
Imagine the wasan sangaku creators doing 2025×2025 computations on a soroban finally finishing their calculations and then proudly posting the wooden tablet in a shrine. Since I don’t have a soroban I’ll try out C++. In this we determine which values for \(h\) satisfy integer values for \(r_1\)and \(r_2 \) for \(R=1:2025\) — It finished in the blink of an eye:
#include <iostream>
#include <cmath>
using namespace std;
// Function to calculate r2
long double calculate_r2(int R, int h) {
long double numerator = 2.0 * R * h * (R + h + sqrt(R * R - h * h));
long double denominator = 2.0 * R * R + 4.0 * R * h + 2.0 * R * sqrt(R * R - h * h) + 3.0 * h * h + 4.0 * h * sqrt(R * R - h * h);
return numerator / denominator;
}
// Function to calculate r1
long double calculate_r1(int R, int h) {
return sqrt(2) * sqrt(R) * sqrt(R + h) - R - h;
}
int main() {
for (int R = 1; R <= 2025; ++R) {
for (int h = 1; h <= 2025; ++h) {
long double r2 = calculate_r2(R, h);
if (r2 != 0 & floor(r2) == r2) { // Check if r2 is an integer
long double r1 = calculate_r1(R, h);
if (r1 !=0 & floor(r1) == r1) { // Check if r1 is an integer
cout << "R: " << R << ", h: " << h << ", r1: " << (int)r1 << ", r2: " << (int)r2 << endl;
}
}
}
}
return 0;
}
Output:
we have confirmed the minimal integer value radii !!
\(R=2025, \quad r_1=648,\quad r_2=400\)
Conclusion:
So we have proven that \(2025\) is the smallest radius of the larger circle such that the smaller circles have integral values.
There are solutions using trigonometry for this, but wasan methods did not have them. The skill of those amateur mathematicians must have been quite exceptional. It is worth noting that when they abandoned those methods after adopting European mathematics, it wasn't long before the Japanese became world-class mathematicians.
Thanks for reading this (not-so) Casual Chronicle! All the code is on my github and I welcome your comments on anything regarding this post, and I apologize for any clumsy, or pedantic algebra :)
Subscribe to my newsletter
Read articles from carl ek directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by

carl ek
carl ek
Software developer. Sports Fan. Motorcyclist. Pianist and French Hornist. Cat Dad. Let's try out hashnode free version, and see where it goes....