Sunday, February 23, 2025

Extra Credit LearnedLeague Defensive Efficiency

Now suppose your opponent is equally likely to get one, two, three, four, or five questions correct. As before, you randomly apply the six point values $(0, 1, 1, 2, 2, 3)$ to the six questions. What is the probability that your defensive efficiency will be greater than $50$ percent?

In the classic problem we costructed a table for $N_2.$ Here we need to then construct similar tables for $N_1$, $N_3,$ $N_4$ and $N_5.$ For $i=1,$ there is exactly one way apiece to score zero or $3$ and two ways apiece to score $1$ or $2$, so we have the following table:

$N_1$ $DE_1$ $\mathbb{P} \{ N_1 \}$
$0$ $1$ $\frac{1}{6}$
$1$ $\frac{2}{3}$ $\frac{1}{3}$
$2$ $\frac{1}{3}$ $\frac{1}{3}$
$3$ $0$ $\frac{1}{6}$

Similarly, we can construct the other tables as follows:

$N_3$ $DE_3$ $\mathbb{P} \{ N_3 \}$
$2$ $1$ $\frac{1}{20}$
$3$ $\frac{4}{5}$ $\frac{1}{5}$
$4$ $\frac{3}{5}$ $\frac{1}{4}$
$5$ $\frac{2}{5}$ $\frac{1}{4}$
$6$ $\frac{1}{5}$ $\frac{1}{5}$
$7$ $0$ $\frac{1}{20}$
$N_4$ $DE_4$ $\mathbb{P} \{ N_4 \}$
$4$ $1$ $\frac{2}{15}$
$5$ $\frac{3}{4}$ $\frac{1}{5}$
$6$ $\frac{1}{2}$ $\frac{1}{3}$
$7$ $\frac{1}{4}$ $\frac{1}{5}$
$8$ $0$ $\frac{2}{15}$
$N_5$ $DE_5$ $\mathbb{P} \{ N_5 \}$
$6$ $1$ $\frac{1}{6}$
$7$ $\frac{2}{3}$ $\frac{1}{3}$
$8$ $\frac{1}{3}$ $\frac{1}{3}$
$9$ $0$ $\frac{1}{6}$

In particular we see that $$\mathbb{P} \{ DE_i \gt \frac{1}{2} \} = \begin{cases} \frac{1}{2}, &\text{if $i \in \{1,3,5\}$;}\\ \frac{1}{3}, &\text{if $i \in \{2,4\}$.}\end{cases}$$ So if your opponent answers $I$ questions where $I$ is uniformly distributed on the set $\{1, 2,3,4,5\},$ then the probability of having a defensive efficiency score greater than $50\%$ is equal to \begin{align*} \mathbb{P} \{ DE_I \gt \frac{1}{2} \} &= \sum_{i=1}^5 \mathbb{P} \{ DE_i \gt \frac{1}{2} \} \mathbb{P} \{ I = i \} \\ &= \frac{1}{5} \sum_{i=1}^5 \mathbb{P} \{ DE_i \gt \frac{1}{2} \} \\ &= \frac{1}{5} \left( \frac{1}{2} + \frac{1}{3} + \frac{1}{2} + \frac{1}{3} + \frac{1}{2} \right) \\ &= \frac{13}{30} = 43.\bar{3}\%.\end{align*}

LearnedLeague Defensive Efficiency

Every day, you and your opponent for the day are presented with the same six trivia questions. You each do your best to answer these, and you assign point values for your opponent, without knowing (until the following day) which questions your opponent answered correctly. You must assign point values of $0, 1, 1, 2, 2,$ and $3$ to the six questions.

Now, when someone answers three questions correctly, like my opponent just hypothetically did, the fewest points they can earn is $0 + 1 + 1 = 2,$ while the most points they can earn is $2 + 2 + 3 = 7.$ The fact that they got $4$ points wasn’t great (from my perspective), but wasn’t terrible. In LearnedLeague, my defensive efficiency is defined as the maximum possible points allowed minus actual points allowed, divided by the maximum possible points allowed minus the minimum possible points allowed. Here, that was $(7−4)/(7−2),$ which simplified to $3/5,$ or $60$ percent.

By this definition, defensive efficiency ranges somewhere between 0 and 100 percent. (That is, assuming it’s even defined—which it’s not when your opponent gets zero questions right or all six questions right.)

Suppose you know for a fact that your opponent will get two questions right. However, you have absolutely no idea which two questions these are, and so you randomly apply the six point values to the six questions.

