Skip to content
Vamshi Jandhyala

Books · The Riddler

Chapter 282

Can You Parallel Park Your Car?

The Riddler for October 9, 2020. The Express finds how often a row of parking spots forces a parallel-parking manoeuvre, and the Classic works out the turning radius of a very long truck.

Riddler Express

There are six parking spots in a row. You can avoid parallel parking whenever the rearmost (sixth) spot is open, or whenever two consecutive spots are open. If four of the six spots are occupied by cars in a uniformly random arrangement, what is the probability you must parallel park?

The Riddler, FiveThirtyEight, October 9, 2020(original post)

Solution

It is easiest to track the two empty spots. There are (62)=15\binom{6}{2} = 15 equally likely positions for them. You avoid parallel parking when the two empties are adjacent or when one of them is the sixth spot:

  • Adjacent empties: {1,2},{2,3},{3,4},{4,5},{5,6}\{1,2\}, \{2,3\}, \{3,4\}, \{4,5\}, \{5,6\}, which is 55 cases.

  • Sixth spot empty: {1,6},{2,6},{3,6},{4,6},{5,6}\{1,6\}, \{2,6\}, \{3,6\}, \{4,6\}, \{5,6\}, another 55 cases.

These overlap in the single case {5,6}\{5,6\}, so by inclusion–exclusion 5+51=95 + 5 - 1 = 9 arrangements need no parallel parking, leaving 159=615 - 9 = 6 that do. The probability is 615=25=40%.\frac{6}{15} = \boxed{\frac{2}{5} = 40\%}.

The computation

Encode it directly: enumerate the (62)\binom{6}{2} placements of the two empty spots and count those that force parallel parking.

import itertools
from fractions import Fraction
need, total = 0, 0
for empty in itertools.combinations(range(6), 2):   # 0-indexed spots
    total += 1
    adjacent = empty[1] - empty[0] == 1
    sixth_open = 5 in empty
    if not (adjacent or sixth_open):
        need += 1
print(Fraction(need, total))                        # 2/5

Six of the fifteen arrangements force a parallel park, a probability of 2/52/5.

Riddler Classic

A truck of length LL has a front axle and a rear axle (each pair of wheels treated as one). Question 1: if the front wheels can turn up to 3030^\circ either way but the rear wheels are fixed, what is the truck’s turning radius? Question 2: if the rear wheels can also turn up to 3030^\circ independently, what is the turning radius then?

The Riddler, FiveThirtyEight, October 9, 2020(original post)

Solution

The truck turns about an instantaneous centre, with each axle moving perpendicular to the line from that centre. A fixed rear axle must move tangent to its own circle, so the centre lies on the line through the rear axle, perpendicular to the truck. The front axle, turned by θ\theta, rides a circle whose radius (the turning radius of the front of the truck) follows from the right triangle with legs LL (the truck) and RrearR_{\text{rear}}: Rfront=Lsinθ,Rrear=Ltanθ.R_{\text{front}} = \frac{L}{\sin\theta}, \qquad R_{\text{rear}} = \frac{L}{\tan\theta}. With θ=30\theta = 30^\circ, sinθ=12\sin\theta = \tfrac12, so Rfront=L1/2=2L(Rrear=3L).R_{\text{front}} = \frac{L}{1/2} = \boxed{2L} \qquad (R_{\text{rear}} = \sqrt3\,L). Equivalently, doubling the truck to length 2L2L makes a chord that subtends 3030^\circ at the centre, a side of an inscribed regular hexagon, whose length equals the radius 2L2L.

For Question 2, steer the front and rear by 3030^\circ in opposite directions. The instantaneous centre sits on the perpendicular bisector of the truck; intersecting the two axle-perpendiculars puts both axles at distance R=L2sinθ=LR = \frac{L}{2\sin\theta} = \boxed{L} from the centre. Letting the rear steer too halves the turning radius, from 2L2L to LL: the truck now sweeps a circle as small as its own length.

The computation

Encode the bicycle-model radii and evaluate at θ=30\theta = 30^\circ.

import math
L, th = 1.0, math.radians(30)
print(round(L / math.sin(th), 4))        # Q1 front: 2.0   (= 2L)
print(round(L / math.tan(th), 4))        # Q1 rear : 1.7321 (= sqrt3 L)
print(round(L / (2 * math.sin(th)), 4))  # Q2 both : 1.0   (= L)

Steering only the front gives a turning radius of 2L2L; steering both axles tightens it to LL.