jane st [2024-11-01 Fri]

prompt

Two random points, one red and one blue, are chosen uniformly and independently from the interior of a square. To ten decimal places1, what is the probability that there exists a point on the side of the square closest to the blue point that is equidistant to both the blue point and the red point?

(Or, if you want to send in the exact answer, that’s fine too!) ↩

think about the shape of satisfying points

for a point chosen a what is the space B of points that satisfy?

Via symmetry we will only evaluate B for values of a bounded by x=0, y = x, and y = 1 - x and then will multiply by 4 at the end.

B is the region where the perpindicular bisector of a and b crosses the side closest to a. this leads to B that is the XOR of the quarter circles defined by the radius of a to <0,0> and a to <0,1>.

map out the space to get an intuition

  reset
  # Set the range for x and y axes
  set xrange [0:1]
  set yrange [0:1]
  set xlabel "x"
  set ylabel "y"
  set size ratio -1
  set margin 0
  dynamic_title = "Range B for x_a = " . x_a . " and y_a = " . y_a
  set title dynamic_title
  set key off

  x_a = x_a
  y_a = y_a

  r_0 = x_a**2 + y_a**2
  r_1 = x_a**2 + (1 - y_a)**2

  f1(x) = (x <= x_a) ? sqrt(r_0 - x**2) : 1/0
  f2(x) = (x <= x_a) ? 1 - sqrt(r_1 - x**2) : 1/0
  f3(x) = (x > x_a) ? 1 - sqrt(r_1 - x**2) : 1/0
  f4(x) = (x > x_a) ? sqrt(r_0 - x**2) : 1/0

  set style fill solid 0.2 noborder

  set arrow from 0,0 to x_a,y_a nohead lw 2 lc rgb "red"
  set arrow from 0,0 to sqrt(r_0),0 nohead lw 2 lc rgb "red"
  set arrow from 0,0 to 0,sqrt(r_0) nohead lw 2 lc rgb "red"
  set label "r_0" at x_a, y_a offset -0.1,-0.7 tc rgb "red" font ",12"

  set arrow from 0,1 to x_a,y_a nohead lw 2 lc rgb "blue"
  set arrow from 0,1 to sqrt(r_1),1 nohead lw 2 lc rgb "blue"
  set arrow from 0,1 to 0,1-sqrt(r_1) nohead lw 2 lc rgb "blue"
  set label "r_1" at x_a, y_a offset -0.1,0.7 tc rgb "blue" font ",12"

  plot \
	   f1(x) with filledcurves y1=1 lc rgb "#add8e6" notitle, \
	   f2(x) with filledcurves y1=0 lc rgb "#add8e6" notitle, \
	   f3(x) with filledcurves y1=1 lc rgb "#add8e6" notitle, \
	   f4(x) with filledcurves y1=0 lc rgb "#add8e6" notitle

test_0.svg

test_1.svg

test_2.svg

break up the piecewise shape

reset
set xrange [0:1]
set yrange [0:1]
set xlabel "x"
set ylabel "y"
set size ratio -1
set margin 0
set key off

dynamic_title = "Range B for x_a = " . x_a . " and y_a = " . y_a
set title dynamic_title

x_a = x_a
y_a = y_a
r_0 = x_a**2 + y_a**2
r_1 = x_a**2 + (1 - y_a)**2

f1(x) = (x <= x_a) ? sqrt(r_0 - x**2) : 1/0
f2(x) = (x <= x_a) ? 1 - sqrt(r_1 - x**2) : 1/0
f3(x) = (x > x_a) ? 1 - sqrt(r_1 - x**2) : 1/0
f4(x) = (x > x_a) ? sqrt(r_0 - x**2) : 1/0

set label "a" at x_a/2, 0.82 rgb "black" font ",12"
set label "b" at 0.6, 0.82 tc rgb "black" font ",12"
set label "c" at x_a/2, 0.18 tc rgb "black" font ",12"
set label "d" at 0.6, 0.18 tc rgb "black" font ",12"

set style fill solid 0.2 noborder

set label "(u,v)" at x_a, y_a offset 1,0 tc rgb "white" font ",12"
plot \
	 f1(x) with filledcurves y1=1 lc rgb "#add8e6" notitle, \
	 f2(x) with filledcurves y1=0 lc rgb "#add8e6" notitle, \
	 f3(x) with filledcurves y1=1 lc rgb "#add8e6" notitle, \
	 f4(x) with filledcurves y1=0 lc rgb "#add8e6" notitle

Since the prompt calls for 10 decimal places we will assume a closed form solution exists.

Integration by polar or cartesian coordinates yields a closed form solution for almost none of the consituent shapes.

I spent a lot of time trying to use Aabcd = AC0/4 + AC1/4 - 2A(half lens between a and c) which never went anywhere.

via symmetry

\begin{aligned} &= 4\iint_{\triangleright} A_{abcd}\\ &= 8\iint_{\triangleright} A_{ad}\\ \end{aligned}
reset
set xrange [0:1]
set yrange [0:1]
set xlabel "x"
set ylabel "y"
set size ratio -1
set margin 0
set key off

dynamic_title = "A_{ad} for x_a = " . x_a . " and y_a = " . y_a
set title dynamic_title

x_a = x_a
y_a = y_a
r_0 = x_a**2 + y_a**2
r_1 = x_a**2 + (1 - y_a)**2

