# Knife inside the square [closed]

A square of side $$n$$ is drawn in the sand. A knife of length $$k$$ is thrown into the square. The tip of the knife lands inside the square, and then the knife falls down to the ground in a random direction.

The location of the tip of the knife is uniformly distributed within the square, and the direction in which the knife falls to the ground is uniformly distributed in $$(0,2\pi]$$.

What is the probability that the entire length of the knife now lies inside the square? What happens when we replace the square with a circle of diameter $$n$$?

• It's very close to Buffon's needle problem. Commented Apr 8, 2020 at 12:07
• The tip may or may not fall in the square when thrown. If forced to fall into the square, then it is not a probability problem. Commented Apr 8, 2020 at 12:55
• The tip is forced to fall into the square and lands on a random point inside the square. Commented Apr 8, 2020 at 13:14
• We need information about the probability distribution of the tip inside the square. Equidistribution appears unrealistic. There is no obvious distribution that we could assume that would model someone aiming for the square and being guaranteed to hit it. Equidistribution would become more realistic if you had a large square grid, since then the knife tip could be guaranteed to land in a square, and you could use that square for the rest of the consideration.
– MvG
Commented Apr 8, 2020 at 13:22
• Perhaps it would be better phrased as something like "… is thrown onto the beach. If the tip of the knife lands inside the square …", making every point within the square equally likely. Without that information, the question isn't answerable. Commented Apr 8, 2020 at 13:57

We will only cover the first question of throwing a knife to a square in detail.

Choose a coordinate system so that the square is $$[0,n]^2$$. Let

• $$p, q$$ be the landing positions for knife's tip and end.
• $$\theta$$ be the angle between $$x$$-axis and knife's body. i.e. $$q - p = k_\theta \stackrel{def}{=} ( k \cos\theta, k \sin\theta )$$
• For any expression, let $$(\cdots)_{+} = \max(\cdots,0)$$ be a short hand of its positive part.
• Let $$\mathcal{E}$$ be the event for the whole knife to lie within the square.

Since the square is convex, $$\mathcal{E}$$ is true if and only if $$p , q \in [0,n]^2$$. This is equivalent to $$p$$ lies within a $$(n - k|\cos\theta|)_{+} \times (n - k|\sin\theta|)_{+}$$ rectangle. For example, when $$\theta \in [0,\frac{\pi}{2}]$$, \begin{align} p, q \in [0,n]^2 & \iff p \in [0,n]^2 \cap [ -k \cos\theta, n - k\cos\theta] \times [ -k \sin\theta, n - k\sin\theta]\\ & \iff p \in [0,n-k\cos\theta]\times[0,n-k\sin\theta]\end{align}

For general $$\theta$$, the conditional probability for event $$\mathcal{E}$$ is

$${\bf P}[\mathcal{E} | \theta ] = \left(1 - \frac{k}{n}|\cos\theta|\right)_{+}\left(1 - \frac{k}{n}|\sin\theta|\right)_{+}$$

Let $$\alpha = \begin{cases} 0, & k \le n\\ \cos^{-1}\frac{n}{k}, & n < k < \sqrt{2} n\\ \frac{\pi}{4}, & \sqrt{2} n \le k \end{cases}$$, the desired probability equals to

\begin{align} {\bf P}[\mathcal{E}] = & \frac{1}{2\pi} \int_0^{2\pi} {\bf P}[\mathcal{E} | \theta ] d\theta\\ = & \frac{1}{2\pi}\int_0^{2\pi}\left(1 - \frac{k}{n}|\cos\theta|\right)_{+}\left(1 - \frac{k}{n}|\sin\theta|\right)_{+} d\theta\\ = & \frac{2}{\pi}\int_0^{\frac{\pi}{2}} \left(1 - \frac{k}{n}\cos\theta\right)_{+}\left(1 - \frac{k}{n}\sin\theta\right)_{+} d\theta\\ = & \frac{2}{\pi}\int_\alpha^{\frac{\pi}{2}-\alpha} \left(1 - \frac{k}{n}\cos\theta\right)\left(1 - \frac{k}{n}\sin\theta\right) d\theta\\ = & \frac{2}{\pi}\left[ \theta - \frac{k}{n}(\sin\theta - \cos\theta) + \frac{k^2}{2n^2}\sin^2\theta \right]_{\alpha}^{\frac{\pi}{2}-\alpha}\\ = & \frac{2}{\pi}\left(\frac{\pi}{2} - 2\alpha - \frac{2k}{n}(\cos\alpha - \sin\alpha) + \frac{k^2}{2n^2}\cos(2\alpha)\right) \end{align}

When $$k \ge \sqrt{2}n$$, this evaluates to $$0$$ as expected. For the more interesting case $$k \le n$$, this simplifies to

$${\bf P}[\mathcal{E}] = 1 - \frac{4k}{\pi n} + \frac{k^2}{\pi n^2}$$

For the remaining case $$n < k < \sqrt{2}n$$, we have the horrible mess $${\bf P}[\mathcal{E}] = 1 - \frac{4}{\pi}\cos^{-1}\frac{n}{k} - \frac{4}{\pi n}\left(n - \sqrt{k^2-n^2}\right) + \frac{2n^2 - k^2}{\pi n^2}$$

Update

For the second question, choose a coordinate system so that the "circle" is $$B(0,\frac{n}{2})$$, the disk centered at origin with diameter $$n$$.

In order for $$p, q \in B(0,\frac{n}{2})$$, we need $$p \in B(0,\frac{n}{2}) \cap B(-k_\theta,\frac{n}{2})$$. For any fixed $$\theta$$, the conditional probability becomes

$${\bf P}[\mathcal{E}|\theta] = \frac{\verb/area/(B(0,\frac{n}{2}) \cap B(-k_\theta,\frac{n}{2}))}{\verb/area/(B(0,\frac{n}{2}))} = \frac{\verb/area/(B(0,\frac{n}{2}) \cap B(-k_0,\frac{n}{2}))}{ \verb/area/(B(0,\frac{n}{2}))}$$ Since the rightmost expression is independent of $$\theta$$, this is also the probability we seek. The end result is

$${\bf P}[\mathcal{E}] = \begin{cases} \frac{2}{\pi}\left(\cos^{-1}\frac{k}{n} - \frac{k}{n}\sqrt{1 - \frac{k^2}{n^2}}\right), & k < n\\ 0, & k \ge n \end{cases}$$

• Shouldn't the probability be zero if $k \geq n$? $n$ is the diameter here, not radius. Commented Apr 9, 2020 at 1:55
• @DmitryKamenetsky you are right, I misread the question and I'll fix that. Commented Apr 9, 2020 at 1:58