On the number of tiles visited by a line segment on a rectangular grid

Consider a line segment placed on a two-dimensional grid of rectangular tiles. This paper addresses the relationship between the length of the segment and the number of tiles it visits (i.e. has intersection with). The square grid is also considered explicitly, as some of the specific problems studied are more tractable in that particular case. The segment position and orientation can be modelled as either deterministic or random. In the deterministic setting, the maximum possible number of visited tiles is characterized for a given length, and conversely, the infimum segment length needed to visit a desired number of tiles is analyzed. In the random setting, the average number of visited tiles and the probability of visiting the maximum number of tiles on a square grid are studied as a function of segment length. These questions are related to Buffon's needle problem and its extension by Laplace.


Introduction
Given a, b ∈ R + , consider a grid on R 2 formed by rectangular tiles of width a and height b.A line segment of length ℓ ∈ R + is located on the plane with arbitrary position and orientation.The segment is said to visit a tile if it intersects its interior. 1his paper studies the relationship between the length of the segment and the number of visited tiles.The motivation comes from the classical Buffon-Laplace needle problem (i.e. a segment with random position and orientation on a rectangular grid), of which a modified version is considered, wherein the segment position and orientation are parameters that can be chosen to maximize the number of visited tiles.In addition, the probability of visiting that maximum number of tiles in the classical (random) setting is studied.
Specifically, two different settings are considered, which correspond to the segment position and orientation being deterministic or random, respectively.In the deterministic case, the relevant questions are: (1a) What is the maximum number of tiles that the segment can visit given its length?
(1b) Conversely, what length should a segment have to visit a given number of tiles?
In the random setting, if the segment position and orientation are uniformly distributed (this will be precisely defined later), (2a) What is the average number of tiles visited by a segment of a given length?(2b) How often does the random segment visit the maximum number of tiles?
As an example of question (1a), consider a = 1.35, b = 1.A segment of unit length can be placed as shown in Figure 1 (left) to make it visit 3 tiles.In fact, this is the maximum number for ℓ = 1.The figure also illustrates that the solution for length 2.4 is 5 (center), and for 4.7 it is 8 (right).
An equivalent formulation of the problem is obtained by allowing segments of length ℓ or smaller.The equivalence is clear from the fact that reducing the length cannot increase the number of visited tiles.Either of these formulations will be referred to as the direct problem.
The inverse problem (1b) is, given t ∈ N, to determine the infimum length of all segments that visit at least t tiles.If the length can take any real value the infimum is not a minimum, because given any segment it can be shortened by some small amount without changing the number of visited tiles.This is a consequence of the interior of each tile being an open set.
The direct and inverse problems are closely related.Namely, if ℓ is the infimum of all lengths that allow visiting at least t tiles (inverse problem), t is the maximum number of tiles that can be visited with lengths slightly greater than ℓ (direct problem).
To address the remaining two questions, the notion of a random segment of a given length needs to be precisely defined.This is done as follows.By symmetry, one endpoint of the segment can be assumed to lie in a fixed, reference tile.The position of this endpoint is uniformly distributed on the tile.The segment orientation has a uniform distribution on [0, 2π), and is independent of the endpoint position.Solving the problem (2a) of how many tiles the segment visits on average also answers, as will be seen, the inverse question (segment length to visit a given number of tiles on average).A natural, related problem (2b) is with what probability the segment visits the maximum number of tiles.
The questions studied in this paper are related to Buffon's needle problem and Laplace's extension of it, as stated at the outset.Buffon's original problem considers a plane with vertical lines a distance a apart.A needle is placed on the plane with uniformly random position 2 and orientation, and the probability of the needle crossing a line is studied.For a needle of length ℓ = a, this probability is 2/π (and hence repeated trials of this experiment can be used to estimate π).This is generalized in [8] to 2ℓ/(πa) for the expected number of crossings of a needle with arbitrary length.
The Buffon-Laplace needle problem [4, section 1.1] considers a needle randomly placed on a grid of rectangular tiles of width a and height b.The number of visited tiles equals one plus the number of crossings almost surely.The probability of the needle staying within a single tile is computed in [2] for the case where ℓ < min{a, b}.One of the problems considered in this paper, as mentioned above, is the complementary question (2b) of the probability that the needle visits the maximum number of tiles possible for its length.
The rest of the paper is organized as follows.Fundamental results are presented in §2, which form the basis of both the deterministic and probabilistic analyses.The direct and inverse problems for a deterministic segment are considered in §3, first for arbitrary grids and then for a square grid.The analysis for the random segment is carried out in §4.The average number of tiles is computed for arbitrary grids, and the probability that the segment visits the maximum number of tiles is obtained for a square grid.
The symbols ⌊x⌋ and ⌈x⌉ respectively denote the floor (rounding down) and ceiling (rounding up) operations.The functions arcsin x and arccos x are defined as their principal branches in the usual way.In particular, the output angles are in [0, π/2] for x ∈ [0, 1].

