Generalize the problem by allowing the square to be a rectangle, which will also provide a solution for the common variant in which the dog runs to the front of the column and returns. Consider the length of the column to be one length unit and the length of a day to be one time unit. Let the width of the column be w length units. Then the speed of the column is one unit of length / one unit of time = one unit of speed. The dog runs at speed d. Divide the dog's run into four segments corresponding to its run along each of the four sides.

- The equations for each segment are
d * t1 = sqrt(w^2 + t1^2)

d * t2 = 1 + t2

d * t3 = sqrt(w^2 + t3^2)

d * t4 = 1 - t4

- Solving each of these for the times
t1^2 = w^2 / (d^2 - 1)

t2 = 1 / (d - 1)

t3^2 = w^2 / (d^2 - 1)

t4 = 1 / (d + 1)

- Since the times must sum to unity
- t1 + t2 + t3 + t4 = 1
- Substituting into this equation gives
- 2w / sqrt(d^2 - 1) + 1 / (d - 1) + 1 / (d + 1) = 1
- This simplifies into the quartic equation
- d^4 - 4d^3 + (2 - 4w^2) d^2 + 4d + 4w^2 + 1 = 0
- This has the real solution
d = (1 + 1/2 ((4 + 4/3 (((-1) + 2 w^2)) + ((4 2^(1/3) ((4 + 2 w^2 + w^4))))/(( 3 ((16 + 12 w^2 + 21 w^4 - 2 w^6 + 3 sqrt3 sqrt(16 w^4 + 8 w^6 + 11 w^8 - 4 w^10)))^(1/3))) + 2/3 2^(2/3) ((16 + 12 w^2 + 21 w^4 - 2 w^6 + 3 sqrt3 sqrt(16 w^4 + 8 w^6 + 11 w^8 - 4 w^10)))^(1/3))) + 1/2 ((8 + 8/3 (((-1) + 2 w^2)) - ((4 2 ^(1/3) ((4 + 2 w^2 + w^4))))/((3 ((16 + 12 w^2 + 21 w^4 - 2 w^6 + 3 sqrt3 sqrt(16 w^4 + 8 w^6 + 11 w^8

- 4 w^10)))^(1/3))) - 2/3 2^(2/3) ((16 + 12 w^2 + 21 w^4 - 2 w^6 + 3

sqrt3 sqrt(16 w^4 + 8 w^6 + 11 w^8 - 4 w^10)))^(1/3) + ((32 + 32 (((-1)

- 2 w^2))))/((4 ((4 + 4/3 (((-1) + 2 w^2)) + ((4 2^(1/ 3) ((4 + 2 w^2 +

w^4))))/((3 (( 16 + 12 w^2 + 21 w^4 - 2 w^6 + 3 sqrt3 sqrt(16 w^4 + 8 w^6 + 11 w^8 - 4 w^10)))^(1/3))) + 2/3 2^(2/3) ((16 + 12 w^2 + 21 w^4 - 2 w^6 + 3 sqrt3 sqrt(16 w^4 + 8 w^6 + 11 w^8 - 4 w^10)))^(1/3))))))))

- Two special cases are the line (w = 0)
- d = 1 + sqrt(2) = 2.41421
- and the square (w = 1)
- d = 4.18113
- If the width is twice the length
- d = 1 + sqrt(2) + 2 sqrt(2 + sqrt(2)) = 6.10973
- For larger widths, d asymptotically approaches the perimeter
- d = 2 (1 + w)