Library · The Fiddler: Solutions · Chapter 145

Can You Bob and Weave?

Revised Report an error

A square weaving loom has NN evenly spaced hooks along each side, counting the two corners. Label the hooks on one side A1A_1 to ANA_N, those on the next side clockwise B1B_1 to BNB_N (so ANA_N and B1B_1 are the same corner hook), and so on for sides CC and DD. Elastic bands join A1A_1 to B1B_1, A2A_2 to B2B_2, and so on up to ANA_N to BNB_N. As NN grows, what is the shape of the curve formed by the edges of the bands?

The Fiddler, Zach Wissner-Gross, September 8, 2023(original post)

The official solution appeared in the post of September 15, 2023 and gives a parabola, x+y=1\sqrt x + \sqrt y = 1, for the main puzzle and about 43.7943.79 percent for the Extra Credit. Both agree with the answers below.

Solution

Make the loom the unit square and put the shared corner AN=B1A_N = B_1 at the origin, with side AA running up the yy-axis and side BB along the xx-axis. Hook AiA_i is as far from the far end A1A_1 of its side as hook BiB_i is from the shared corner B1B_1. Calling that distance ss, a band joins the point (0,1−s)(0, 1 - s) on side AA to the point (s,0)(s, 0) on side BB, for ss running from 00 to 11. As NN grows the bands fill in every value of ss.

The band with parameter ss lies on the line xs+y1−s  =  1,\frac{x}{s} + \frac{y}{1 - s} \;=\; 1 , since that line passes through both of its ends. So a point (x,y)(x, y) of the square is crossed by some band exactly when h(s)  =  xs+y1−sh(s) \;=\; \frac{x}{s} + \frac{y}{1 - s} equals 11 for some ss between 00 and 11. The one idea of the solution is to ask how small hh can be. It shoots up to infinity at both ends of the range, so it has a smallest value, and since it changes continuously it takes every value from that minimum upwards. The point is covered exactly when that minimum is at most 11.

The minimum comes from a neat trick: multiply hh by s+(1−s)s + (1 - s), which is just 11, and expand: h(s)  =  (s+(1−s))(xs+y1−s)  =  x+y+x(1−s)s+y s1−s.h(s) \;=\; \bigl(s + (1 - s)\bigr)\left(\frac{x}{s} + \frac{y}{1 - s}\right) \;=\; x + y + \frac{x(1 - s)}{s} + \frac{y\,s}{1 - s} . The last two terms multiply to xyxy whatever ss is, and two positive numbers with product xyxy add up to at least 2xy2\sqrt{xy} (because (a−b)2≥0(\sqrt a - \sqrt b)^2 \ge 0 gives a+b≥2aba + b \ge 2\sqrt{ab}), with equality when they are equal. So h(s)  ≥  x+y+2xy  =  (x+y)2,h(s) \;\ge\; x + y + 2\sqrt{xy} \;=\; \left(\sqrt{x} + \sqrt{y}\right)^2 , with equality when x(1−s)2=y s2x(1 - s)^2 = y\,s^2, that is, when s=x/(x+y)s = \sqrt{x}/(\sqrt{x} + \sqrt{y}). So the smallest value of hh is (x+y)2(\sqrt{x} + \sqrt{y})^2. The bands therefore cover precisely the points with x+y≤1\sqrt{x} + \sqrt{y} \le 1, and the curve along their edges is x+y  =  1.\sqrt{x} + \sqrt{y} \;=\; 1 . Each band touches this curve at exactly one point, the one with s=x/(x+y)=xs = \sqrt{x}/(\sqrt x + \sqrt y) = \sqrt{x}, which is where hh just reaches 11. In particular the band with parameter ss touches it at (s2,(1−s)2)(s^2, (1 - s)^2).

What kind of curve is it? Square y=1−x\sqrt{y} = 1 - \sqrt{x} to get 2x=1+x−y2\sqrt{x} = 1 + x - y, and square again: (x−y)2−2(x+y)+1  =  0.(x - y)^2 - 2(x + y) + 1 \;=\; 0 . The terms of degree two form a perfect square, (x−y)2(x - y)^2, and that is the signature of a parabola. Its axis is the diagonal y=xy = x. There is a more striking description. The squared distance from (x,y)(x, y) to the centre (12,12)\left(\tfrac12, \tfrac12\right) of the square is x2+y2−x−y+12x^2 + y^2 - x - y + \tfrac12, and the squared distance to the line x+y=0x + y = 0 is 12(x+y)2\tfrac12 (x + y)^2. Their difference is 12(x2−2xy+y2−2x−2y+1)  =  12((x−y)2−2(x+y)+1),\tfrac12\bigl(x^2 - 2xy + y^2 - 2x - 2y + 1\bigr) \;=\; \tfrac12\bigl((x - y)^2 - 2(x + y) + 1\bigr), which is zero on the curve. So every point of the curve is equally far from the centre of the square and from the line through the shared corner at right angles to the diagonal. That is the definition of a parabola, with that point as its focus and that line as its directrix.  a parabola, x+y=1. \boxed{\ \text{a parabola, } \sqrt{x} + \sqrt{y} = 1 . \ } Its focus is the centre of the square. It looks unlike a textbook parabola only because it is tilted by 45∘45^\circ and we see just the piece between two corners of the square.

Left: the bands from side A to side B for N = 25 , with their edge curve, the focus at the centre of the square and the directrix through the shared corner. Right: all four families of bands, with the uncovered centre of the Extra Credit shaded.
Left: the bands from side AA to side BB for N=25N = 25, with their edge curve, the focus at the centre of the square and the directrix through the shared corner. Right: all four families of bands, with the uncovered centre of the Extra Credit shaded.

