--- jupyter: description: 'The lune of Hippocrates with planex2d: a region between two circular arcs whose area equals a triangle''s exactly, as one Boolean difference of two circles, and the lunes of Alhazen over the legs of any right triangle.' --- # The lune of Hippocrates Can a region bounded by circular arcs have exactly the area of a triangle? Hippocrates of Chios found one in the 5th century BC, the first curved figure whose area was found exactly. Over an isosceles right triangle, the semicircle on the hypotenuse reaches beyond the quarter circle about the right angle, and the crescent between them, the lune, has the triangle's area. Ibn al-Haytham, Alhazen, extended it to every right triangle: the two lunes over its legs, outside its circumcircle, together have the triangle's area. In planex2d, a lune is one Boolean difference of two exact circles, and its area is the area of a face. ![The lune of Hippocrates and the lunes of Alhazen over a 3-4-5 triangle](../_static/gallery/lune-of-hippocrates.png){.result} ```python import math import planex as px ``` ```python nbsphinx="hidden" from docs_figures import Row ``` ## Hippocrates' lune The triangle has legs of 1 along the axes. The quarter circle about the right angle has the radius 1, and the semicircle on the hypotenuse is centered at its middle with the radius $\sqrt{2}/2$. The circle of the semicircle runs through the right angle's corner too, so its half toward the corner lies inside the quarter circle, and the difference of the two discs is the lune (Figure 1): ```python quarter = px.Circle((0, 0), 1).Face() semicircle = px.Circle((0.5, 0.5), math.sqrt(2) / 2).Face() lune = semicircle - quarter triangle = px.QuickSketch().Line(1).Line((0, 1)).Close().Face() print("lune", lune.mass, "| triangle", triangle.mass) ``` ```python nbsphinx="hide-input" Row((px.Compound([lune, triangle]), "The lune and the triangle", {"dashed": [quarter.outer, semicircle.outer]}), caption="The lune of Hippocrates over an isosceles right triangle") ``` The proof needs no integral. The semicircle on the hypotenuse has the area $\tfrac{1}{2}\pi(\sqrt{2}/2)^2 = \pi/4$, the same as the quarter circle. Both contain the circular segment between the hypotenuse and the quarter circle's arc, so what is left of each has the same area: the lune of one, the triangle of the other. ## The lunes of Alhazen Over a right triangle with the legs $a$ and $b$, each leg carries a semicircle outward, and the circumcircle runs through all three corners with the hypotenuse as its diameter. The two lunes are the leg discs less the circumcircle's disc. The example is the triangle with the legs 4 and 3 (Figure 2): ```python def lunes(a, b): corner_a, corner_b = (a, 0), (0, b) legs = [px.Circle((a / 2, 0), a / 2).Face(), px.Circle((0, b / 2), b / 2).Face()] circumcircle = px.Circle((a / 2, b / 2), math.hypot(a, b) / 2).Face() return [leg - circumcircle for leg in legs], px.QuickSketch().Line(corner_a).Line(corner_b).Close().Face() (first, second), right_triangle = lunes(4, 3) print("lunes", first.mass, "+", second.mass, "=", first.mass + second.mass, "| triangle", right_triangle.mass) ``` ```python nbsphinx="hide-input" Row((px.Compound([first, second, right_triangle]), "Two lunes over the legs, the triangle between them"), caption="The lunes of Alhazen over the 3-4-5 triangle") ``` The sum does not depend on the shape of the triangle. For right triangles from nearly flat to isosceles, the two lunes together have the triangle's area $ab/2$: ```python for a, b in ((1, 7), (2, 5), (3, 4), (5, 5)): (first, second), right_triangle = lunes(a, b) print("legs", a, b, "| lunes", first.mass + second.mass, "| ab/2", a * b / 2) ``` ```python nbsphinx="hidden" import sys sys.path.insert(0, "..") import matplotlib.pyplot as plt from docs_figures import INK from gallery import save_figure fig, axes = plt.subplots(1, 2, figsize=(7, 3.4)) (first, second), right_triangle = lunes(4, 3) for ax, parts in zip(axes, ([lune, triangle], [first, second, right_triangle])): for part in parts: color = "#f6d9a9" if part is parts[-1] else "#9fd3e6" # the lunes blue, the triangle of the same area amber part.Plot(ax=ax, face_col=color, line_col=INK, arc_col=INK, spline_col=INK, legend=False) ax.set_aspect("equal") ax.axis("off") save_figure(fig, "lune-of-hippocrates", bare=True) ```