Fundamentals
For a grid with horizontal spacing a and vertical spacing b, lines x = ka or y = kb with k ∈ Z will be called grid lines.A tile is delimited by two pairs of consecutive horizontal and vertical grid lines.The intersection points of horizontal and vertical grid lines will be called grid points.These correspond to vertices of the tiles.
Every segment has an associated discrete bounding rectangle, which is the minimum-size rectangle that is formed by grid lines and contains the segment.More specifically, if the segment has endpoints (x 1 , y 1 ), (x 2 , y 2 ) ∈ R 2 , its discrete bounding rectangle has lower-left and upper-right corners respectively given as The dimensions of the discrete bounding rectangle, normalized to the tile width and height respectively, are two integer numbers i, j.Two examples are illustrated in Figure 2, both with i = 5, j = 4.All tiles visited by the segment are contained in the discrete bounding rectangle.Note also that the rectangle can have i = 0 or j = 0 if the segment coincides with part of a grid line.
Proposition 1.Consider an arbitrary segment, and let i, j respectively denote the normalized width and height of its discrete bounding rectangle.If i, j ≥ 1, the number of tiles visited by the segment is at most i + j − 1.This bound is attained if and only if the segment does not pass through any grid point in the interior of the rectangle.
Proof.The segment visits, by definition, two tiles in opposite corners of the discrete bounding rectangle.It can be assumed, without loss of generality, that those tiles are in the lower-left and upper-right corners of the rectangle, as in Figure 2. The visited tiles can be thought of as following a path within the discrete bounding rectangle.Starting at the lower-left tile, the next tile can be the one to the left, the one above, or the one above and to the left.The latter case occurs if and only if the segment passes through the grid point between those two tiles.
Since the segment follows a straight line, once it "leaves" a row of tiles in its path from the lower-left to the upper-right corner, it can never visit any more tiles from that row.The same observation applies to the columns.
This implies that the maximum number of visited tiles is i + j − 1, which is attained if and only if the segment avoids all grid points in the interior of the discrete bounding rectangle, as in Figure 2(a).Note that grid points at the corners of the rectangle do not count for this; and that the segment cannot pass through any other grid points on the rectangle border, because that would imply i = 0 or j = 0. Figure 2(b) illustrates a case where the maximum is not attained.(i) The following inequalities hold for any segment with length ℓ whose discrete bounding rectangle has normalized dimensions i, j: (ii) Conversely, if ℓ, i, j satisfy (1) and (2) there exists a segment of length ℓ whose discrete bounding rectangle has normalized dimensions i and j.
(iii) There is a segment of length not exceeding ℓ that has a discrete bounding rectangle with normalized dimensions i, j if and only if (1) holds.
Proof.(i) The inequalities follow from the fact that the segment endpoints lie in the interiors or on the outer edges of two tiles in opposite corners of the discrete bounding rectangle.This is illustrated in Figure 3 for two specific (i, j) pairs.For each (i, j), segments are shown with lengths close to either of the two bounds.Note that inequality (1) is valid even for i = 2, j = 2, in which case it reduces to ℓ > 0.
(ii) For a, b, ℓ, i, j satisfying the two inequalities, a segment of length ℓ can be found that has its endpoints in the interiors or on the outer edges of the two shaded tiles of a rectangle with normalized dimensions i and j (see Figure 3), which is thus the discrete bounding rectangle of that segment.
(iii) "(1) ⇒ there is a segment. . .": Assume that (1) holds.It is always possible to choose a length equal to or smaller than ℓ such that both (1) and (2) hold.The result follows, for that length, from part (ii).
"There is a segment. . .⇒ (1)": Assume that a segment exists with length ℓ ′ ≤ ℓ and with a discrete bounding rectangle of normalized dimensions i, j.From part (i) it follows that inequality (1) holds for the length ℓ ′ , and thus for ℓ.
Consider the problem of maximizing the number of visited tiles for a given length.According to Proposition 1, the position and orientation of the segment should be chosen to obtain i + j − 1 as large as possible, where i and j are the normalized dimensions of its discrete bounding rectangle.On the other hand, Proposition 2 restricts the i, j values that can be achieved with a given length.A relevant question is: are there any (i, j) pairs that can be disregarded irrespective of the length ℓ?In other words, what is the "smallest" subset of N 2 such that the (i, j) pair that maximizes the number of tiles for any given length can always be found within that subset?
For instance, it is clear from Figure 1 that segment orientations near the vertical or horizontal directions (resulting in i = 1 with large j, or j = 1 with large i) will not maximize the number of visited tiles, and thus the corresponding (i, j) pairs can be discarded.On the other hand, the set of optimal (i, j) pairs must contain one such pair for each possible value of i + j − 1, so that the set can produce that value as the solution (maximum number of visited tiles) for certain lengths.It is insightful to examine two specific examples (Figure 4) before giving an explicit formula for the coordinates of the optimal pairs.Consider a = b = 1 first.This is illustrated in Figure 4(a).Note that in this and in the next figures the axes represent ia and jb (not i and j).In this graph, each dashed diagonal line contains points (ia, jb) with the same i + j − 1; and the lower bound (1) corresponds to an arc centered at (2a, 2b).
For a given ℓ ∈ R + , the (i, j) pairs that can be achieved with segments of length not exceeding ℓ are, by Proposition 2.(iii), those that satisfy (1).Thus for a given value of i + j − 1 the optimal (i, j) pair (the one that can be achieved with the smallest length) is determined by the condition that the point (ia, jb) minimizes the distance to (2a, 2b).Such pairs are depicted as filled circles in the figure, and the arcs represent the inequality (1) for each of the optimal pairs.Conversely, given a length ℓ, the maximum number of visited tiles will be achieved with one of these pairs, namely the pair (i, j) such that (ia, jb) is on the uppermost (or rightmost) diagonal line while still being contained in the circle of radius ℓ centered at (2a, 2b).
The optimal pairs in this specific case have the form (i, i) or (i, i − 1), as seen in the figure.Due to symmetry, any pair (i, i − 1) could be replaced by (i − 1, i).This illustrates that the set of optimal pairs is not unique in general.
As a second example, consider a = 1.35, b = 1.This is depicted in Figure 4(b).Again, the optimal pair (i, j) for each diagonal is that for which the point (ia, jb) is closest to (2a, 2b); but in this case the i, j coordinates of these pairs do not follow a rule as simple as in the previous example.
The following proposition gives an explicit method to obtain a set of optimal (i, j) pairs.This set will be denoted as M = {(i 3 , j 3 ), (i 4 , j 4 ), . ..},where the pair (i t , j t ) corresponds to i + j − 1 = t.Proposition 3. Given a, b ∈ R + , a set of optimal pairs M = {(i 3 , j 3 ), (i 4 , j 4 ), . ..} can be obtained as where i t + j t − 1 = t.All pairs (i t , j t ) are strictly below the line Proof.For each t ≥ 3, the pair (i t , j t ) should be chosen as that on the line i + j − 1 = t which minimizes (i − 2) 2 a 2 + ( j − 2) 2 b 2 .This allows maximizing the sum i + j − 1, and thus the number of visited tiles, for a given length restriction; or visiting a specified number of tiles with lengths as small as possible.
Consider, for the moment, i, j as if they were real-valued variables, and denote x = ia, y = jb.The line i + j − 1 = t then becomes and 2 .The point minimizing this quadratic function along the line (7) is the intersection of the latter with the perpendicular line passing through (2a, 2b), An example with a = 1.35, b = 1, t = 7 is shown in Figure 5, where ( 8) is depicted as a solid line.Solving the system of equations ( 7) and ( 8) gives In terms of the real-valued variables i, j, the solution (i + , j + ) is thus The corresponding point (i + a, j + b) is shown in Figure 5 with a square marker.The variables i, j are actually limited to integer values.The pair (i t , j t ) ∈ Z 2 that minimizes (i − 2) 2 a 2 + ( j − 2) 2 b 2 along the line i + j − 1 = t is either (⌈i + ⌉, ⌊ j + ⌋) or (⌊i + ⌋, ⌈ j + ⌉), whichever gives (i t a, j t b) closest to (i + a, j + b), as illustrated in Figure 5.In case of a tie the first of the two options is (arbitrarily) chosen.This can be expressed as which corresponds to rounding i + and j + to the closest integers, with ties resolved in opposite directions.Combining (11)-( 14) yields ( 3) and (4).From (11) and ( 13), Figure 5: Obtaining (i + , j + ) and Figure 6: Set of optimal pairs M, and bounding lines and similarly, from (12) and ( 14), Considering the first inequality in (15) and the second in (16) as equalities and eliminating t gives (5).The pair (i t , j t ) is strictly below the line (5) because the used inequalities are strict.Similarly, (6) results from the second inequality in (15) and the first in (16), and the fact that those inequalities are not strict implies that the bound (6) can actually be attained.
The bounding lines in Proposition 3 are shown in Figure 6, using three different pairs of grid parameters a, b as examples.Given (i t , j t ) ∈ M, the next pair (i t+1 , j t+1 ) is obtained by incrementing j if that results in a point below (5).Else i is incremented instead, and the new pair is guaranteed to be above or on (6).
For a 2 /b 2 arbitrary, the number of pairs in M with the same i, or with the same j, is in general irregular, because the lines ( 5) and (6) do not follow a "natural" direction of the grid.This happens for instance in Figure 6(b), where the number of pairs for each i equals either 2 or 3 without a clear pattern. 3On the other hand, a simple pattern arises when a 2 /b 2 or b 2 /a 2 is a natural number, as seen in Figures 6(a) and 6(c).
A segment whose discrete bounding rectangle has normalized width i and height j is oriented with approximate slope jb/(ia) with respect to the x axis (see Figure 3); and this approximation becomes better for greater segment lengths.From ( 5) and ( 6) it can be seen that the pairs (i, j) ∈ M have j/i ≈ a 2 /b 2 for large i, j.Therefore the optimal slope for long segments is approximately a/b.This substantiates the intuition that to maximize the number of visited tiles, the segment direction should strike a balance between achieving a small perceived "length" of the tile on one hand, and crossing both horizontal and vertical grid lines on the other hand.

