The Optimal Moving Sofa as r = f(α), t = g(α)

The optimal moving sofa (Gerver's, area 2.21953166887…) is exactly what the rotating-hallway model from the Math.SE question “Modelling the moving sofa” produces when r and t are made functions of α. This page gives those functions in closed form, reduces them to a simpler form that needs only two numbers, animates the motion, and checks the result. The shape is Gerver's sofa itself, not a new one; what is new is its description in that model's coordinates.

The model

The sofa stays still and the L-shaped hallway of width 1 turns around it. When the hallway has turned through α/2, its inner corner sits at

$$A(\alpha) = \bigl(r\cos\alpha,\; t\sin\alpha\bigr), \qquad 0 \le \alpha \le \pi.$$

The outer corner is A + √2·(cos(π/4 + α/2), sin(π/4 + α/2)). The sofa is whatever stays inside every position of the hallway, within the strip 0 ≤ y ≤ 1.

With r and t constant, the corner runs along an ellipse:

Corner pathrtSofa area
Circle (Hammersley's sofa)2/π = 0.6366202/π = 0.6366202/π + π/2 = 2.207416
Best ellipse (found in the Math.SE thread)0.6055140.6678342.217857
Optimal: r = f(α), t = g(α), this page0.594–0.6140.664–0.7102.219532 (Gerver's sofa)

The question suggested letting r and t depend on α. Any corner path that starts and ends on the floor y = 0 and crosses x = 0 at α = π/2 can be written as (f(α)·cos α, g(α)·sin α). The optimal path is of this kind, so the right choice of f and g gives the optimal sofa.

The turn, animated

The hallway turns 90° and carves the slab down to Gerver's sofa

Grey: the hallway; its inner corner rides on A(α) and traces the dark line. Blue: what still fits inside every hallway position so far. Pale blue: the final sofa.

Computed in your browser from the closed forms below. The turn takes 9 seconds, holds for 1.5 seconds, then repeats. Dragging the slider pauses it.

The answer: f(α) and g(α)

Both functions are mirror-symmetric about α = π/2, so they only need to be given on [0, π/2]. There they come in three pieces, split at α = 2φ ≈ 4.49° and α = 2θ ≈ 78.07°.

$$f(\pi-\alpha) = f(\alpha), \qquad g(\pi-\alpha) = g(\alpha)$$
ConstantValueRole
φ0.0391773647900836Hallway angle at which the inner corner first touches the sofa
θ0.6813015093827249Hallway angle at which the inner wall stops touching the sofa
a1.2103224220726888Piece 1
K₁0.4034408073575629Piece 1
b₁−0.5276245980267846Piece 2
b₂0.9202583851606376Piece 2
K₂−0.3054160633413417Piece 2
L₂0.4724066197508055Piece 2
c0.6260455228484659Piece 3
L₃0.8896264790032219Piece 3

Piece 1, 0 ≤ α ≤ 2φ. The sofa touches both outer walls and one inner wall; the inner corner is not yet touching it.

$$f(\alpha) = a + \frac{K_1 - \cos\frac{\alpha}{2} + \frac{1}{2}\sin\frac{\alpha}{2} - \frac{1}{4}\sin\alpha}{\cos\alpha}, \qquad g(\alpha) = a - \frac{1}{2\cos\frac{\alpha}{2}} - \frac{1}{4}\tan\frac{\alpha}{4}$$

Piece 2, 2φ ≤ α ≤ 2θ. The inner corner now touches too. Write s = α/2.

$$P = b_2 + b_1 s - \tfrac{1}{4}s^2, \qquad Q = 1 + b_1 - \tfrac{1}{2}s$$ $$f(\alpha) = \frac{P\cos s + Q\sin s + K_2}{\cos\alpha}, \qquad g(\alpha) = \frac{P\sin s - Q\cos s + L_2}{\sin\alpha}$$

Piece 3, 2θ ≤ α ≤ π/2. Only the inner corner and the two outer walls touch the sofa.

$$f(\alpha) = \frac{1}{\sqrt{2}}\left[\frac{c - \pi/4}{\sin(\pi/4 + \alpha/2)} + \frac{\pi/4 - \alpha/2}{\sin(\pi/4 - \alpha/2)}\right]$$ $$g(\alpha) = \frac{\sqrt{2}\,(c - \pi/4)\sin(\pi/4 + \alpha/2) - \sqrt{2}\,(\pi/4 - \alpha/2)\sin(\pi/4 - \alpha/2) + L_3}{\sin\alpha}$$

Values at the ends of [0, π/2]. At α = π/2 the second term of f in piece 3 is 0/0; it tends to 1.

αf(α)g(α)
00.6137632294a − 1/2 = 0.7103224221
π/2(c − π/4 + 1)/√2 = 0.5944274485√2(c − π/4) + L₃ = 0.6642678135

f and g have continuous first derivatives; their second derivatives jump at the four break points. φ and θ have no closed form: they are roots of two transcendental equations from Gerver's 1992 paper.

A simpler form of the same answer

f and g are the answer in the question's terms, but not the simplest way to write it. Dividing by cos α and sin α makes the formulas longer and creates the 0/0 at α = π/2. Following the corner in the hallway's own turning frame removes both, and the whole motion then rests on just two numbers, φ and θ.

The corner in the hallway's frame. Let τ = α/2 be the hallway's angle and Rτ the rotation by τ. Then

$$A(\alpha) = R_{\tau}\,u(\tau) + v, \qquad \tau = \frac{\alpha}{2}, \qquad R_\tau = \begin{pmatrix}\cos\tau & -\sin\tau\\ \sin\tau & \cos\tau\end{pmatrix},$$

with u and v from this table. The second half of the turn is the mirror image: if A(α) = (X, Y), then A(π − α) = (−X, Y).

Hallway angle τu(τ): the corner in the hallway's frameOffset v
0 ≤ τ ≤ φ(a cos τ − ¼ sin τ − 1, a sin τ + ¼ cos τ − ½)(K₁, ¼)
φ ≤ τ ≤ θ(b₂ + b₁τ − ¼τ², ½τ − b₁ − 1)(K₂, L₂)
θ ≤ τ ≤ π/4(c − τ, c − π/2 + τ)(0, L₃)

In the middle phase u is linear in τ. The question's functions follow as f = X/cos α and g = Y/sin α.

Two numbers instead of ten. The eight constants other than φ and θ are fixed by requiring the path to be smooth at τ = φ and τ = θ. Those are eight linear equations, and they give the constants explicitly, in this order:

$$c = \frac{\tfrac12 + \bigl(2 - \varphi - \tfrac{\pi}{4}(\theta - \varphi) + \tfrac14(\theta^2 - \varphi^2)\bigr)\sin\varphi - \bigl(\varphi + \tfrac32 - \tfrac{\pi}{2}\bigr)\cos\varphi}{\cos\varphi - \bigl(1 + \tfrac12(\theta - \varphi)\bigr)\sin\varphi}$$ $$a = \frac{c + \varphi + \tfrac32 - \tfrac{\pi}{2} - \tfrac12\cos\varphi}{2\sin\varphi}$$ $$b_1 = \tfrac12\bigl(\tfrac{\pi}{2} - 2 - c\bigr), \qquad b_2 = c - \theta + \tfrac12 - b_1\theta + \tfrac14\theta^2$$ $$h = \tfrac12\bigl(c + \theta - \tfrac{\pi}{2}\bigr), \qquad m = a\cos\varphi - \tfrac14\sin\varphi - \tfrac12$$ $$K_2 = -\tfrac12\cos\theta - h\sin\theta, \qquad K_1 = K_2 + m\cos\varphi + \tfrac14\sin\varphi$$ $$L_2 = \tfrac14 + \tfrac14\cos\varphi - m\sin\varphi, \qquad L_3 = L_2 + \tfrac12\sin\theta - h\cos\theta$$

The two numbers. φ and θ are fixed by one geometric condition: the point where the inner corner first touches the sofa (τ = φ) is the point where the other inner wall starts touching it (τ = π/2 − θ). As an equation between two points,

$$A(2\varphi) = R_{\pi/2-\theta}\begin{pmatrix} c + \theta - \pi/2 \\ -1 \end{pmatrix} + \begin{pmatrix} 0 \\ L_3 \end{pmatrix}.$$

With the constants above substituted, these are two equations in φ and θ. Solved numerically from a rough start near (0.04, 0.7), they give φ = 0.0391773647900836… and θ = 0.6813015093827249…; neither is known in closed form. From these two numbers the formulas reproduce all eight constants to 40 digits, and the turning-frame path matches f and g to 4 × 10⁻¹⁶ (code/simple_form.py).

How f and g vary

Optimal r dips 3.2% and t 6.5% toward mid-turn, around the best ellipse

Dashed: the best constant ellipse. Dotted: where the parts of the hallway touching the sofa change (α = 4.49°, 78.07°, 101.93°, 175.51°).

Computed from the closed forms above.

Neither function is constant, so no ellipse is optimal. Letting r and t follow f and g adds 0.0017 to the best ellipse's area.

The shape

The optimal sofa, with the inner corner's path and the hallway at α = 90°

Dashed: the path of the inner corner A(α), dots every 30°. Grey: the hallway at α = 90°; its outer walls touch the sofa's shoulders and its inner corner touches the top of the arch.

Computed from the closed forms above.

From α = 4.49° to 175.51° the corner's path is the sofa's arch. The arch's two feet, where it meets the floor near x = ±0.61 to ±0.81, are shaped by the inner walls instead.

Where the formulas come from

The formulas are Romik's exact description of Gerver's sofa (2018), moved into the question's coordinates. Romik uses the same construction as the question: the sofa is fixed, and the hallway's inner corner follows a “rotation path” x(τ) while the hallway turns through τ ∈ [0, π/2].

  1. Gerver's motion has five phases, set by which walls touch the sofa (table below). In each phase, maximal area forces the path to satisfy a linear ODE, which Romik solves in closed form.
  2. Joining the five solutions smoothly, with left–right symmetry and the two contact conditions at the phase changes, gives 22 equations in 22 constants. Solving them to 40 digits reproduces Romik's table.
  3. In the question the hallway turns by α/2, so α = 2τ. Shifting x by κ₃,₁ (Romik's path starts at the origin) puts the path symmetric about x = 0. Then f = X/cos α and g = Y/sin α, where (X, Y) is the corner.
  4. In Romik's notation the constants are a = a₁, b₁, b₂, c = c₁, K₁ = 1 − a₁ − κ₃,₁, K₂ = κ₂,₁ − κ₃,₁, L₂ = κ₂,₂ and L₃ = κ₃,₂.
α (degrees)What touches the sofaFormula
0 – 4.49Both outer walls, one inner wallPiece 1
4.49 – 78.07Inner corner, both outer walls, one inner wallPiece 2
78.07 – 101.93Inner corner, both outer wallsPiece 3
101.93 – 175.51Inner corner, both outer walls, the other inner wallPiece 2, mirrored
175.51 – 180Both outer walls, the other inner wallPiece 1, mirrored

The answer is unique. Both outer walls touch Gerver's sofa at every angle, and two perpendicular walls pressed against a shape fix the hallway's position. So no other f and g give this sofa.

Checks

Because f and g describe Gerver's sofa, the area they produce must equal Gerver's constant, 2.2195316689. Computed directly from f and g with the question's construction, it is 2.2195316686, a difference of 3 × 10⁻¹⁰.

CheckResultReference value
Closed forms vs. the 40-digit solver, at 2,001 anglesLargest difference 8 × 10⁻¹⁶0
φ and θ substituted into Gerver's original equationsResiduals below 2 × 10⁻²⁶0
Area from f and g2.21953166862.2195316689 (Gerver)
Same area method, circle r = t = 2/π2.207416162.20741610 (exact)
Same area method, best ellipse2.2178569942.217856998 (Math.SE thread)

The area method slices the sofa vertically. For each slice it finds the lowest outer wall and the highest inner wall over all hallway angles, refining the angle by golden-section search. It then integrates the slice heights by Gauss–Legendre quadrature over 2,000 subintervals. Sampling the hallway at a fixed set of angles instead would overestimate the area, because it misses the positions between samples; optimizing the angle for each slice avoids that. The scripts are in the code folder.

Conclusion

The question's idea works: letting r and t depend on α captures the optimal sofa exactly. The functions f and g are elementary closed forms in three pieces. Their ten constants reduce to two, φ and θ, and in the hallway's turning frame the formulas become much shorter.

Sources