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 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: , which is cases.
Sixth spot empty: , another cases.
These overlap in the single case , so by inclusion–exclusion arrangements need no parallel parking, leaving that do. The probability is
The computation
Encode it directly: enumerate the 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 .
Riddler Classic
A truck of length 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 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 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 , rides a circle whose radius (the turning radius of the front of the truck) follows from the right triangle with legs (the truck) and : With , , so Equivalently, doubling the truck to length makes a chord that subtends at the centre, a side of an inscribed regular hexagon, whose length equals the radius .
For Question 2, steer the front and rear by in opposite directions. The instantaneous centre sits on the perpendicular bisector of the truck; intersecting the two axle-perpendiculars puts both axles at distance from the centre. Letting the rear steer too halves the turning radius, from to : the truck now sweeps a circle as small as its own length.
The computation
Encode the bicycle-model radii and evaluate at .
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 ; steering both axles tightens it to .