Deterministic segment: direct and inverse problems
The direct and inverse problems defined in §1, considering the segment position and orientation as deterministic, are addressed in this section.The general case for rectangular grids with real-valued segment lengths is analyzed first, in §3.1.
The square grid with real-valued segment lengths is addressed in §3.2, as it allows a specialized formula for the direct problem.Lastly, the analysis of a unit square grid with integer-valued lengths is presented in §3.3.

Arbitrary grid with real-valued lengths
Given a grid with parameters a, b ∈ R + , the maximum number t of visited tiles for an arbitrary real-valued length ℓ can be represented by a function τ : R + → N such that t = τ(ℓ).Similarly, for the inverse problem a function λ : N → R + can be defined such that λ (t) gives the infimum length of all segments that visit at least t tiles.Clearly, these two functions are related as For arbitrary a, b ∈ R + , the functions τ and λ can be computed using an iterative procedure, which exploits the fact that the pairs (i 3 , j 3 ), (i 4 , j 4 ), . . . of the set M are sorted by increasing i + j − 1, and also by increasing Namely, for τ the following method yields the solution: generate successive pairs to find the last one, (i t , j t ), that satisfies (1); then τ(ℓ) = t.For λ the analogous method gives a direct formula.In addition, it is possible to obtain a direct formula also for τ using a different approach.These formulas are given in Theorems 1 and 2.
The function τ is piecewise constant and left-continuous, with unit-height jumps.
A jump occurs at ℓ if and only if ℓ = λ (t) for some t ∈ N, t ≥ 4; and then Proof.The approach is similar to that used in the proof of Proposition 3. First, the intersection point (i + a, j + b), i + , j + ≥ 2 between the line defined by ( 6) and the arc centered at (2a, 2b) with radius ℓ is computed, if it exists.Then, based on either the values i + , j + or the non-existence of the intersection point, a pair of integer values (i * , j * ) is obtained that maximizes the i + j − 1 sum that can be achieved with segments of length up to ℓ.
As will be seen, the obtained pair (i * , j * ) may belong to the set M defined by Proposition 3 or not.However, in either case τ(ℓ) is given by i * + j * − 1.The two possibilities are respectively illustrated in Figures 7(a In each case, the displayed arc is centered at (2a, 2b) and has radius ℓ.The inner region defined by the arc contains all (ia, jb) points such that the pair (i, j) is achievable according to Proposition 2.(iii).As in previous figures, filled circles represent points (ia, jb) such that (i, j) ∈ M. The solid line is the bound (6).The intersection point (i + a, j + b) is displayed with a square marker.
The pair (i + , j + ) results from solving the equation system Expressing these equations in terms of new variables i + − 5/2 and j + − 3/2, the solutions are easily found to be where the same sign (positive or negative) should be used in the two equations.This can yield zero, one or two real-valued solution pairs (i + , j + ), which respectively corresponds to the solid line in Figure 7 being exterior, tangent or secant to the circle (the figure depicts the latter situation).A solution pair (i + , j + ) given by ( 24) and ( 25) is meaningful only if it is real-valued with i + , j + ≥ 2. This solution, if it exists, is always associated with the positive sign in those expressions.Since a ≥ b, it is easily seen that j + ≥ 2 implies i + ≥ 2, and thus it suffices to check the former condition.Three cases need to be distinguished: there are no real-valued solution pairs (i + , j + ); there are one or two but none of them has j + ≥ 2; or there are one or two and and one of them satisfies that inequality.These cases correspond to different ranges of ℓ, as seen next.
For ℓ < √ a 2 + b 2 /2, (24) and ( 25) are not real-valued.Since a ≥ b, from the inequality ℓ < This means that any achievable (i, j) pair, if any, will have i = 2. Thus in this case i * should be set to 2.
For 24) and ( 25) give either two realvalued solutions or one real-valued double solution for (i + , j + ), with j + < 2. This in turn implies, according to (23), that i + < (b 2 /a 2 + 5)/2 ≤ 3 for a ≥ b.Thus only pairs with i = 2 are achievable again for ℓ in this range, and therefore i * must be 2.
The three cases are unified, as can be easily checked, by taking the real part of the positive-sign version of (24) and computing i * = ⌈i + ⌉ − 1.This yields (20).Once i * is known, (21) computes j * as the greatest integer such that (i * a, j * b) is within the circle with center (2a, 2b) and radius ℓ.This ensures that (i * , j * ) is achievable with lengths less than ℓ.
To see that τ(ℓ) = i * + j * − 1, the two situations stated at the outset need to be considered separately.The first possibility is that (i * , j * ) ∈ M (upper part of Figure 7).Then, by construction (i * , j * ) maximizes i + j − 1 among all achievable pairs of M, and is therefore optimal.
The second possibility is that (i * , j * ) / ∈ M (Figure 7(b)).This happens when the pair from M that has i = i * ((4, 5) in the figure) is outside the circle, i.e. it would require a length greater than ℓ.The selected (i * , j * ) ((4, 4) in the figure), however, has the same i + j − 1 sum as the pair from M that "should" be used, which is (i * − 1, j * + 1) ((3, 5) in the figure); and therefore gives the same result.This is always the case, because (i * , j * + 1) ∈ M (it is above or on the bounding line) and (i * , j * ) / ∈ M (it is below the line), and due to how M has been constructed, this implies that is achievable and maximizes i + j − 1, and thus i * + j * − 1 is the desired solution.
Interestingly, for the specific case that a 2 /b 2 = 2k − 1, k ∈ N the lower bounding line (6) becomes j = (2k − 1)i − 5k + 4, which gives integer j for integer i.This means that for each i there is a pair (i, j) ∈ M that is on that line (see for example Figure 6(a)), and the case (i * , j * ) / ∈ M never occurs.As for the properties of τ, it stems from ( 19)-( 21) that this function is piecewise constant and left-continuous.From the procedure described in the previous paragraphs for obtaining (i * , j * ) it is clear that i * + j * − 1 increases in steps of 1 when ℓ is increased continuously; that is, τ has jumps of unit height.
Consider an arbitrary ℓ such that for some t ∈ N, t ≥ 4 To see that τ has a jump at ℓ, assume for the sake of contradiction that τ is continuous at that point.Therefore τ is constant on an interval containing that point, which implies that τ(ℓ − ε) = t = τ(ℓ + ε) for some ε > 0. This means that there exists a segment with length ℓ − ε that visits t tiles, and thus λ (t) ≤ ℓ − ε < ℓ, in contradiction with (26).Therefore τ is discontinuous (from the right) at ℓ.By definition of λ , from (26) it follows that and there exists ε > 0 such that τ(ℓ + δ ) = t for 0 < δ < ε.This implies that lim that is, τ has a jump at ℓ.In addition, since the jump has unit height, it stems from ( 27) and (28) that τ(ℓ) = t − 1.
Although Theorem 1 requires a ≥ b, the result could obviously be applied for a < b by swapping the values of a and b.
Theorem 2. For a, b ∈ R + and t ∈ N, Equivalently, for t ≥ 3, This function is monotone increasing for t ≥ 3.
Proof.The (i t , j t ) pair in set M defined in Proposition 3 corresponds to at most t visited tiles.By construction of this set, any segment that visits t tiles must have length greater than (i t − 2) 2 a 2 + ( j t − 2) 2 b 2 .For t ≥ 3 the variables i * , j * computed in (30)-(33) coincide with i t , j t as given by ( 3) and ( 4), and therefore (29) gives the correct result.For t ∈ {1, 2} both (32) and (33) equal 2, and (29) gives 0, which is again the correct result.For t ≥ 3, the term (i t − 2) 2 a 2 + ( j t − 2) 2 b 2 can be interpreted geometrically as the distance between (i t a, j t a) and (2a, 2b).As can be seen with the help of Figure 5, this distance is the hypotenuse of a right triangle whose other two sides extend from (2a, 2b) to (i + a, j + b) and from (i + a, j + b) to (i t a, j t a) respectively.Therefore, For t ≥ 3 it stems from (30) and ( 31) that The fact that both (i + , j + ) and (i t , j t ) are on the line i + j − 1 = t implies that i + + j + = i t + j t .Taking into account that i t = i * and j t = j * , it stems that r with r given by (35).Consequently, Substituting (37) and (38) into (36) and using (29) yields (34).The definition of λ implies that λ (t) ≥ λ (t − 1) for any t ∈ N. On the other hand, by Theorem 1, τ is piecewise constant and has a unit-height jump from t − 1 to t at λ (t), t ∈ N, t ≥ 4.This implies that λ (t) > λ (t − 1) for t ≥ 4.
The expression (34) allows a neat interpretation of λ (t) (as stems from the arguments used in the proof of Theorem 2).Namely, λ 2 (t) is the sum of the two terms that appear in that expression.The first term is the squared distance from (2a, 2b) to the diagonal line defined by i + j − 1 = t; and the second term is additional squared distance incurred from rounding i, j to integer values.
Theorems 1 and 2 not only give the solutions τ(ℓ) and λ (t) to the first two questions posed in §1; they also provide a way to actually position a segment of length ℓ or slightly greater than λ (t), respectively, so that it visits τ(ℓ) or t tiles.Namely, for i * , j * computed as in the corresponding theorem, the segment should have its endpoints in the interiors of two tiles shifted i * − 1 steps horizontally and j * − 1 steps vertically with respect to each other, with the exact position and orientation of the segment adjusted to avoid any grid points.
It is interesting to consider the following particular cases:  As for a ≫ b, in this case the optimal discrete bounding rectangle has i * = 2, and j * as large as allowed by ℓ (direct problem) or as required by t (inverse problem), corresponding to an almost vertical segment.In other words, for a ≫ b the length of the segment is best invested in increasing the number of tiles traversed vertically (but the segment should be slightly tilted to cross a vertical edge), and the asymptotic ratio (39) is approximately 1/b.
For a = b, either from symmetry considerations or particularizing the results in the above theorems it stems that the optimal orientation of the segment is close to 45 • .This case will be dealt with in §3.2, as it lends itself to simplified formulas.
Figure 8 shows the functions τ and λ for several pairs of grid parameters a, b.The graphs illustrate some of the observations of the previous paragraphs.Indeed, the asymptotic slope in Figure 8