What is the probability that your defensive efficiency for the day will be greater than $50$ percent?

For each $i = 1, 2, 3, 4, 5,$ let's $N_i$ be the random score of your opponent, conditioned on getting exactly $i$ answers correct. Given the set of weights we see that \begin{align*}0 \leq & N_1 \leq 3 \\ 1 \leq & N_2 \leq 5 \\ 2 \leq & N_3 \leq 7 \\ 4 \leq & N_4 \leq 8 \\ 6 \leq & N_5 \leq 9,\end{align*} though the distributions are not uniformly distributed. In this case, $$DE_i(N_i) = \begin{cases} \frac{3 - N_1}{3}, &\text{if $i=1;$}\\ \frac{5 - N_2}{4}, &\text{if $i=2;$}\\ \frac{7-N_3}{5}, &\text{if $i=3;$}\\ \frac{8-N_4}{4}, &\text{if $i=4;$}\\ \frac{9 - N_5}{3}, &\text{if $i=5.$}\end{cases}$$

The only thing that we need to do is determine the probabilities for each value of $i=2$.

Since there are two instances of the weight $1,$ there are two possible outcomes that give a total score of $N_2 = 1.$ Let's call them $(0,1_A)$ and $(0, 1_B).$ Similarly, there are three possible outcomes that give a total score of $N_2 = 2$, that is $(0,2_A),$ $(0,2_B)$ and $(1_A, 1_B).$ There are five different ways to get an outcome of $N_2=3$: $(0,3)$, $(1_A, 2_A)$, $(1_B, 2_A)$, $(1_A, 2_B),$ and $(1_B, 2_B).$ There are three was to get $N_2=4$: $(1_A, 3)$, $(1_B, 3)$ and $(2_A, 2_B).$ Finally, we have two was to get $N_2=5$: $(2_A, 3)$ and $(2_B, 3).$ There are $15$ possible outcomes, so we can construct the following table:

$N_2$ $DE_2$ $\mathbb{P} \{ N_2 \}$
$1$ $1$ $\frac{2}{15}$
$2$ $\frac{3}{4}$ $\frac{1}{5}$
$3$ $\frac{1}{2}$ $\frac{1}{3}$
$4$ $\frac{1}{4}$ $\frac{1}{5}$
$5$ $0$ $\frac{2}{15}$

Based on the table above, we see that if your opponent will answer two questions correctly, then the probability of having a defensive efficiency greater than $50\%$ is $$\mathbb{P} \{ DE_2 \gt \frac{1}{2} \} = \mathbb{P} \{ N_2 \leq 2 \} = \frac{2}{15} + \frac{1}{5} = \frac{1}{3}.$$

Sunday, February 16, 2025

Owner of a squished heart

You can generate a heart shape by drawing a unit square (i.e., a square with side length $1$), and then attaching semicircles (each with radius $1/2$) to adjacent edges, as shown in the diagram below:

What is the radius of the smallest circle that contains this heart shape?

Let's define our frame of reference. Let's assume that the center of this unit square is the origin and that as in the figure above, the sides of the square make angle of $\frac{\pi}{4}$ with respect to the $x$- and $y$-axes. In particular, the lowest corner of the unit square is located at $(0, -\frac{\sqrt{2}}{2})$. The two semi-circles added on the upper sides of the square are centered at $(\pm\frac{\sqrt{2}}{4}, \frac{\sqrt{2}}{4})$. From symmetry, we will focus on the one in the first quadrant and parameterize its boundary as $$\left( \frac{\sqrt{2}}{4} + \frac{1}{2} \cos \left( \theta - \frac{\pi}{4} \right), \frac{\sqrt{2}}{4} + \frac{1}{2} \sin \left(\theta - \frac{\pi}{4}\right) \right),$$ for $0 \leq \theta \leq \pi.$