f1(x) = (x <= x_a) ? sqrt(r_0 - x**2) : 1/0
f2(x) = (x <= x_a) ? 1 - sqrt(r_1 - x**2) : 1/0
f3(x) = (x > x_a) ? 1 - sqrt(r_1 - x**2) : 1/0
f4(x) = (x > x_a) ? sqrt(r_0 - x**2) : 1/0

set label "a" at x_a/2, 0.82 rgb "black" font ",12"
set label "d" at 0.6, 0.18 tc rgb "black" font ",12"

set style fill solid 0.2 noborder

set label "(u,v)" at x_a, y_a offset 1,0 tc rgb "white" font ",12"
plot \
	 f1(x) with filledcurves y1=1 lc rgb "#add8e6" notitle, \
	 f4(x) with filledcurves y1=0 lc rgb "#add8e6" notitle

defining some more sub shapes

a

subshapes_2.svg

subshapes_3.svg

subshapes_4.svg

d

subshapes_5.svg

use our sub-shapes

I will argue that Aa = Aa0 - Aa1 - Aa2.

I will argue that Ad = Ad0 - Aa2.

and AC0/4 = Aa1 + Ad0

where C0 is the circle defined by r0

the math

\begin{aligned} &= 4\iint_{\triangleright} A_{abcd}\\ &= 8\iint_{\triangleright} A_{ad}\\ &= 8\iint_{\triangleright} (A_{a_0} - A_{a_1} - A_{a_2}) + (A_{d_0} - A_{a_2}) \\ &= 8\iint_{\triangleright} A_{a_0} - 2A_{a_2} - A_{a_1} + A_{d_0} \\ &= 8\iint_{\triangleright} A_{a_0} - 2A_{a_2} - \frac{A_{C_0}}{4} + 2A_{d_0} \\ &= 8\iint_{\triangleright} (A_{a_0} - 2A_{a_2} - \frac{A_{C_0}}{4}) + 16\iint_{\triangleright} A_{d_0} \\ &= 8\int_{0}^{1/2}\int_{u}^{1-u} f(u,v) du dv + 16\int_{\frac{\pi}{4}}^{\frac{\pi}{2}}\int_{0}^{\frac{1}{\sin{\theta} + \cos{\theta}}} f(r, \theta) r dr d\theta \\ &= 8\int_{0}^{1/2}\int_{u}^{1-u} u - uv - \frac{\pi}{4}(u^2 + v^2) dv du + 16\int_{\frac{\pi}{4}}^{\frac{\pi}{2}}\int_{0}^{\frac{1}{\sin{\theta} + \cos{\theta}}} (\frac{1}{2}\theta r^2) r dr d\theta \\ &= 8\int_{0}^{1/2} uv - \frac{1}{2}uv^2 - \frac{\pi}{4}u^2v - \frac{\pi}{12}v^3 \big|_{u}^{1-u} du + 8\int_{\frac{\pi}{4}}^{\frac{\pi}{2}}\int_{0}^{\frac{1}{\sin{\theta} + \cos{\theta}}} \theta r^3 dr d\theta \\ &= 8\int_{0}^{1/2} u(1-u) - u^2 - \frac{1}{2}u(1-u)^2 + \frac{1}{2}u^3 - \frac{\pi}{4}u^2(1-u) + \frac{\pi}{4}u^3 - \frac{\pi}{12}(1-u)^3 + \frac{\pi}{12}u^3 du + 2\int_{\frac{\pi}{4}}^{\frac{\pi}{2}} \theta r^4 \big|_0^{\frac{1}{\sin{\theta} + \cos{\theta}}} d\theta \\ &= \frac{2}{3}\int_{0}^{1/2} 12u - 12u^2 - 12u^2 - 6u + 12u^2 - 6u^3 + 6u^3 - 3\pi u^2 + 3\pi u^3 + 3\pi u^3 - \pi + 3\pi u - 3\pi u^2 + \pi u^3 + \pi u^3 du + 2\int_{\frac{\pi}{4}}^{\frac{\pi}{2}} \frac{\theta}{(\sin{\theta} + \cos{\theta})^4} d\theta \\ &= \frac{2}{3}\int_{0}^{1/2} (-6 + 6 + 3\pi + 3\pi + \pi + \pi)u^3 + (-12 - 12 + 12 - 3\pi - 3\pi)u^2 + (12 - 6 + 3\pi)u - \pi du + 2\frac{4\pi + 2\ln{2} - 2\ln{4} - 1}{24} \\ &= \frac{2}{3}\int_{0}^{1/2} (8\pi)u^3 + (-6\pi - 12)u^2 + (3\pi + 6)u - \pi du + \frac{4\pi + 2\ln{2} - 2\ln{4} - 1}{12} \\ &= \frac{2}{24}\int_{0}^{1/2} (64\pi)u^3 + (-48\pi - 96)u^2 + (24\pi + 48)u - 8\pi du + \frac{4\pi + 2\ln{2} - 2\ln{4} - 1}{12} \\ &= \frac{1}{12}((16\pi)u^4 + (-16\pi - 32)u^3 + (12\pi + 24)u^2 - (8\pi)u)\big|_0^{\frac{1}{2}} + \frac{4\pi + 2\ln{2} - 2\ln{4} - 1}{12} \\ &= \frac{\pi + (-2\pi - 4) + (3\pi + 6) - (4\pi)}{12} + \frac{4\pi + 2\ln{2} - 2\ln{4} - 1}{12} \\ &= \frac{-2\pi + 2}{12} + \frac{4\pi + 2\ln{2} - 2\ln{4} - 1}{12} \\ &= \frac{2\pi + 1 + 2\ln{2} - 2\ln{4}}{12} \\ \end{aligned}