Unit square grid with real-valued lengths
A square grid has a = b.For real-valued segment lengths it can be further assumed that a = 1 (unit square grid).For a ̸ = 1 the expressions to be obtained are valid with ℓ and λ (t) replaced by ℓ/a and λ (t)/a respectively.
Particularizing the results in §3.1 to a = b = 1 obviously yields simpler formulas.
Corollary 1.For a unit square grid with ℓ ∈ R + , Corollary 2. For a unit square grid, and for t ∈ N, or equivalently Furthermore, an even simpler formula can be obtained for τ, as the next theorem shows.
Theorem 3.For a unit square grid with ℓ ∈ R + , which gives either j * = i * or j * = i * + 1. Equivalently, Proof.The proof of (45)-(47) uses a variation of the set M defined in Proposition 3 that is more suited to this situation.For a = b = 1, the set M consists of points of the form (i, i) and (i, i − 1), as is easily seen from Proposition 3, and as illustrated in Figure 6(a).By symmetry, replacing each point (i, i − 1) by (i − 1, i) gives a set M ′ that is also optimal.For this new set, the lower bounding line (6) can be replaced by the simpler j = i.The same approach followed in the proof of Theorem 1 can be applied here, but using this line.Thus (i + , j + ) is obtained from which gives As in Theorem 1, i * is obtained as ⌈i + ⌉ − 1; and then j * is chosen as the largest integer such that (i * , j * ) is achievable, i.e. its distance from (2, 2) is less than ℓ.
The resulting i * and j * are given by ( 46) and (47).
The above procedure for choosing j * given i * = ⌈i + ⌉ − 1 always results in j * being either i * or i * + 1.This can be seen as follows.If j * = i * , the point (i * , j * ) is closer to (2, 2) than (i + , j + ) is, and is therefore achievable.This implies that values of j * smaller than i * will never be chosen.On the other hand, j * = i * + 2 or larger values are not achievable, because they would produce a sum i + j − 1 greater than i + + j + , which is impossible.
The preceding analysis shows that the pair (i * , j * ) is in M ′ and maximizes i + j − 1. Therefore (45) holds.
To show (48), it is first noted that for t ≥ 3 Corollary 2 gives According to (17), τ(ℓ) is obtained as the largest positive integer t such that Since the left-hand side of ( 53) is an integer, the condition of being strictly less than ℓ 2 is equivalent to which in turn is the same as Solving for t gives The desired quantity τ(ℓ), that is the largest positive integer t satisfying (56), is thus the right-hand side rounded down, as given by (48).
From Theorem 3 it stems that odd values of τ(ℓ) correspond to i * = j * , whereas even values are achieved with j * = i * + 1.In addition, noting that τ(ℓ) = t is equivalent to λ (t) < ℓ ≤ λ (t + 1) and using Corollary 2 the following characterization of τ is obtained.For t ≥ 3 with t odd, τ(ℓ) = t if and only if For t ≥ 4, t even, τ(ℓ) = t if and only if