Due to symmetry, any smallest inscribing circle should be centered at some point $(0,h)$ on the positive $y$-axis. Then we can set up the problem in the following way. Obviously in order for every point in the semi-circle centered at $(\frac{\sqrt{2}}{4}, \frac{\sqrt{2}}{4})$ inside a circle centered at $(0,h)$ we would need to have the radius be \begin{align*}R(h) &= \max_{\theta \in [0,\pi]} \sqrt{ \left( \frac{\sqrt{2}}{4} + \frac{1}{2} \cos \left( \theta - \frac{\pi}{4} \right) \right)^2 + \left( \frac{\sqrt{2}}{4} - h + \frac{1}{2} \sin \left( \theta - \frac{\pi}{4}\right) \right)^2} \\ &= \max_{\theta \in [0,\pi]} \sqrt{ \frac{1}{8} + \frac{\sqrt{2}}{4} \cos \left( \theta - \frac{\pi}{4} \right) + \frac{1}{4} \cos^2 \left( \theta - \frac{\pi}{4} \right) + \left( \frac{\sqrt{2}}{4} - h \right)^2 + \left( \frac{\sqrt{2}}{4} - h \right) \sin \left( \theta - \frac{\pi}{4} \right) + \frac{1}{4} \sin^2 \left( \theta - \frac{\pi}{4} \right) } \\ &= \max_{\theta \in [0,\pi]} \sqrt{ \frac{3}{8} + \left( \frac{\sqrt{2}}{4} - h \right)^2 + \frac{\sqrt{2}}{4} \cos \left( \theta - \frac{\pi}{4} \right) + \left( \frac{\sqrt{2}}{4} - h \right) \sin \left( \theta - \frac{\pi}{4} \right) }.\end{align*} Since square roots are monotonic and several of the terms are constant with respect to $\theta$, the optimal value of \theta in to obtain $R(h)$ will be equivalent to the optimizer of the function $$f_h(\theta) = \frac{\sqrt{2}}{4} \cos \left( \theta - \frac{\pi}{4} \right) + \left( \frac{\sqrt{2}}{4} - h \right) \sin \left( \theta - \frac{\pi}{4} \right)$$ on $\theta \in [0,\pi].$ Taking the derivative with respect to $\theta$ and setting equal to zero we see that the only critical value of $f_h$ in that interval satisfies $$-\frac{\sqrt{2}}{4} \sin \left( \theta^* - \frac{\pi}{4} \right) + \left( \frac{\sqrt{2}}{4} - h \right) \cos \left( \theta^* - \frac{\pi}{4} \right) = 0,$$ or equivalently $$\tan\left(\theta^* - \frac{\pi}{4}\right) = 1 - 2\sqrt{2}h,$$ which implies that \begin{align*}\cos \left(\theta^* -\frac{\pi}{4} \right) &= \frac{1}{\sqrt{1 + (1 - 2\sqrt{2}h)^2}} \\ \sin \left( \theta^* - \frac{\pi}{4} \right) &= \frac{1-2\sqrt{2}h}{\sqrt{1 + (1 - 2\sqrt{2}h)^2}},\end{align*} since $\cos ( \tan^{-1} x ) = \frac{1}{\sqrt{1+x^2}}$ and $\sin ( \tan^{-1} x ) = \frac{x}{\sqrt{1+x^2}}.$ Plugging this back into $f_h,$ we get \begin{align*}f_h(\theta^*) &= \frac{\sqrt{2}}{4} \frac{1}{\sqrt{1 + (1-2\sqrt{2}h)^2}} + \left(\frac{\sqrt{2}}{4} - h\right) \frac{1 - 2\sqrt{2}h}{\sqrt{1 + (1-2\sqrt{2}h)^2}} \\ &= \frac{ \sqrt{2} }{4} \frac{ 1 + (1-2\sqrt{2}h)^2 }{ \sqrt{ 1+ (1-2\sqrt{2}h)^2}} \\ &= \frac{\sqrt{2}}{4} \sqrt{1 + (1 - 2\sqrt{2}h)^2}.\end{align*} Plugging this value back into $R(h)$ we get $$R(h) = \sqrt{\frac{3}{8} + \frac{1}{8} (1 - 2\sqrt{2}h)^2 + \frac{\sqrt{2}}{4} \sqrt{1 + (1-2\sqrt{2}h)^2}}.$$

