Introduction

In 1975 the Queen of England visited the Ryōan-ji Zen temple (which means The Temple of the Dragon at Peace) in Kyoto (Japan). Like all tourists, she experienced that, standing in any point of the Master’s porch, it is not possible to see all the 15 stones placed in the front garden, see Fig. 1. We wonder if the Queen of Sciences may reveal us something more about this singular arrangement.

Fig. 1
figure 1

The Ryōan-ji garden [Source: Wikipedia (https://commons.wikimedia.org/wiki/File:Kyoto-Ryoan-Ji_MG_4512.jpg)]

The kare-sansui garden in the Zen Buddhist temples is a dry garden made of stones, smooth pebbles and moss. Someone says that the Ryōan-ji garden is a kōan, a riddle that helps in meditation. Deeper meditation is necessary to construct this special arrangement of stones so that not all of them can be seen at once. While listening to this story, we imagine the dialogue between a Master and a Monk for realizing this garden. With a mathematical eye, we simplify the setting and present several problems about points arrangements in a rectangle. The points will correspond to the rocks in a kare-sansui garden.

Japanese gardens and temples have already inspired mathematical problems, originally written on wooden blocks. A good reference for this subject is Fukagawa and Rothman (2008); unfortunately, the Ryōan-ji is not present in this book. On the other hand, the presence and breaking of symmetry of the Ryōan-ji garden has been analyzed in Van Tonder et al. (2002) and Van Tonder and Lyons (2005). In particular, the authors show local axes of symmetry among the rocks by using medial axis transformations. This is an a-posteriori approach focused on the visual perception, whereas we imagine the garden in the moment of its construction.

In this paper, taking inspiration from the Kyoto garden, we suggest didactics kōan that may help to appreciate the importance of the symmetry in these constructions. We do not know whether such formulation already exists in literature.

We prefer to formulate and solve problems with elementary tools, even though some of them can also be read with the language of Euclidean Geometry, Combinatorics and Graph Theory. In order to show the difference between the didactic and the formal exposition, we present the solution to some problems with both languages.

We warn the reader that, according to the travel guides, spending enough time in Kyoto, one could eventually reach the illumination and see all the 15 stones in a glance. We did not succeed in that, however the word illumination suggested us to compare this problem with the illumination problem in an art gallery. In Urrutia (2000), the author analyzes many problems about placing lights (or guards) in a museum in order to illuminate its walls. These belong to the class of Visibility Problems in Computational Geometry, the most famous of which is the so-called Art Gallery Problem (Chvátal 1975; Fisk 1978): one wants to find the minimum number of guards to control the whole gallery. In our setting the stones play the role of the guards or of the lights.

The similarity between the Art Gallery Problem and our garden is clear if we look at Van Tonder et al. (2002, Figure 2), consider the bifurcation points of the branched tree as guards in the museum and identify the center of each room with a rock in the garden, see also Fig. 13b in this paper.

One of the main differences between our setting and the visibility problems is that we often require convexity.

Plan of the Work

Arranging Stones and Masters” is the main part of the paper, the problems are presented with an increasing level of difficulty up to the more general Problem 6, which is a 2-dimensional version of the Ryōan-ji garden with a finite number of visitors. “Polygonal Arrangements” is devoted to investigate possible symmetric gardens and polygonal arrangements. In “Generalizations”, we sketch further mathematical ideas inspired by the Ryōan-ji garden. In the “Appendix” we recall Incidence and Betweenness Axioms, according to Hilbert’s formulation, and rewrite some of the problems of “Arranging Stones and Masters” with this formalism.

Notation

Throughout the paper, we assume \(N \ge 2\) to be an integer, which denotes the number of stones \(S_1,\dots ,S_N\). Moreover, we shall use \(K \ge 1\) to denote the number of Zen Masters, \(M_1,\dots ,M_K\).

Now we have two sets of points, the stones and the Masters. We formulate our problems by using the expression “the Master can see the stone”. From a mathematical point of view, this means that on the line segment between the Master and the stone there is no other point, representing a Master or a stone. In general, given three distinct points ABC, we write \(A*B*C\) if B belongs to the segment AC. In particular, A cannot see C.

For simplicity, we further assume that the garden is rectangular, even though we can weaken this assumption as convex polygon.

When we refer to inside (or interior) and outside (or exterior) of a convex polygon we do not include the points of the boundary.

The boundedness of the garden is a restriction, not an assumption, see for example Solution 6. If necessary, all problems can be written in an unbounded convex garden with the Masters inside.

Arranging Stones and Masters

Problem 1

On the first day the Master asks the Monk: can you place N stones in the garden in such a way that if I sit in a precise spot along the garden’s edge I can see exactly \(N-1\) of them?

Solution 1

The Monk draws an M where the Master will sit. Then he draws \(N-1\) pairwise distinct lines passing through M and places one stone on \(N-2\) of these lines and 2 stones on the remaining line, see Fig. 2a. For example, this means that \(M*S_i*S_N\) for some \(1 \le i \le N-1\).

Fig. 2
figure 2

The Masters cannot see a specific stone

Problem 2

On the second day the Master asks the Monk: can you place N stones in the garden in such a way that if the K Masters of the temple sit in precise spots along one side of the garden, no one can see a particular stone? What is the maximum number of Masters that I can invite so that you can solve this kōan?

Solution 2

The Monk imagines K points \(M_1,\dots ,M_K\) on one side of the garden where the Masters will sit. Then he places the stone \(S_N\) in the garden and draws the line through \(S_N\) and \(M_i\) for \(i=1,\dots ,K\). In order to cover \(S_N\), he will place the stone \(S_i\) on the line segment \(M_i S_N\). The Monk realizes that it has to be \(K \le N-1\) and the maximum number of Masters is \(K=N-1\).

He concludes that \(M_i*S_i*S_N\) for every \(i=1,\dots ,K\) and the stone \(S_j\), for \(j=K+1,\dots ,N-1\) can be placed in any point of the garden, see Fig. 2b.

From now on, unless otherwise stated, we consider N stones and \(N-1\) Masters. If in Problem 2 we have \(N=3\) and the two Masters sit on different sides of the garden, the construction suggested by the Monk in Solution 2 is still admissible, but for some configurations each Master could see less than \(N-1\) stones. For example, in Fig. 3a each Master can only see 1 stone instead of 2.

Fig. 3
figure 3

N stones, \(N-1\) Masters

Problem 3

On the third day the Master asks the Monk: there are 2 Masters and 3 stones, can you place them so that each Master can see exactly 2 stones and the hidden stone is the same for both Masters?

Solution 3

The Monk notices that if the Masters sit on the same side of the garden, then Solution 2 is still valid. On the other hand, if the Masters sit on different sides of the garden, the Monk draws the line through \(M_1\) and \(M_2\) and places the stone \(S_3\) outside the line. Then he places \(M_i*S_i*S_3\) for \(i=1,2\), see Fig. 3b. The same construction works for any position of the Masters along the boundary of the garden.

Conversely, if \(M_1*S_3*M_2\), then every choice of \(S_1\) and \(S_2\) does not fulfil the request of the Master in Problem 3. In mathematical language, this corresponds to the fact that the locus of the points \(S_3\) that solve Problem 3 is the interior of the rectangle minus the line segment \(M_1 M_2\).

This problem can be generalized for \(N \ge 3\).

Problem 4

On the fourth day the Master asks the Monk: there are 3 Masters sitting on the garden’s edge. At least one Master does not sit on the same side as the other two. Can you place 4 stones in the garden so that each Master can see exactly 3 stones and the hidden stone is the same for all Masters?

Solution 4

The Monk draws the triangle \(M_1 M_2 M_3\) and places the stone \(S_4\) inside the triangle. Then he places the stone \(S_i\) on the line segment \(M_i S_4\) for \(i=1,2,3\), see Fig. 3c. Let us prove that this gives the solution. First of all notice that, since the triangle is convex, each Master \(M_i\) can see the stone \(S_i\) but not \(S_4\). Let us fix \(M_1\). We need to show that \(M_1\) can also see \(S_2\) and \(S_3\). Assume by contradiction that \(M_1\) cannot see \(S_2\). Then either \(M_1*S_1*S_2\) or \(M_1*S_3*S_2\).

In the first case, \(M_1,S_1,S_2\) lie on the same line, which contains also \(S_4\). Since \(M_2\) belongs to the line through \(S_2\) and \(S_4\), it follows that \(S_1,S_2,S_4\) lie on the line segment \(M_1 M_2\), against the fact that \(S_4\) is inside the triangle \(M_1 M_2 M_3\).

In the second case, \(M_1*S_3*S_2\) and, moreover, \(M_2*S_2*S_4\). Let us consider the triangle \(M_1 M_2 S_2\) and the point \(S_4\). The line \(\ell\) through \(S_4\) and \(S_3\) enters this triangle and it intersects the side \(M_1 M_2\) in a point P such that \(S_4*S_3*P\) (the line cannot intersect the segment \(M_2S_2\) since \(S_3 \ne S_2\)).

The line \(\ell\) enters also the triangle \(M_1 M_2 M_3\) in the point P. Thus \(S_4\) and \(S_3\) are outside the triangle \(M_1 M_2 M_3\), against the construction. Figure 4a shows a possible configuration.

Fig. 4
figure 4

4 stones, 3 Masters

Hence \(M_1\) can see also \(S_2\) and, for the same reason, \(S_3\). Up to permuting the indices, we conclude that \(M_i\) can see \(S_1,S_2,S_3\) for \(i=1,2,3\).

From a mathematical point of view, we can say something more: according to Solution 4, the interior of the rectangle is contained in the locus of the points \(S_4\) that solve Problem 4. Having in mind Fig. 6a, clearly the sides of \(M_1 M_2 M_3\) are excluded by such locus.

We now consider the exterior of the triangle. Notice that, if \(S_4\) lies outside the triangle, some configurations do not satisfy the condition that each Master has to see exactly 3 stones, see Fig. 4a.

If \(S_4\) is placed outside the triangle \(M_1 M_2 M_3\), then we consider the triangle \(\Delta\) with vertices \(S_4\) and two of the masters such that \(\Delta\) lies all outside the triangle \(M_1 M_2 M_3\) (they only have one side in common). Without loss of generality, let \(\Delta = M_1 M_2 S_4\) as in Fig. 4a. We consider \(S_i\) on the line segment \(M_i S_4\) for \(i=1,2\). If the stone \(S_3\) is placed on the part of the line segment \(M_3 S_4\) that lies inside the triangle \(M_1 M_2 M_3\), each Master can see the stones \(S_1, S_2, S_3\) for the same argument used in Solution 4, see Fig. 4b.

In any case, for points outside the triangle, there are admissible configurations which solve Problem 4. We conclude that the locus of the points \(S_4\) that solve Problem 4 is the interior of the garden minus the sides of the triangle \(M_1 M_2 M_3\).

Problem 5

On the fifth day the Master gives \(N-1\) blue stones and 1 red stone (denoted by an empty rectangle in the pictures) to the Monk and asks: tomorrow there will be \(N-1\) Masters sitting inside the garden and each of them would like to see all the \(N-1\) blue stones and not see the red one.

Solution 5

The Monk draws \(N-1\) points, representing the Masters, in the garden and draws the lines through \(M_i\) and \(M_j\) for every \(i,j=1,\dots ,N-1\), with \(i \ne j\). He takes care that the lines are pairwise distinct. Hence he considers the figure defined by \(M_1,\dots ,M_{N-1}\) and containing all the segments \(M_i M_j\).

He places the red stone \(S_N\) in the interior of this figure, so that it does not lie on any line through \(M_i\) and \(M_j\). Moreover, he places the stone \(S_i\) on the segment \(M_i S_N\) for \(i=1,\dots ,N-1\) in such a way that any pair of stones \(S_1,\dots ,S_{N-1}\) are not collinear with any \(M_j\), see Fig. 5. Thus the stone \(S_n\) is hidden to all masters.

Fig. 5
figure 5

N stones, \(N-1\) Masters

To show that each \(M_i\) can see \(S_1,\dots ,S_{N-1}\), we apply the argument of Solution 4: if \(M_j\) cannot see \(S_i\) (\(i \ne j\)), then \(S_N\) belongs to the line segment \(M_i, M_j\), against the construction.

When the Monk says in the interior of the figure defined by \(M_1,\dots ,M_{N-1}\), it is not clear what is the figure and what interior means. In mathematical terms, this concept corresponds to the so-called convex hull. The convex hull of a finite set of points X in \(\mathbb R^n\) is the smallest convex set C that contains X. Hence, the line segment joining any two points of C lies entirely in C. It is well-known that the convex hull forms a convex polygon when \(n=2\), or more generally a convex polytope in \(\mathbb R^n\).

By induction on \(N \ge 2\), one can prove that the locus of the points \(S_N\) that solve Problem 5 is the plane minus all the line segments \(M_i M_j\).

If we do not require that the hidden stone is the same for all Masters, then the solution is different and allows to increase the number of Masters, as shown in the following Problem.

Problem 6

On the sixth day the Master gives \(N \ge 2\) blue stones to the Monk and asks: can you place these N stones in such a way that if N Masters sit on the boundary of the garden, each of them can see exactly \(N-1\) stones? You can decide the position of the Masters.

Solution 6

The Monk realizes that not having a red stone could suggest that the hidden stone is not the same for all Masters. This allows to consider more Masters with respect to the previous problems.

As in Problem 3, he first considers the case \(N=2\). The Monk places the stones inside the garden and invites the two Masters to sit on the intersections of the line through \(S_1, S_2\) with the boundary of the garden, see Fig. 6a. In this way each Master can see exactly one stone. In this construction, the Monk realizes the importance of deciding the position of the Masters.

Fig. 6
figure 6

N stones, N Masters

In general, for every \(N \ge 2\), the Monk places the N stones in the garden, so that any three of them are not collinear, and then he draws \(\left( {\begin{array}{c}N\\ 2\end{array}}\right) =\frac{N(N-1)}{2}\) lines through any two stones. If needed, he moves the stones closer to each other, keeping them 3 by 3 noncollinear, so that all intersection points \(P_1,\dots ,P_k\) between the lines are inside the garden. Now the convex hull of the points \(S_1,\dots ,S_N,P_1,\dots ,P_k\), in gray in Fig. 6b, lies inside the garden. It is enough to ask each Master \(M_i\) to sit on the intersection of the line \(S_i S_{i+1}\) with the boundary of the garden (here we use the convention for which \(M_N\) sits on the line \(S_N S_1\)).

Problem 7

On the seventh day the Master gives \(N \ge 2\) blue stones to the Monk and asks: what is the maximum number of Masters that I can invite so that sitting on the boundary of the garden each of them can see exactly \(N-1\) stones?

Solution 7

The Monk sets the stones as in Solution 6 and invites two Masters to seat on the intersections of each of these lines with the boundary. Thus the maximum number of Masters that can be invited is \(2\left( {\begin{array}{c}N\\ 2\end{array}}\right) = N(N-1)\). A simple case is shown in Fig. 7.

Fig. 7
figure 7

Maximum number of Masters that can see \(N-1\) out of N stones

This is indeed the maximum number of Masters. In fact, if there is one more Master, he should sit either outside every line or on some line segment between two stones, not blocking the view of any other Master. In both cases he can see all the N stones, against the request.

Polygonal Arrangements

On the second week, the Master was feeling the need to have a beautiful arrangement of the stones in the garden and proposed the following problems.

Problem 8

The Master says to the Monk: I would like \(N \ge 3\) stones to form a regular polygon and if I sit in a precise spot along the boundary of the rectangle, I can see exactly \(N-1\) stones.

Solution 8

At the beginning the Monk thought he had an easy solution: for \(N=3,4\), it was enough to place an equilateral triangle and a square such that two consecutive vertices are collinear with the Master (see Fig. 8a). For the triangle, this is the “only” possible solution.

Fig. 8
figure 8

Polygonal arrangements of stones

For \(N=4\) a different solution is possible, taking M collinear with two opposite vertices of the square (see Fig. 8b).

With this idea of symmetry in mind, the Monk placed the stones in the shape of a regular pentagon, with one of the symmetry axis of the pentagon passing through the Master. He struggled to find the only position of the stones for which the Master could see less than 5 stones. More precisely, when the distance between the side of the pentagon and the Master is \(\ell /2 \tan (2\pi /5)\) (\(\ell\) being the length of the side), the Master will see 3 stones, not 4 as requested (see Fig. 8c).

For a regular pentagon, also the simple solution of sitting on the line containing one side may fail.

The Monk tried to rotate the stones fixing one of the two vertices closest to the Master and realized that the problem was solved, but the solution was not so “beautiful”. He wanted to show to the Master the symmetries of the pentagon, but this was not possible. The simplest configuration he could imagine consisted in placing two non-adjacent stones of the pentagon aligned with the Master, using the diagonal of the pentagon, see Fig. 9a.

Fig. 9
figure 9

Symmetric arrangements

For the hexagon, the Monk was able to place the stones with a symmetry axis aligned with the Master. In this way the Master could see 5 out of 6 stones and could imagine two isosceles trapezoids, see Fig. 9b.

Thus the Monk realized that, except for the triangle, the construction was the same for all polygons: the Master sits on a diagonal of the polygon. Nevertheless, this solution includes a symmetry axis of the polygon for even-sided polygons. On the contrary, the symmetry axes of the polygon have to be avoided when they are not diagonals of the polygon, otherwise the Master will see N or \(N-2\) stones. The latter is also the minimum number of stones that the Master can see.

The Monk told the Master about the unfortunate case of the pentagon that, at a certain distance, hid 2 stones (see the vertices \(S_i'\) in Fig. 8c). The Master thanked the Monk for inspiring the next problem.

Problem 9

The Master says to the Monk: if \(N \ge 3\) Masters sit in the vertices of a convex N-gon, can you place N stones inside or on the boundary of the N-gon, in such a way that each Master can see exactly \(N-2\) stones?

Solution 9

The Monk easily realizes that the problem does not have solution for \(N = 3\). In fact, if \(N = 3\), since \(M_1\) and \(M_2\) need to see only 1 out of 3 stones, all stones have to belong to the line segment \(M_1 M_2\). Hence the Master \(M_3\) sits outside this line and will see 3 stones (see Fig. 10a).

Fig. 10
figure 10

The Masters sit on the vertices of a convex N-gon

For \(N = 4\), the situation is more complicated. After some attempts, the Monk realizes that there is no solution, since the stones have to be placed inside or on the boundary of the quadrilateral. Otherwise, allowing the stones outside the quadrilateral, a solution is sometimes possible (see Fig. 10b, in which the Masters hinder the view of some stones). To convince ourselves that the Monk is right when the stones are inside the quadrilateral, we argue by contradiction. Since \(M_1\) can see exactly 2 out of 4 stones, \(M_1\) is the vertex of a cone and the stones are placed on the sides of the cone. The same holds for \(M_2\). We conclude that the 4 stones are arranged as in Fig. 11a. A third Master cannot sit inside either of the cones, since he could see all 4 stones, neither on the boundary or outside both cones, since he could see at least 3 stones.

Fig. 11
figure 11

No solution for \(N=4\) and recursive polygons

For \(N \ge 5\), the Monk considers the Master \(M_i\) and draws the diagonal connecting the two Masters adjacent to \(M_i\), for every \(i=1,\dots ,N\). In this way, a smaller N-gon is drawn inside the N-gon whose vertices are the Masters. Then the Monk places the N stones at the vertices of the small N-gon and notices that each Master can see exactly \(N-2\) stones, see Fig. 11b. Indeed, from each \(M_i\) the Monk drew exactly two diagonals. Each diagonal contains 2 stones, one of which is hidden to \(M_i\). On the other hand, \(M_i\) can see the remaining \(N-4\) stones. Indeed, if one of these is hidden to \(M_i\), then it would lie on a third diagonal starting from \(M_i\), which is not drawn.

Combining the discussion in the Solutions of Problem 6 and 9, we conclude that, for \(N=3,4\), the minimum number of stones, placed inside the garden, that can be seen by N Masters is \(N-1\).

The Master admires the beauty and the symmetry of the construction and thinks that from the stones one can draw diagonals with the same rule and obtain new vertices for new Masters. The Monk also realizes that in a big enough garden, extending the sides of the polygon and taking the intersection points as stones, one obtains a new admissible configuration. Both the Master and the Monk are thinking about a recursive graph, in other words to draw infinitely many nested polygons.

Generalizations

Looking at this recursive graph, the Masters left without new questions. When the Monk woke up, he found N stones placed in the garden. Right away he understood in how many and which positions he could sit in order to see exactly \(N-1\) stones. While he was sitting to check the solution of this dual problem, he realized he had become a Master himself and created many more problems for his students.

Garden with a Different Shape

In Problems 3, 4, 5, 6, 7, 9 the main idea is to construct figures containing the line segments through the stones and the Masters, hence convex. Thus the same constructions solve the problems for any convex garden, when the Masters sit on the boundary. On the other hand, in a non-convex garden, some of the problems may not admit any solution. For example Problem 3 does not have solution in the garden in Fig. 12. In fact, since the visual field of \(M_1\) and \(M_2\) (in gray in the figure) are disjoint, if \(M_1\) can see \(S_1\) and \(S_2\), then \(M_2\) can see at most one stone, against the request of Problem 3. This setting reminds the Art Gallery Problem.

Fig. 12
figure 12

Non-convex garden

The Walking Master

Even the simple Problem 1 does not admit any solution if the Master is allowed to walk along the edge of the garden. The solution we suggest is, in fact, not stable: as soon as the Master moves along the edge, he can see all N stones. A mathematician Monk understands that the problem of the walking Master is equivalent to having infinitely many Masters.

In the Ryōan-ji garden, the tourist cannot see all the stones at once, even moving along the edge of the garden. This does not contradict what we said in the previous problem, since in real life the stones are 3-dimensional, not reduced to points.

2D-stones

In this paper, stones and Masters are represented as points in the plane. A more realistic version of the construction of the Ryōan-ji garden requires at least that the stones are disks. This problem is more difficult since, for example, in Fig. 2a we need a condition on the ray of the hidden stone: the cone with apex the Master and tangent to \(S_3\) has to contain \(S_5\), see Fig. 13a.

Fig. 13
figure 13

2D-stones and bifurcations

Bifurcations

The idea contained in Van Tonder and Lyons (2005) is to describe the properties of the Ryōan-ji garden by means of a tree structure between the stones. In particular, we can imagine to construct a garden with stones and hedges. We can formulate the problem as follows: given N stones, one has to place hedges so that, if the Masters sit on the bifurcations points of the hedges, then from each side of the hedge each Master can see exactly 1 stone, see Fig. 13b. As explained in Van Tonder and Lyons (2005), the mathematical instruments for this problem are medial axis transformations.