Unit square grid with integer lengths
A natural variation of the direct and inverse problems introduced in §1 is to consider a = b = 1 with the additional restriction that the segment length can only be a positive integer (equivalently, the square grid has spacing a and the segment lengths are restricted to integer multiples of a).
The direct problem in this setting corresponds to the restriction of τ to N. This will be denoted as a function T : N → N for greater clarity, although obviously T (ℓ) = τ(ℓ) for all ℓ ∈ N. The sequence T (ℓ), ℓ ∈ N takes values 3, 5, 7, 8, 9, . .., and is depicted in Figure 9(a).This is A346232 in the On-Line Encyclopedia of Integer Sequences [6].For this sequence, the expression (48) in Theorem 3 simplifies in the obvious way, and the following properties hold.Theorem 4. For ℓ ∈ N, In addition, (i) This sequence is increasing, with T (ℓ + 1) − T (ℓ) ∈ {1, 2}.
(ii) There can be no more than 2 consecutive increments equal to 1.
(iii) Increments equal to 2 always appear isolated, except at the initial sequence terms 3, 5, 7.
The inverse problem with integer-length segments can be formulated as follows: given t ∈ N, find the minimum integer length that allows visiting at least t tiles.Observe that in this case, unlike with real-valued lengths, there is indeed a minimum length, as every subset of N has a minimum.This can be expressed as a function Λ : N → N: which is related to the function λ for real-valued lengths by The converse to (65) is (compare to (17)): In view of ( 65) and (67), T and Λ can be considered as "pseudo-inverse" sequences of each other.The sequence Λ(t), t ∈ N can be computed using ( 44) and (66).It has initial values 1, 1, 1, 2, 2, 3, 3, 4, 5 . .., as seen in Figure 9(b).This is A346693 in the On-Line Encyclopedia of Integer Sequences [5].Moreover, a slightly simpler expression can be obtained from (59) and (65).This is established by the next theorem, which also states some properties of Λ, parallel to those of T .Theorem 5.For t ∈ N, In addition, (i) This sequence is non-decreasing.Except for the initial run of 3 equal values, it is formed by runs of 1 or 2 equal values, with an increment of 1 between consecutive runs.
(ii) There can be no more than 3 consecutive terms that are different.
(iii) A run of 2 equal values always has 2 different terms before and 2 different terms after the run, except for the initial terms 1, 1, 1, 2, 2, 3, 3.
Proof.Using (59), the inequality T (ℓ) ≥ t in (65) is written as Since the right-hand side is an integer, this is equivalent to Assuming t ≥ 4, taking squares and rearranging gives which combined with (65) yields the second part of (68).The first part results from noting that for t ≤ 3 the value ℓ = 1 satisfies (70).The stated properties for Λ follow directly from those of T established by Theorem 4.

Random segment: probabilistic characterization
Given ℓ ∈ R + , consider a segment of length ℓ with uniformly random position and orientation.Specifically, the coordinates x 1 , y 1 of the first endpoint are independent random variables uniformly distributed on [0, a) and [0, b) respectively, where a, b are the grid parameters.The orientation θ of the segment is uniformly distributed on [0, 2π).The variables x 1 , y 1 and θ determine the coordinates x 2 , y 2 of the second endpoint.
Each realization of the random segment gives rise to a discrete bounding rectangle, whose normalized dimensions i and j are thus random variables, as is the number t of visited tiles.Except for a set of realizations with probability 0, i and j are at least 1, and t = i + j − 1.Note that i and j are not statistically independent.
This section deals with the two problems stated in §1 for random segments, namely obtaining the average number of visited tiles and the probability of visiting the maximum possible number of tiles.Segment lengths will be assumed to be real-valued.The results to be obtained are directly applicable for integer lengths as a particular case.
Arbitrary grids are considered in §4.1.The main result is the average number of visited tiles.The square grid is addressed in §4.2.This more specialized setting allows computation of the probability of visiting the maximum number of tiles, which would be difficult in the general case.