Now in order for the entire unit square to be contained within the circle, the lowest point $(0, -\frac{\sqrt{2}}{2})$ must also be less than or equal to $R(h)$ away from the center at $(0,h).$ In particular, if we want to have the inscribed within the circle we should have the $R(h)$ equal the distance between $(0, -\frac{\sqrt{2}}{2})$ and $(0,h),$ that is $h + \frac{\sqrt{2}}{2}.$ This leads to the equation $$h + \frac{\sqrt{2}}{2} = \sqrt{ \frac{3}{8} + \frac{1}{8} (1- 2\sqrt{2}h)^2 + \frac{\sqrt{2}}{4} \sqrt{ 1 + (1-2\sqrt{2}h)^2}}.$$ Squaring both sides yields the equivalent equation $$\left(h + \frac{\sqrt{2}}{2}\right)^2 = \frac{3}{8} + \frac{1}{8} \left( 1 - 2\sqrt{2}h \right)^2 + \frac{\sqrt{2}}{4} \sqrt{ 1 + (1 - 2\sqrt{2}h)^2 }$$ which is again equivalent to $$\frac{3}{2} \sqrt{2} h = \frac{\sqrt{2}}{4} \sqrt{1 + (1-2\sqrt{2}h)^2 }.$$ Squaring both sides again yield $$\frac{9}{2} h^2 = \frac{1}{8} \left( 1 + (1 - 2\sqrt{2}h)^2 \right) = h^2 - \frac{\sqrt{2}}{2} h + \frac{1}{4}$$ or equivalently $$\frac{7}{2} h^2 + \frac{\sqrt{2}}{2} h - \frac{1}{4} = 0.$$ Solving the quadratic in terms of $h$ leaves the only positive solution as $$h^* = \frac{-\frac{\sqrt{2}}{2} + \sqrt{ \frac{1}{2} - 4 \cdot \frac{7}{2} \cdot -\frac{1}{4}}}{2 \frac{7}{2}} = \frac{ -\frac{\sqrt{2}}{2} + \sqrt{ \frac{1}{2} + \frac{7}{2} }}{7} = \frac{ 2 - \frac{\sqrt{2}}{2} }{7} = \frac{4 - \sqrt{2}}{14}.$$ Therefore, the radius of the smallest circle that contains this heart shape is $$R(h^*) = \frac{4-\sqrt{2}}{14} + \frac{\sqrt{2}}{2} = \frac{4 - \sqrt{2} + 7 \sqrt{2}}{14} = \frac{4 + 6 \sqrt{2}}{14} = \frac{2 + 3\sqrt{2}}{7} \approx 0.89180581\dots.$$

Sunday, February 9, 2025

Spinning squares and the balls that bounce in them

Suppose you have a unit square that’s rotating about its center at a constant angular speed, and there’s a moving ball inside. The ball has a constant linear speed, and there’s no friction or gravity. When the ball hits an edge of the square, it simply reflects as though the square is momentarily stationary during the briefest of moments they’re in contact. Also, the ball is not allowed to hit a corner of the square—it would get jammed in that corner, a situation we prefer to avoid.

Suppose the ball travels on a periodic (i.e., repeating) path, and that it only ever makes contact with a single point on the unit square. What is the shortest distance the ball could travel in one loop of this path?

Take a unit square that is rotating at a constant angular speed, $\omega,$ where, without loss of generality, we assume that the sides of square are perpendicular to the $x$- and $y$-axes at time zero. Further assume that that for any $n \geq 2,$ there is a ball traveling at some fixed velocity $v_n$ in a periodic path with $n$ bounces against the side of the spinning square. Since the point of contact is tracing out a circle of radius $\frac{1}{2}$ and the path of the ball is some $n$-gon inscribed in that half-unit circle. Since the ball and the point of contact are each traveling at constant speeds, the length of time between collisions and hence length of the sides of the $n$-gon must all be the same. Thus, a ball tracing a periodic path must trace out a regular $n$-gon inscribed in the half-unit circle centered at the center of the unit square.

The side length of a regular $n$-gon inscribed in a half-unit circle can be given by the law of cosines \begin{align*}s_n^2 &= \left(\frac{1}{2}\right)^2 + \left(\frac{1}{2}\right)^2 - 2 \left(\frac{1}{2}\right) \left(\frac{1}{2}\right) \cos \frac{2\pi}{n}\\ &=\frac{1 - \cos \frac{2\pi}{n}}{2}\\ &= \sin^2 \frac{\pi}{n}.\end{align*} Therefore the length of this periodic path is $$\ell_n = n s_n = n \sin \left( \frac{\pi}{n} \right).$$ We see that since $\sin x = x - \frac{x^3}{6} + O(x^5)$ that $$\ell_n = \pi - \frac{\pi^3}{6n^2} + O(n^{-4}),$$ so $\ell_n \uparrow \pi$ as $n \to \infty.$ So we can get that the smallest such path is $\ell_2 = 2,$ which represents the path that traces the line segment from the midpoints of the top and bottom sides of the square twice (down and back).

If we were to look for the next longest path, it would be the equilateral triangle of side length $\sin \frac{\pi}{3} = \frac{\sqrt{3}}{2}.$ The total travel distance of this equilateral triangular path is thus $$\ell_3 = \frac{3\sqrt{3}}{2} \equiv 2.598076211\dots.$$

Monday, February 3, 2025