The computation

The check works from the bands alone. At a column xx it finds the tallest band crossing that column, which is the top of the covered region there. The band with parameter ss crosses column xx (for x≤sx \le s) at height (1−s)(1−x/s)(1 - s)(1 - x/s), which rises and then falls as ss increases, so a ternary search over ss finds the tallest. For 9999 columns the program then tests the parabola’s defining property directly: the top point should be as far from the centre of the square as from the line x+y=0x + y = 0.

from math import hypot, sqrt

def height(s, x):
    """Height at column x of the band (0, 1-s) to (s, 0)."""
    return (1 - s) * (1 - x / s) if x <= s else 0.0

def edge(x):
    """Top of the region the bands cover at column x: the
    tallest band there. Each band's height is a concave
    function of s, so a ternary search finds the tallest."""
    lo, hi = x, 1.0
    for _ in range(80):
        a, b = lo + (hi - lo) / 3, hi - (hi - lo) / 3
        if height(a, x) < height(b, x):
            lo = a
        else:
            hi = b
    return height((lo + hi) / 2, x)

gap = 0.0
for k in range(1, 100):
    x = k / 100
    y = edge(x)
    to_focus = hypot(x - 0.5, y - 0.5)
    to_line = (x + y) / sqrt(2)
    gap = max(gap, abs(to_focus - to_line))
print("edge points on the parabola:", gap < 1e-9)

It prints

edge points on the parabola: True

Extra Credit

Now place bands on all four corners: as well as AiA_i to BiB_i, join BiB_i to CiC_i, CiC_i to DiD_i and DiD_i to AiA_i, for every ii, making 4N4N bands. As NN grows, what fraction of the loom’s area lies between the four sets of bands?

Solution

Each family of bands covers the region between its corner and a copy of the parabola above, so the uncovered centre is the part of the square on the far side of all four parabolas. The figure shows it: a curved square, with its corners pointing at the midpoints of the loom’s sides and its sides bulging outwards.

The four families are mirror images of one another in the two lines through the centre parallel to the sides, and in the two diagonals. These four lines cut the uncovered region into eight congruent pieces. Look at the one in the bottom-left quarter of the square, below the diagonal y=xy = x and left of the midline x=12x = \tfrac12. Two questions settle its shape.

Which parabola bounds it? The bottom-left corner’s parabola is y=(1−x)2y = (1 - \sqrt{x})^2. The bottom-right corner’s is its mirror image, y=(1−1−x)2y = \bigl(1 - \sqrt{1 - x}\bigr)^2. For x<12x < \tfrac12 we have x<1−xx < 1 - x, so 1−x1 - \sqrt{x} is the larger of the two and the bottom-left parabola is the higher. The two corners on the top edge do not reach this piece at all. The top-left family covers the points with x+1−y≤1\sqrt{x} + \sqrt{1 - y} \le 1, but in the piece y≤xy \le x, so x+1−y≥x+1−x\sqrt{x} + \sqrt{1 - y} \ge \sqrt{x} + \sqrt{1 - x}, which is at least 11 because its square is 1+2x(1−x)1 + 2\sqrt{x(1 - x)}. The top-right family needs 1−x+1−y≤1\sqrt{1 - x} + \sqrt{1 - y} \le 1, impossible when xx and yy are both at most 12\tfrac12, since each root is then at least 1/2≈0.71\sqrt{1/2} \approx 0.71. So the piece is bounded below by y=(1−x)2y = (1 - \sqrt x)^2 alone.

Where does it start? The parabola meets the diagonal y=xy = x where 1−x=x1 - \sqrt{x} = \sqrt{x}, that is, at x=14x = \tfrac14.

So the piece runs from x=14x = \tfrac14 to x=12x = \tfrac12, between the parabola below and the diagonal above. Its area is ∫1/41/2(x−(1−x)2) dx  =  ∫1/41/2(2x−1) dx  =  [43x3/2−x]1/41/2  =  23−512.\begin{aligned} \int_{1/4}^{1/2} \Bigl(x - \bigl(1 - \sqrt{x}\bigr)^2\Bigr)\,dx &\;=\; \int_{1/4}^{1/2} \bigl(2\sqrt{x} - 1\bigr)\,dx \\ &\;=\; \Bigl[\tfrac43 x^{3/2} - x\Bigr]_{1/4}^{1/2} \;=\; \frac{\sqrt2}{3} - \frac{5}{12} . \end{aligned} Eight such pieces make up the uncovered region, and the square has area 11, so  82−103  ≈  0.4379, or about 43.79% of the loom. \boxed{\ \frac{8\sqrt{2} - 10}{3} \;\approx\; 0.4379, \text{ or about } 43.79\% \text{ of the loom}. \ }

The computation

The edge-finding function from The computation above gives, at each column xx, how far up from the bottom edge the bottom-left family reaches. The bottom-right family reaches edge(1−x)\mathrm{edge}(1 - x), and by the up–down mirror symmetry the top two families reach down by the same amounts. So the uncovered length of the column is 1−2max⁡(edge(x),edge(1−x))1 - 2\max\bigl(\mathrm{edge}(x), \mathrm{edge}(1 - x)\bigr), or nothing if that is negative. Adding these lengths over 4,0004{,}000 thin columns gives the area.

M = 4000                       # columns, midpoint rule
white = 0.0
for k in range(M):
    x = (k + 0.5) / M
    low = max(edge(x), edge(1 - x))   # covered from below
    white += max(0.0, 1 - 2 * low) / M  # and, alike, above
print(f"extra credit: white fraction = {white:.5f}")

It prints

extra credit: white fraction = 0.43790
Report an error on this page

Reports are stored by Netlify. See the privacy note.