Arbitrary grid with real-valued lengths
Let ϕ : R + → R + be defined such that ϕ(ℓ) is the average number of tiles visited by a random segment of length ℓ, with the distributions specified in the preceding.Theorem 6.Given a, b, ℓ ∈ R + , consider a grid with parameters a, b and a uniformly random segment of length ℓ, as defined above.The average number of tiles visited by the segment is Proof.Suppose first that the grid is simplified to only vertical lines with spacing a.This matches the set-up of Buffon's original needle problem [4, section 1.1], except that here the length ℓ of the needle may exceed the spacing a, allowing it to cross multiple lines.As shown in [8], the expected number of lines crossed equals 2ℓ/(πa).Consider again a grid with horizontal spacing a and vertical spacing b.The grid crossings decompose into crossings of horizontal and vertical grid lines.By linearity of expectation, the expected number of crossings is the sum of the expectations for parallel lines with spacing a and b respectively, which gives 2ℓ As noted in Proposition 1, the number of tiles visited by a segment is the count of its grid line crossings plus 1, unless it exactly passes through any grid points, but that occurs with probability 0 and therefore does not affect the expected value.Thus ϕ(ℓ) is obtained by adding 1 to the above expression, which gives (72).
In view of Theorem 6, the average number of visited tiles as a function of the segment length has a very simple form, namely an affine function.Conversely, for any t > 1 it is immediate to compute the length of a random segment that visits t tiles on average, given as ϕ −1 (t).
In spite of the dependence between the random variables i and j, their marginal distributions have relatively simple analytic expressions, as established by the next proposition.
For 0 ≤ s ≤ 1, let Proposition 4. Given a, b, ℓ ∈ R + , consider a grid with parameters a, b and a uniformly random segment of length ℓ, as defined above.Let the random variables i, j represent the normalized dimensions of the discrete bounding rectan-gle.For n ∈ N, (74) and Pr[ j ≥ n] is given by the same expressions with a replaced by b.
Proof.Clearly, Pr[i ≥ 1] = 1.In the following it will be assumed that n ≥ 2. The basic idea is to compute Pr[i ≥ n] conditioned on (x 1 , y 1 ) (or, as will be seen, only on x 1 ), and then to average over x 1 and y 1 (actually only over x 1 ).
Given the coordinates (x 1 , y 1 ) of the first endpoint of the segment, with 0 ≤ x 1 < a, 0 ≤ y 1 < b, the second endpoint (x 2 , y 2 ) lies on a circle with radius ℓ centered at (x 1 , y 1 ), as shown in Figure 10.The segment orientation is a random angle θ uniformly distributed on [0, 2π).It is clear from the figure that i ≥ n if and only if x 2 > a(n − 1) or x 2 < −a(n − 2); and for n ≥ 2 these events are exclusive.Thus The two conditional probabilities on the right-hand side of (75) are different in general.However, averaging over x 1 , y 1 gives, by symmetry, Pr[x 2 > a(n − 1)] = Pr[x 2 < −a(n − 2)].In addition, the coordinate y 1 does not have any influence on these events, and therefore conditioning on x 1 , y 1 is the same as conditioning on x 1 .This implies that, for n ≥ 2, Consider the event x 2 > a(n − 1) conditioned on x 1 , with n ≥ 2. There are three possibilities depending on x 1 , n and ℓ.If a(n − 1) < ℓ, regardless of x 1 the length ℓ is enough for x 2 to exceed a(n − 1) for some angles θ .This is depicted in Figure 10(a), where the section of the arc with solid line represents, for a given x 1 , those angles for which x 2 > a(n − 1).If a(n − 2) < ℓ ≤ a(n − 1), the length will be enough provided that x 1 > a(n − 1) − ℓ, and then only for certain angles.This restriction on x 1 corresponds to the shaded region in Figure 10(b).Lastly, if ℓ ≤ a(n − 2) it is not possible for x 2 to exceed a(n − 1), regardless of x 1 or θ .The figure makes it clear that the coordinate y 1 is irrelevant to this.
In the first two cases above, the probability that x 2 > a(n − 1), conditioned on x 1 , is the length of the arc to the right of the line x = a(n − 1) divided by 2πℓ, that is, In the first case x 1 has a uniform distribution on [0, a), and Pr[x 2 > a(n − 1)] is where the function f is defined in (73).Substituting into (76) yields the result in (74), second line.
The second case is similar, but the integration over x 1 is from a(n − 1) − ℓ to a. Noting that f (1) = 1, this gives which combined with (76) yields the expression in (74), third line.The third case obviously gives Pr[i ≥ n] = 0, as in (74), fourth line.
The above arguments can be applied to Pr[ j ≥ n] if the x and y axes are interchanged.Thus the formulas are the same with a replaced by b.
The results in Theorem 6 and Proposition 4 make clear the relationship between the problem considered here and Buffon's needle experiment, which deals with a random segment of fixed length in a regular structure of parallel strips [4, section 1.1].Firstly, since the number π is involved in (72), it is possible to design a simple probabilistic experiment to estimate the value of π, as in Buffon's original problem.For example, choosing a = b = ℓ = 1 gives ϕ(ℓ) = 4/π + 1.
Secondly, a grid with b → ∞ corresponds to Buffon's arrangement of parallel strips with spacing a.Thus gives the average number of lines crossed in Buffon's experiment.For ℓ ≤ a the segment can cross at most one line, and (80) coincides with the probability of crossing [4, theorem 1.1.1].Lastly, Pr[i ≥ 2] as computed in Proposition 4 can be interpreted as the probability of crossing at least one line in Buffon's experiment with arbitrary needle length.Indeed, for n = 2 the third expression in (74) reduces again to 2ℓ/(πa) for ℓ ≤ a, whereas the second reduces to 2ℓ f (a/ℓ)/(πa) for ℓ > a.Using (73) this is expressed as in agreement with the known result for Buffon's needle problem with ℓ > a [4, theorem 1.1.2].On the other hand, Pr[i ≥ n] for n ≥ 3 can be seen as the probability of crossing at least one line in a modified version of Buffon's setup in which a needle endpoint is only allowed to move in a region of width a located in the middle of a strip of width (2n − 3)a.For ℓ → ∞, the average number of visited tiles ϕ(ℓ) has the following asymptotic slope, as stems from (72): On the other hand, the maximum number of visited tiles τ(ℓ) has an asymptotic slope given by (39).It is interesting to consider the ratio of these values, which also gives the asymptotic ratio between the average and the maximum numbers of visited tiles.This depends only on a/b, and is thus expressed as a function σ : R + → (0, 1): This function is represented in Figure 11.It satisfies σ (x) = σ (1/x), and is therefore symmetric in logarithmic scale, as seen in the figure.The function σ is unimodal with maximum value 2 √ 2/π ≈ 0.9003 for a/b = 1, and its limit when a/b tends to 0 or ∞ is 2/π ≈ 0.6366.This implies that for ℓ large the average number of tiles ϕ(ℓ) cannot be very small compared with the maximum number of tiles τ(ℓ).For example, ϕ(ℓ) exceeds 0.8τ(ℓ) asymptotically when The probability of visiting the maximum number of tiles for a rectangular grid is difficult to compute.The reason is the irregularity of the relevant (i, j) pairs for general a, b, analogous to that observed in §2 for the pairs (i, j) that maximize the number of visited tiles.In a square grid, however, the problem is more tractable.