Spinning surfaces and the vertical lines that test them

In a more advanced course, you’ve been asked to draw a 3D sketch of the function $z = |x| + |y|.$ As you’re about to do this, you are struck by another bout of dizziness, and your resulting graph is rotated about the origin in a random direction in 3D space. In other words, the central axis of your graph’s “funnel” is equally likely to point from the origin to any point on the surface of the unit sphere.

What is the probability that the resulting graph you produce is in fact a function (i.e., $z$ is a function of $x$ and $y$)?

At first glance, this looks like a harder problem. There is after all one more direction to dizzily rotate your surfaces. However, first we note that the orthonormal rotation that transforms the point unit $z$-vector, $e_3 = (0,0,1)^T$ to a random point on the unit sphere $$\hat{u} = ( \cos \theta \sin \vartheta, \sin \theta \sin \vartheta, \cos \vartheta)$$ is composed of a rotation about the $y$-axis through an angle $\vartheta \in ( 0^\circ, 180^\circ),$ followed by a rotation about the $z$-axis through an angle of $\theta \in (0^\circ, 360^\circ).$ Now if we are testing from a vertical line test perspective using a vertical line parallel to the $z$-axis, then any rotation about the $z$-axis will not affect its success at passing this test. So we only are really worried about the rotation about the $y$-axis through an angle of $\vartheta.$ This case then devolves into the two-dimensional case we saw before, though with only half of range. That is, the resulting parametric surface will pass the vertical line test whenever $\vartheta \in [0^\circ, 45^\circ) \cup (135^\circ, 180^\circ].$

The only thing that we have to be careful here of is assessing the probability. Here we want to measure the surface of the sphere that satisfies $$\Omega = \{ \vartheta \in [0^\circ, 45^\circ) \cup (135^\circ, 180^\circ], \theta \in [0^\circ, 360^\circ) \}.$$ We can calculate the surface area of the region $\Omega$ by converting to radians and then using the surface area of the shape bounded by the curve $r = \sin \vartheta$ for $\vartheta \in [0, \frac{\pi}{4}) \cup (\frac{3\pi}{4}, \pi],$ that is $$S = S(\Omega) = 2 \int_0^{\pi / 4} \pi \sin^2 \vartheta \,d\vartheta.$$ Therefore, since the total surface area of the unit sphere is $4\pi,$ the probability of the rotated parametric surface passing the vertical line test is \begin{align*}q = \frac{S}{4\pi} &= \frac{1}{2} \int_0^{\pi/4} \sin^2 \vartheta \,d\vartheta \\ &= \frac{1}{2} \int_0^{\pi/4} \frac{1 - \cos 2\vartheta}{2} \,d\vartheta \\ &= \left[\frac{\vartheta}{4} - \frac{\sin 2\vartheta}{8} \right]^{\vartheta = \pi/4}_{\vartheta=0} \\ &= \frac{\pi}{16} - \frac{1}{8} = \frac{\pi-2}{16} \approx 7.13495\dots \%.\end{align*}

Spinning graphs and the vertical lines that test them

You’re taking a math exam, and you’ve been asked to draw the graph of a function. That is, your graph must pass the vertical line test, so that no vertical line intersects your function’s graph more than once.

You decide you’re going to graph the absolute value function, $y = |x|,$ and ace the test.

There’s just one problem. You are dealing with a bout of dizziness, and can’t quite make out the $x$- and $y$-axes on the exam in front of you. As a result, your function will be rotated about the origin by a random angle that’s uniformly chosen between $0$ and $360$ degrees.

What is the probability that the resulting graph you produce is in fact a function (i.e., $y$ is a function of $x$)?

Let's assume that the map of $y = |x|$ is rotated about the origin by an angle of $\theta \sim U(0^\circ,360^\circ)$ degrees with respect to the positive $x$-axis. We can think of this situation as defining a new set of variables $$\begin{pmatrix} \tilde{x} \\ \tilde{y} \end{pmatrix} = \begin{pmatrix} \cos \frac{\pi\theta}{180} & -\sin \frac{\pi\theta}{180} \\ \sin \frac{\pi\theta}{180} & \cos \frac{\pi\theta}{180} \end{pmatrix} \begin{pmatrix} x \\ |x| \end{pmatrix} = \begin{pmatrix} x \cos \frac{\pi\theta}{180} - |x| \sin \frac{\pi\theta}{180} \\ x \sin \frac{\pi\theta}{180} + |x| \cos \frac{\pi\theta}{180} \end{pmatrix}.$$ So we have $\tilde{x} = f(x)$ and $\tilde{y} = g(x)$ as parametric functions of our previous variable $x.$