Unit square grid with real-valued lengths
Consider a square grid with unit spacing, a = b = 1.Again, the results to follow can be applied to a square grid with spacing a ̸ = 1 if ℓ is replaced by ℓ/a.
For a random segment with length ℓ ∈ R + on a unit square grid, let the function ρ : R + → [0, 1] be defined such that ρ(ℓ) gives the probability that the segment visits the maximum possible number of tiles, τ(ℓ).This function is characterized by the next theorem.
For u, v ∈ N, s ∈ R + , let Computing this integral and using the identities cos 2 z = 1 − sin 2 z and cos(2z Taking into account that arcsin x = π/2 − arccos x, it follows from (84) that g(s, u, v) = g(s, v, u).
Theorem 7. Given ℓ ∈ R + , consider a unit square grid and a uniformly random segment of length ℓ, as previously defined.The probability ρ(ℓ) that the segment visits the maximum number of tiles t = τ(ℓ) is or equivalently, defining w = ℓ 2 − (t − 3) 2 /2, Proof.The approach is analogous to that used in the proof of Proposition 4, but conditioning on the segment orientation θ instead of on the location of its first endpoint.
Without loss of generality, the first endpoint of the segment can be assumed to be contained in the tile with lower-left corner (0, 0), which will be called the reference tile.
Consider ℓ ∈ R + , and let t = τ(ℓ).By Proposition 1, the segment visits t tiles almost surely if the dimensions i, j of its discrete bounding rectangle are such that i + j − 1 = t.In addition, a segment that visits the maximum number of tiles always has i, j ≥ 2. Namely, if i = 1 the segment can always be shifted and possibly tilted to cross a vertical grid line, thus increasing i to 2, without reducing j.The reasoning for j = 1 is analogous.Thus for i, j ≥ 2, i + j − 1 = t let ρ i, j (ℓ) denote the probability that the segment has a discrete bounding rectangle with dimensions i, j.Then For any i, j ≥ 2 with i + j − 1 = t, the segment has a discrete bounding rectangle with dimensions i, j if and only if its second endpoint is in the tile with lower-left corner (i − 1, j − 1) or in one of the other three symmetrical tiles with respect to the lines x = 1/2 and y = 1/2, i.e. those with lower-left corners (i − 1, 1 − j), (1 − i, j − 1) and (1 − i, 1 − j).An example is shown in Figure 12.Consequently, ρ i, j (ℓ) can be obtained by computing the probability that the second endpoint is in the tile with lower-left corner (i − 1, j − 1) and multiplying by 4.
By Proposition 2, the tile with lower-left corner (i − 1, j − 1) can be visited only if Thus ρ i, j (ℓ) = 0 if this restriction does not hold.In the following it will be assumed that it does.For a fixed orientation θ , the segment goes from the reference tile to that with lower-left corner (i − 1, j − 1) if and only if shifting the segment up and to the right so that its first endpoint is at (1, 1) results in the second endpoint still being in the tile with lower-left corner (i − 1, j − 1).This is illustrated in Figure 13.It cannot be the case that the segment "overshoots" past this tile, because that would yield a number of visited tiles exceeding t, which is the maximum.In other words, only one corner of the tile can be contained within the arc in the figure, namely its lower-left corner (i − 1, j − 1).
There is a range of values of θ for which the above condition is satisfied.This corresponds to the part of the arc with solid line in Figure 13.For each θ in this range, the valid positions for the second endpoint of the segment are in a rectangle contained in the tile with lower-left corner (i − 1, j − 1).These are the positions that cause the first endpoint to be in the reference tile.The rectangle associated with an example θ is shown in Figure 13, shaded.The area of this rectangle is the probability ρ i, j (ℓ, θ ) that the segment goes from the reference tile to that with lower-left corner (i − 1, j − 1) conditioned on θ .As seen in the The range of allowed values for θ , as can also be deduced from the figure, is (θ 0 , θ 1 ) with For θ outside of this range, the conditional probability ρ i, j (ℓ, θ ) is 0. Averaging ρ i, j (ℓ, θ ) over θ gives the probability that the segment visits this tile, and then multiplying by 4 yields ρ i, j (ℓ): The above arguments show that ρ i, j (ℓ) is given by (92) if the condition (88) holds, and equals 0 otherwise.Using this into (87) yields (85).
Given t, the range of lengths ℓ such that t = τ(ℓ) is either (57) or (58).For ℓ in this range, the number of reachable tiles with lower-left corners (i − 1, j − 1), i, j ≥ 2, i + j − 1 = t, i.e. the number of terms in (85), depends on ℓ.If t is odd, the minimum number is 1, corresponding to a tile with its lower-left corner on the line x = y, which gives the first term in the first expression in (86).For t even, the minimum number is 2, corresponding to two symmetrical tiles whose lower-left x and y coordinates differ by 1, which give the first term in the second expression.Either for t odd or even, additional tiles may become reachable as ℓ grows (within the range allowed by t), and these always occur in symmetrical pairs.These tiles (if any) correspond to the terms in the (possibly empty) sum indexed by k in either expression in (86).Figure 14 contains examples for several values of t, with a few values of ℓ for each t.Each length is represented by an arc with radius ℓ centered at (1, 1).For a given t, the filled circular markers are the lower-left corners of the tiles that are always reachable, whereas the empty circles correspond to tiles whose reachability depends on ℓ.
As can be seen in Figure 14, for each t there is a maximum number of tiles that can be reached, beyond which incrementing ℓ only results in t increasing by 1.For a given ℓ, the number of reachable tiles can be determined by counting how many markers are covered by the stretch w defined in Figure 15.This satisfies the relationship w 2 = ℓ 2 − (t − 3) 2 /2.From the figure, the number of terms in the sum over k (empty circular markers) is ⌈w/ √ 2 − 1⌉ for t odd and ⌈w/ √ 2 − 3/2⌉ for t even.This establishes (86).It should be noted that, in principle, the technique used in this proof could be employed for obtaining the probability that the number of tiles visited by the segment equals or exceeds any given value t < τ(ℓ).However, the process is more cumbersome.Specifically, with reference to Figure 13, the arc in this more general setting can enclose any number of corners of the considered tile, not necessarily 1, which makes the characterization of the shaded rectangles more complicated.
The probability ρ(ℓ) of visiting the maximum number of tiles on a unit square grid, computed from Theorem 7, is shown in Figure 16.As ℓ grows, This happens when ℓ equals the right endpoint of the interval (57) for t odd or of the interval (58) for t even.These length values will be denoted as ℓ t : Clearly, τ(ℓ t ) = t and lim ℓ→ℓ − t ρ(ℓ) = ρ(ℓ t ).The first continuous section seen in Figure 16 corresponds to a maximum number of visited tiles t = 3, for lengths in the interval (0, ℓ 3 ], where ℓ 3 = 1.The second corresponds to t = 4, for lengths in (ℓ 3 , ℓ 4 ], where ℓ 4 = √ 2. Within each continuous section the probability monotonically increases from 0 to a maximum value.The heights of the maxima are asymptotically proportional to 1/ √ ℓ t , as established by the next result. Proposition 5.The probability ρ(ℓ) of visiting the maximum number of tiles on a unit square grid has the following asymptotic behaviour: Proof.The probability ρ(ℓ) can be made arbitrarily close to 0 by choosing ℓ close enough to the left endpoint of either (57) or (58).This proves (94).
As argued in the proof of Theorem 7, ρ(ℓ t ) is the sum of several terms ρ i, j (ℓ t ) = g(ℓ t , i − 2, j − 2), where the sum runs over i, j as given by (85).Each Similarly, (93) and (105) yield, considering that t ≥ 3, The arc height h t is bounded from (103) and (107) as The number N t of reachable tiles shown in the figure (circular markers) is easily obtained from w t as The asymptotic analysis to be presented is based on the following observations.The half-width of the arc w t grows asymptotically as √ t for t → ∞, whereas the radius ℓ t is asymptotically proportional to t, and the height h t converges to √ 2/2.As a result, the slope dΩ(x)/dx tends to 0. Consider the tile depicted with thick line in Figure 17, for a generic value of the index n.For this tile, P t,n /t = ρ i(t,n), j(t,n) (ℓ t ) can be obtained as the area of the shaded rectangle in the figure averaged over θ uniformly distributed on [0, 2π), and then multiplied by 4, in the same way as in the proof of Theorem 7. Equivalently, the average can be restricted to the range of values of θ for which the shaded area is non-zero, corresponding to the arc with thick line in the figure, Taking into account that A t,n and c t,n are upper-bounded by the area of a tile and one quarter of the length of a circle of radius 1, respectively, and using (107), Instead of calculating A t,n and c t,n directly, it is easier to compute approximate versions of these, based on replacing the arc by its chord, as depicted in Figure 18.The difference between the approximate and exact values for each variable will be bounded from below and from above by functions of t that tend to 0 as t → ∞.Regarding c t,n , the chord length, denoted as ct,n , is obtained from Figure 17 as ct,n = 2ℓ t sin c t,n 2ℓ t .
Taking into account that sin s > s − s 3 /6 for s > 0 and using (107), As for A t,n , let Ãt,n denote its approximate version where the upper corner of the shaded rectangle in Figure 18 is uniformly distributed on the chord rather than on the arc.This approximation entails two types of errors: the distribution of the angle θ is no longer uniform; and the shaded rectangle becomes smaller because its corner is on the chord, not on the arc.It is convenient to describe the two sources of error in terms of, respectively, the horizontal and vertical coordinates of the upper corner of the shaded rectangle.More specifically, let x and y denote the coordinates of the corner along the arc, and let I t,n denote the interval of values of x corresponding to the projection of the arc (or of the chord) onto the horizontal axis.This interval is shown in Figure 18 with dashed, thick line.Firstly, in the exact case the distribution of x is non-uniform on I t,n (corresponding to a uniform distribution of θ ), whereas the approximation implies that x is uniformly distributed on I t,n .The corresponding probability density functions will be respectively denoted as p t,n (x) and pt,n (x).Secondly, for a given x, the vertical coordinate in the exact case, y (determined by the arc), is replaced by a smaller value ỹ in the approximation (chord).Let R t,n (x) and Rt,n (x) denote the area of the shaded rectangle that has its upper corner on the arc and on the chord respectively, as a function of x.Then Consider the first type of error in the approximation of A t,n , which arises from using pt,n (x) instead of p t,n (x).In the following it will be assumed that t ≥ 4. It stems from Figure 17 Along this arc, with x ∈ [−w t , w t ], the minimum of | sin θ | is attained when x equals w t or −w t .Thus, using (107), In the exact case θ is uniformly distributed along the arc shown with thick line in Figure 17, and the probability density function of x can be obtained using the transformation theorem for continuous random variables [7, To analyze the second type of error in the approximation of A t,n , caused by using Rt,n (x) instead of R t,n (x), consider the tangent line displayed in Figure 18 (dashed line).This makes it easy to see that for a given x the difference between the vertical coordinate of the arc, y, and that of the chord, ỹ, is less than the chord length, ct,n , multiplied by the maximum of the absolute value of the arc slope.The former is at most √ 2. The latter is upper-bounded by the value of |dΩ(x)/dx| at x = w t or x = −w t .From (102), ( 104) and (105), making use of the assumption that t ≥ 4, dΩ(x) dx = |x| and thus 0 This reduction from y to ỹ translates into a difference smaller than 3/ 2(t − 3) in each dimension of the shaded rectangle; or, since those dimensions are at most 1, a difference in area smaller than twice that value:.

Figure 2 :
Figure 2: Discrete bounding rectangle and visited tiles

i = 4 , j = 2 Figure 3 : 2 .
Figure 3: Relationship between segment length ℓ and dimensions i, j of the discrete bounding rectangle

Figure 4 :
Figure 4: Relationship of segment length and number of visited tiles with the width and height of the discrete bounding rectangle ) and 7(b) for a = 1.35, b = 1.

Figure 8 :
Figure 8: Functions τ and λ for several pairs a, b (a), or the inverse of the asymptotic slope in Figure 8(b), is approximately √ 2 for a = b = 1; and it is roughly 1/b for the case a = 5, b = 1, or even for a = 5, b = 1.5 or a = 10, b = 3. Comparing the latter two cases it is also seen that scaling a, b and ℓ by the same factor does not alter τ(ℓ), and results in λ (t) being scaled by that factor.

Figure 10 :
Figure 10: Conditions for the normalized width of the discrete bounding rectangle, i, to be equal or greater than a given n.Example with a = 1.35, b = 1, n = 3

Figure 11 :
Figure 11: Asymptotic ratio of average and maximum numbers of visited tiles

Figure 12 :
Figure 12: Symmetrical tiles for the computation of ρ i, j (ℓ) on a unit square grid.Example for i = 3, j = 4

Figure 13 :
Figure 13: Segment orientations and positions for a given t = τ(ℓ) on a unit square grid.Example for t = 7

Figure 14 :
Figure14: Tiles with lower-left corners (i−1, j −1), i+ j −1 = t = τ(ℓ) that can be reached from the reference tile on a unit square grid.Examples for several values of t and ℓ.

Figure 15 :Figure 16 :
Figure 15: Computation of the number of reachable tiles with lower-left corners (i − 1, j − 1), i + j − 1 = t = τ(ℓ) on a unit square grid x A t,n = I t,n R t,n (x)p t,n (x) dx, (117) Ãt,n = I t,n Rt,n (x) pt,n (x) dx.(118) that any point (x, y) on the full arc defined by (102) satisfies the equality cot θ = √ 2x/(t − 3) Figure 17: Reachable tiles that maximize the number of visited tiles on a unit square grid; rotated view.Example for t = 9 Since p t,n (x) and pt,n (x) are probability density functions, it cannot be the case that one of them is greater than the other for all values of x.In addition, both functions have the same support, namely I t,n , on which pt,n (x) is constant.This implies that, for x ∈ I t,n and t ≥ 4, ), Ãt,n −A t,n can be bounded for t ≥ 4 as Ãt,n − A t,n = Rt,n (x) pt,n (x) dx − A t,n The difference between Ãt,n ct,n and A t,n c t,n is bounded as follows:| Ãt,n ct,n − A t,n c t,n | = |A t,n ( ct,n − c t,n ) + ( Ãt,n − A t,n ) ct,n | ≤ A t,n | ct,n − c t,n | + ct,n | Ãt,n − A t,n |.As t → ∞, the sequence Ωt converges pointwise to the functionΩ(ζ ) = lim t→∞ Ωt (ζ ) =Furthermore, the convergence is uniform.To show this, it is easier to analyze the subsequences with t odd and even separately.For t odd, substituting ℓ t , h t and w t given by (93), (103) and (104) into (140), Ωt (ζ )/∂t as if t were a continuous variable, and taking into account that ζ ∈ [−1, 1],This implies that the subsequence Ωt with t odd is monotone non-increasing.Since the limit function Ω is continuous, by Dini's theorem [3, section 1.1] the convergence of this subsequence is uniform.An analogous argument establishes the uniform convergence of the subsequence for t even.Therefore, the full sequence Ωt converges to Ω uniformly on[−1, 1].The inequality (126) applies, for t ≥ 4, to y t,n = Ωt (x t,n /w t ) and ỹt,n .Together with (138), and making use of the uniform convergence of Ωt to Ω, this | < e ′′ (t), where e ′′ (t) tends to 0 as t → ∞.Thus the values x t,n /w t , n = 1, . . ., N t are equispaced with step √ 2/w t .In addition, x t,1 /w t and x t,N t /w t tend to −1 and 1 respectively as t → ∞.