Now we see that if $f$ is one-to-one, then the parametric curve $(f(x), g(x))$ will pass the vertical line test, since there is only one possible value of $x$ such that $\tilde{x} = f(x),$ then there can only be at most one intersection between any vertical line and the curve.

On the other hand, if $f$ is not one-to-one, then for some $x_1 \ne x_2,$ we have $f(x_1) = f(x_2).$ In this case, since $f(x_1) = f(x_2),$ we have equivalently $$(x_1 - x_2) \cos \frac{\pi \theta}{180} = ( |x_1| - |x_2| ) \sin \frac{\pi \theta}{180}.$$ Now let's look at the values of $g(x_1)$ and $g(x_2).$ If $\sin \frac{\pi\theta}{180} = 0,$ then $f(x) = x \cos \frac{\pi\theta}{180},$ which is a one-to-one function, so if $f$ is not one-to-one then we can assume that $\sin \frac{\pi \theta}{180} \ne 0.$ Therefore, we have \begin{align*}g(x_1) - g(x_2) &= (x_1 - x_2) \sin \frac{\pi \theta}{180} + (|x_1| - |x_2| ) \cos \frac{\pi \theta}{180} \\ &= (x_1 - x_2) \sin \frac{\pi \theta}{180} + (|x_1| - |x_2|) \sin \frac{\pi \theta}{180} \frac{ \cos \frac{\pi \theta}{180}}{\sin \frac{\pi\theta}{180}} \\ & = (x_1 - x_2) \sin \frac{\pi \theta}{180} + (x_1 - x_2) \cos \frac{\pi \theta}{180} \frac{\cos \frac{\pi \theta}{180}}{\sin \frac{\pi \theta}{180}} \\ &= (x_1 - x_2) \left( \sin \frac{\pi \theta}{180} + \frac{ \cos^2 \frac{\pi \theta}{180}}{\sin \frac{\pi \theta}{180}} \right) \\ &= \frac{ x_1 - x_2}{\sin \frac{\pi \theta}{180}},\end{align*} so since $x_1 \ne x_2,$ we have $g(x_1) \ne g(x_2).$ Thus, the vertical line $\tilde{x} = f(x_1) = f(x_2)$ would intersect the curve at $\tilde{y}_1 = g(x_1)$ and $\tilde{y}_2 = g(x_2),$ with $\tilde{y}_1 \ne \tilde{y}_2.$ Thus, if $f$ is not one-to-one then the parametric curve will fail the vertical line test. Therefore, the parametric curve will pass the vertical line test if and only if $f$ is one-to-one.

So let's analyze the function $$f(x) = x \cos \frac{\pi\theta}{180} - |x| \sin \frac{\pi\theta}{180}.$$ We see that $$f^\prime(x) = \begin{cases} \cos \frac{\pi\theta}{180} + \sin \frac{\pi\theta}{180}, &\text{if $x \lt 0$;} \\ \cos \frac{\pi\theta}{180} - \sin \frac{\pi\theta}{180}, & \text{if $x \gt 0.$} \end{cases}$$ If $f$ is monotonic, then it is obviously one-to-one, so we need only determine for what values of $\theta \in (0^\circ, 360^\circ)$ does $\cos \frac{\pi\theta}{180} - \sin \frac{\pi\theta}{180}$ and $\cos \frac{\pi\theta}{180} + \sin \frac{\pi\theta}{180}$ have the same signs, that is, when does $$0 \lt \left(\cos \frac{\pi\theta}{180} - \sin \frac{\pi\theta}{180}\right) \left( \cos \frac{\pi\theta}{180} + \sin \frac{\pi\theta}{180} \right) = \cos^2 \frac{\pi\theta}{180} - \sin^2 \frac{\pi\theta}{180} = \cos \frac{\pi\theta}{90}.$$ So since $\cos x \gt 0$ on $x \in [ 0, \frac{\pi}{2} ) \cup ( \frac{3\pi}{2}, 2\pi],$ we see that the resulting graph will pass the vertical line test whenever $\theta \in [ 0^\circ, 45^\circ ) \cup (135^\circ, 225^\circ) \cup ( 315^\circ, 360^\circ ],$ which means that the probability of passing the vertical line test if $\theta \sim U(0,360)$ is $$p = \frac{|45 - 0| + |225 - 135| + |360 - 315|}{360} = \frac{1}{2}.$$