Solving Problems Submitted to MAA Journals (Part 6d)

The following problem appeared in Volume 97, Issue 3 (2024) of Mathematics Magazine.

Two points P and Q are chosen at random (uniformly) from the interior of a unit circle. What is the probability that the circle whose diameter is segment overline{PQ} lies entirely in the interior of the unit circle?

As discussed in a previous post, I guessed from simulation that the answer is 2/3. Naturally, simulation is not a proof, and so I started thinking about how to prove this.

My first thought was to make the problem simpler by letting only one point be chosen at random instead of two. Suppose that the point P is fixed at a distance t from the origin. What is the probability that the point Q, chosen at random, uniformly, from the interior of the unit circle, has the desired property?

My second thought is that, by radial symmetry, I could rotate the figure so that the point P is located at (t,0). In this way, the probability in question is ultimately going to be a function of t.

There is a very nice way to compute such probabilities since Q is chosen at uniformly from the unit circle. Let A_t be the set of all points Q within the unit circle that have the desired property. Since the area of the unit circle is \pi(1)^2 = \pi, the probability of desired property happening is

\displaystyle \frac{\hbox{area}(A_t)}{\pi}.

Based on the simulations discussed in the previous post, my guess was that A_t was the interior of an ellipse centered at the origin with a semimajor axis of length 1 and a semiminor axis of length \sqrt{1-t^2}. Now I had to think about how to prove this.

As noted earlier in this series, the circle with diameter \overline{PQ} will lie within the unit circle exactly when MO+MP < 1, where M is the midpoint of \overline{PQ}. So suppose that P has coordinates (t,0), where t is known, and let the coordinates of Q be (x,y). Then the coordinates of M will be

\displaystyle \left( \frac{x+t}{2}, \frac{y}{2} \right),

so that

MO = \displaystyle \sqrt{ \left( \frac{x+t}{2} \right)^2 + \left( \frac{y}{2} \right)^2}

and

MP = \displaystyle \sqrt{ \left( \frac{x+t}{2} - t\right)^2 + \left( \frac{y}{2} \right)^2} =  \sqrt{ \left( \frac{x-t}{2} \right)^2 + \left( \frac{y}{2} \right)^2}.

Therefore, the condition MO+MP < 1 (again, equivalent to the condition that the circle with diameter \overline{PQ} lies within the unit circle) becomes

\displaystyle \sqrt{ \left( \frac{x+t}{2} \right)^2 + \left( \frac{y}{2} \right)^2} + \sqrt{ \left( \frac{x-t}{2} \right)^2 + \left( \frac{y}{2} \right)^2} < 1,

which simplifies to

\displaystyle \sqrt{ \frac{1}{4} \left[ (x+t)^2 + y^2 \right]} + \sqrt{ \frac{1}{4} \left[ (x-t)^2 + y^2 \right]} < 1

\displaystyle \frac{1}{2}\sqrt{   (x+t)^2 + y^2} +  \frac{1}{2}\sqrt{  (x-t)^2 + y^2} < 1

\displaystyle \sqrt{   (x+t)^2 + y^2} +  \sqrt{  (x-t)^2 + y^2} < 2.

When I saw this, light finally dawned. Given two points F_1 and F_2, called the foci, an ellipse is defined to be the set of all points Q so that QF_1 + QF_2 = 2a, where a is a constant. If the coordinates of Q, F_1, and F_2 are (x,y), (c,0), and (-c,0), then this becomes

\displaystyle \sqrt{   (x+c)^2 + y^2} +  \sqrt{  (x-c)^2 + y^2} = 2a.

Therefore, the set A_t is the interior of an ellipse centered at the origin with a = 1 and c = t. Furthermore, a = 1 is the semimajor axis of the ellipse, while the semiminor axis is equal to b = \sqrt{a^2-c^2} = \sqrt{1-t^2}.

At last, I could now return to the original question. Suppose that the point P is fixed at a distance t from the origin. What is the probability that the point Q, chosen at random, uniformly, from the interior of the unit circle, has the property that the circle with diameter \overline{PQ} lies within the unit circle? Since A_t is a subset of the interior of the unit circle, we see that this probability is equal to

\displaystyle \frac{\hbox{area}(A_t)}{\hbox{area of unit circle}} = \frac{\pi \cdot 1 \cdot \sqrt{1-t^2}}{\pi (1)^2} = \sqrt{1-t^2}.

In the next post, I’ll use this intermediate step to solve the original question.

Solving Problems Submitted to MAA Journals (Part 6c)

The following problem appeared in Volume 97, Issue 3 (2024) of Mathematics Magazine.

Two points P and Q are chosen at random (uniformly) from the interior of a unit circle. What is the probability that the circle whose diameter is segment \overline{PQ} lies entirely in the interior of the unit circle?

As discussed in the previous post, I guessed from simulation that the answer is 2/3. Naturally, simulation is not a proof, and so I started thinking about how to prove this.

My first thought was to make the problem simpler by letting only one point be chosen at random instead of two. Suppose that the point P is fixed at a distance t from the origin. What is the probability that the point Q, chosen at random, uniformly, from the interior of the unit circle, has the desired property?

My second thought is that, by radial symmetry, I could rotate the figure so that the point P is located at (t,0). In this way, the probability in question is ultimately going to be a function of t.

There is a very nice way to compute such probabilities since Q is chosen at uniformly from the unit circle. Let A_t be the probability that the point Q has the desired property. Since the area of the unit circle is \pi(1)^2 = \pi, the probability of desired property happening is

\displaystyle \frac{\hbox{area}(A_t)}{\pi}.

So, if I could figure out the shape of A_t, I could compute this conditional probability given the location of the point P.

But, once again, I initially had no idea of what this shape would look like. So, once again, I turned to simulation with Mathematica. As noted earlier in this series, the circle with diameter \overline{PQ} will lie within the unit circle exactly when MO+MP < 1, where M is the midpoint of \overline{PQ}. For my initial simulation, I chose P to have coordinates (0.5,0).

To my surprise, I immediately recognized that the points had the shape of an ellipse centered at the origin. Indeed, with a little playing around, it looked like this ellipse had a semimajor axis of 1 and a semiminor axis of about 0.87.

My next thought was to attempt to find the relationship between the length of the semiminor axis at the distance t of P from the origin. I thought I’d draw of few of these simulations for different values of t and then try to see if there was some natural function connecting t to my guesses. My next attempt was t = 0.6; as it turned out, it looked like the semiminor axis now had a length of 0.8.

At this point, something clicked: (6,8,10) is a Pythagorean triple, meaning that

6^2 + 8^2 = 10^2

(0.6)^2 + (0.8)^2 = 1^2

(0.8)^2 = 1 - (0.6)^2

0.8 = \sqrt{1 - (0.6)^2}

Also, 0.87 is very close to \sqrt{3}/2, a very familiar number from trigonometry:

\displaystyle \frac{\sqrt{3}}{2} = \sqrt{1 - (0.5)^2}

So I had a guess: the semiminor axis has length \sqrt{1-t^2}. A few more simulations with different values of t confirmed this guess. For instance, here’s the picture with t = 0.9.

Now that I was psychologically certain of the answer for A_t, all that remain was proving that this guess actually worked. That’ll be the subject of the next post.

Solving Problems Submitted to MAA Journals (Part 6b)

The following problem appeared in Volume 97, Issue 3 (2024) of Mathematics Magazine.

Two points P and Q are chosen at random (uniformly) from the interior of a unit circle. What is the probability that the circle whose diameter is segment \overline{PQ} lies entirely in the interior of the unit circle?

As discussed in the previous post, I guessed from simulation that the answer is 2/3. Naturally, simulation is not a proof, and so I started thinking about how to prove this.

My first thought was to make the problem simpler by letting only one point be chosen at random instead of two. Suppose that the point P is fixed at a distance t from the origin. What is the probability that the point Q, chosen at random, uniformly, from the interior of the unit circle, has the desired property?

My second thought is that, by radial symmetry, I could rotate the figure so that the point P is located at (t,0). In this way, the probability in question is ultimately going to be a function of t.

There is a very nice way to compute such probabilities since Q is chosen at uniformly from the unit circle. Let A_t be the probability that the point Q has the desired property. Since the area of the unit circle is \pi(1)^2 = \pi, the probability of desired property happening is

\displaystyle \frac{\hbox{area}(A_t)}{\pi}.

So, if I could figure out the shape of A_t, I could compute this conditional probability given the location of the point P.

But, once again, I initially had no idea of what this shape would look like. So, once again, I turned to simulation with Mathematica.

First, a technical detail that I ignored in the previous post. To generate points (x,y) at random inside the unit circle, one might think to let x = r \cos \theta and y = r \sin \theta, where the distance from the origin r is chosen at random between 0 and 1 and the angle \theta is chosen at random from 0 to 2\pi. Unfortunately, this simple simulation generates too many points that are close to the origin and not enough that are close to the circle:

To see why this happened, let R denote the distance of a randomly chosen point from the origin. Then the event R < r is the same as saying that the point lies inside the circle centered at the origin with radius r, so that the probability of this event should be

F(r) = P(R < r) = \displaystyle \frac{\pi r^2}{\pi (1)^2} = r^2.

However, in the above simulation, R was chosen uniformly from [0,1], so that P(R < r) = r. All this to say, the above simulation did not produce points uniformly chosen from the unit circle.

To remedy this, we employ the standard technique of using the inverse of the above function F(r), which is clearly F^{-1}(r) = \sqrt{r}. In other words, we will chose randomly chosen radius to have the form R= \sqrt{U}, where U is chosen uniformly on [0,1]. In this way,

P(R < r) = P( \sqrt{U} < r) = P(U < r^2) = r^2,

as required. Making this modification (highlighted in yellow) produces points that are more evenly distributed in the unit circle; any bunching of points or empty spaces are simply due to the luck of the draw.

In the next post, I’ll turn to the simulation of A_t.

Solving Problems Submitted to MAA Journals (Part 6a)

The following problem appeared in Volume 97, Issue 3 (2024) of Mathematics Magazine.

Two points P and Q are chosen at random (uniformly) from the interior of a unit circle. What is the probability that the circle whose diameter is segment \overline{PQ} lies entirely in the interior of the unit circle?

It took me a while to wrap my head around the statement of the problem. In the figure, the points P and Q are chosen from inside the unit circle (blue). Then the circle (pink) with diameter \overline{PQ} has center M, the midpoint of \overline{PQ}. Also, the radius of the pink circle is MP=MQ.

The pink circle will lie entirely the blue circle exactly when the green line containing the origin O, the point M, and a radius of the pink circle lies within the blue circle. Said another way, the condition is that the distance MO plus the radius of the pink circle is less than 1, or

MO + MP < 1.

As a first step toward wrapping my head around this problem, I programmed a simple simulation in Mathematica to count the number of times that MO + MP < 1 when points P and Q were chosen at random from the unit circle.

In the above simulation, out of about 61,000,000 attempts, 66.6644% of the attempts were successful. This leads to the natural guess that the true probability is 2/3. Indeed, the 95% confidence confidence interval (0.666524, 0.666764) contains 2/3, so that the difference of 0.666644 from 2/3 can be plausibly attributed to chance.

I end with a quick programming note. This certainly isn’t the ideal way to perform the simulation. First, for a fast simulation, I should have programmed in C++ or Python instead of Mathematica. Second, the coordinates of P and Q are chosen from the unit square, so it’s quite possible for P or Q or both to lie outside the unit circle. Indeed, the chance that both P and Q lie in the unit disk in this simulation is (\pi/4)^2 \approx 0.617, meaning that about 38.3\% of the simulations were simply wasted. So the only sense that this was a quick simulation was that I could type it quickly in Mathematica and then let the computer churn out a result. (I’ll talk about a better way to perform the simulation in the next post.)

Solving Problems Submitted to MAA Journals (Part 5e)

The following problem appeared in Volume 96, Issue 3 (2023) of Mathematics Magazine.

Evaluate the following sums in closed form:

f(x) = \displaystyle \sum_{n=0}^\infty \left( \cos x - 1 + \frac{x^2}{2!} - \frac{x^4}{4!} \dots + (-1)^{n-1} \frac{x^{2n}}{(2n)!} \right)

and

g(x) = \displaystyle \sum_{n=0}^\infty \left( \sin x - x + \frac{x^3}{3!} - \frac{x^5}{5!} \dots + (-1)^{n-1} \frac{x^{2n+1}}{(2n+1)!} \right).

By using the Taylor series expansions of \sin x and \cos x and flipping the order of a double sum, I was able to show that

f(x) = -\displaystyle \frac{x \sin x}{2} \qquad \hbox{and} \qquad g(x) = \frac{x\cos x - \sin x}{2}.

I immediately got to thinking: there’s nothing particularly special about \sin x and \cos x for this analysis. Is there a way of generalizing this result to all functions with a Taylor series expansion?

Suppose

h(x) = \displaystyle \sum_{k=0}^\infty a_k x^k,

and let’s use the same technique to evaluate

\displaystyle \sum_{n=0}^\infty \left( h(x) - \sum_{k=0}^n a_k x^k \right) = \sum_{n=0}^\infty \sum_{k=n+1}^\infty a_k x^k

= \displaystyle \sum_{k=1}^\infty \sum_{n=0}^{k-1} a_k x^k

= \displaystyle \sum_{k=1}^\infty k a_k x^k

= x \displaystyle \sum_{k=1}^\infty k a_k x^{k-1}

= x \displaystyle \sum_{k=1}^\infty \left(a_k x^k \right)'

= x \displaystyle \left[ (a_0)' +  \sum_{k=1}^\infty \left(a_k x^k \right)' \right]

= x \displaystyle \sum_{k=0}^\infty \left(a_k x^k \right)'

= x \displaystyle \left( \sum_{k=0}^\infty a_k x^k \right)'

= x h'(x).

To see why this matches our above results, let’s start with h(x) = \cos x and write out the full Taylor series expansion, including zero coefficients:

\cos x = 1 + 0x - \displaystyle \frac{x^2}{2!} + 0x^3 + \frac{x^4}{4!} + 0x^5 - \frac{x^6}{6!} \dots,

so that

x (\cos x)' = \displaystyle \sum_{n=0}^\infty \left( \cos x - \sum_{k=0}^n a_k x^k \right)

or

-x \sin x= \displaystyle \left(\cos x - 1 \right) + \left(\cos x - 1 + 0x \right) + \left( \cos x -1 + 0x + \frac{x^2}{2!} \right) + \left( \cos x -1 + 0x + \frac{x^2}{2!} + 0x^3 \right)

\displaystyle + \left( \cos x -1 + 0x + \frac{x^2}{2!} + 0x^3 - \frac{x^4}{4!} \right) + \left( \cos x -1 + 0x + \frac{x^2}{2!} + 0x^3 - \frac{x^4}{4!} + 0x^5 \right) \dots

After dropping the zero terms and collecting, we obtain

-x \sin x= \displaystyle 2 \left(\cos x - 1 \right) + 2 \left( \cos x -1 + \frac{x^2}{2!} \right) + 2 \left( \cos x -1 + \frac{x^2}{2!} - \frac{x^4}{4!} \right) \dots

-x \sin x = 2 f(x)

\displaystyle -\frac{x \sin x}{2} = f(x).

A similar calculation would apply to any even function h(x).

We repeat for

h(x) = \sin x = 0 + x + 0x^2 - \displaystyle \frac{x^3}{3!} + 0x^4 + \frac{x^5}{5!} + 0x^6 - \frac{x^7}{7!} \dots,

so that

x (\sin x)' = (\sin x - 0) + (\sin x - 0 - x) + (\sin x - 0 - x + 0x^2)

+ \displaystyle \left( \sin x - 0 - x + 0x^2 + \frac{x^3}{3!} \right) + \left( \sin x - 0 - x + 0x^2 + \frac{x^3}{3!} + 0x^4 \right)

+ \displaystyle \left( \sin x - 0 - x + 0x^2 + \frac{x^3}{3!} + 0x^4 - \frac{x^5}{5!} \right) + \left( \sin x - 0 - x + 0x^2 + \frac{x^3}{3!} + 0x^4 - \frac{x^5}{5!} + 0 x^6 \right) \dots,

or

x\cos x - \sin x = 2(\sin x - x) + \displaystyle 2\left(\sin x - x + \frac{x^3}{3!} \right) + 2 \left( \sin x - x + \frac{x^3}{3!} - \frac{x^5}{5!} \right) \dots

or

x \cos x - \sin x = 2 g(x)

\displaystyle \frac{x \cos x - \sin x}{2} = g(x).

A similar argument applies for any odd function h(x).

Solving Problems Submitted to MAA Journals (Part 5d)

The following problem appeared in Volume 96, Issue 3 (2023) of Mathematics Magazine.

Evaluate the following sums in closed form:

f(x) = \displaystyle \sum_{n=0}^\infty \left( \cos x - 1 + \frac{x^2}{2!} - \frac{x^4}{4!} \dots + (-1)^{n-1} \frac{x^{2n}}{(2n)!} \right)

and

g(x) = \displaystyle \sum_{n=0}^\infty \left( \sin x - x + \frac{x^3}{3!} - \frac{x^5}{5!} \dots + (-1)^{n-1} \frac{x^{2n+1}}{(2n+1)!} \right).

In the previous two posts, I showed that

f(x) = - \displaystyle \frac{x \sin x}{2} \qquad \hbox{and} \qquad g(x) = \displaystyle \frac{x \cos x - \sin x}{2};

the technique that I used was using the Taylor series expansions of \sin x and \cos x to write f(x) and g(x) as double sums and then interchanging the order of summation.

In the post, I share an alternate way of solving for f(x) and g(x). I wish I could take credit for this, but I first learned the idea from my daughter. If we differentiate g(x), we obtain

g'(x) = \displaystyle \sum_{n=0}^\infty \left( [\sin x]' - [x]' + \left[\frac{x^3}{3!}\right]' - \left[\frac{x^5}{5!}\right]' \dots + \left[(-1)^{n-1} \frac{x^{2n+1}}{(2n+1)!}\right]' \right)

= \displaystyle \sum_{n=0}^\infty \left( \cos x - 1 + \frac{3x^2}{3!} - \frac{5x^4}{5!} \dots + (-1)^{n-1} \frac{(2n+1)x^{2n}}{(2n+1)!} \right)

= \displaystyle \sum_{n=0}^\infty \left( \cos x - 1 + \frac{3x^2}{3 \cdot 2!} - \frac{5x^4}{5 \cdot 4!} \dots + (-1)^{n-1} \frac{(2n+1)x^{2n}}{(2n+1)(2n)!} \right)

= \displaystyle \sum_{n=0}^\infty \left( \cos x - 1 + \frac{x^2}{2!} - \frac{x^4}{4!} \dots + (-1)^{n-1} \frac{x^{2n}}{(2n)!} \right)

= f(x).

Something similar happens when differentiating the series for f(x); however, it’s not quite so simple because of the -1 term. I begin by separating the n=0 term from the sum, so that a sum from n =1 to \infty remains:

f(x) = \displaystyle \sum_{n=0}^\infty \left( \cos x - 1 + \frac{x^2}{2!} - \frac{x^4}{4!} \dots + (-1)^{n-1} \frac{x^{2n}}{(2n)!} \right)

= (\cos x - 1) + \displaystyle \sum_{n=1}^\infty \left( \cos x - 1 + \frac{x^2}{2!} - \frac{x^4}{4!} \dots + (-1)^{n-1} \frac{x^{2n}}{(2n)!} \right).

I then differentiate as before:

f'(x) = (\cos x - 1)' + \displaystyle \sum_{n=1}^\infty \left( [\cos x - 1]' + \left[ \frac{x^2}{2!} \right]' - \left[ \frac{x^4}{4!} \right]' \dots + \left[ (-1)^{n-1} \frac{x^{2n}}{(2n)!} \right]' \right)

= -\sin x + \displaystyle \sum_{n=1}^\infty \left( -\sin x + \frac{2x}{2!}  - \frac{4x^3}{4!} \dots + (-1)^{n-1} \frac{(2n) x^{2n-1}}{(2n)!} \right)

= -\sin x + \displaystyle \sum_{n=1}^\infty \left( -\sin x + \frac{2x}{2 \cdot 1!}  - \frac{4x^3}{4 \cdot 3!} \dots + (-1)^{n-1} \frac{(2n) x^{2n-1}}{(2n)(2n-1)!} \right)

= -\sin x + \displaystyle \sum_{n=1}^\infty \left( -\sin x + x - \frac{x^3}{3!} + \dots + (-1)^{n-1} \frac{x^{2n-1}}{(2n-1)!} \right)

= -\sin x - \displaystyle \sum_{n=1}^\infty \left( \sin x - x + \frac{x^3}{3!} + \dots - (-1)^{n-1} \frac{x^{2n-1}}{(2n-1)!} \right).

At this point, we reindex the sum. We make the replacement k = n - 1, so that n = k+1 and k varies from k=0 to \infty. After the replacement, we then change the dummy index from k back to n.

f'(x) = -\sin x - \displaystyle \sum_{k=0}^\infty \left( \sin x - x + \frac{x^3}{3!} + \dots - (-1)^{(k+1)-1} \frac{x^{2(k+1)-1}}{(2(k+1)-1)!} \right)

= -\sin x -  \displaystyle \sum_{k=0}^\infty \left( \sin x - x + \frac{x^3}{3!} + \dots - (-1)^{k} \frac{x^{2k+1}}{(2k+1)!} \right)

= -\sin x -  \displaystyle \sum_{n=0}^\infty \left( \sin x - x + \frac{x^3}{3!} + \dots - (-1)^{n} \frac{x^{2n+1}}{(2n+1)!} \right)

With a slight alteration to the (-1)^n term, this sum is exactly the definition of g(x):

f'(x)= -\sin x -  \displaystyle \sum_{n=0}^\infty \left( \sin x - x + \frac{x^3}{3!} + \dots - (-1)^1 (-1)^{n-1} \frac{x^{2n+1}}{(2n+1)!} \right)

= -\sin x -  \displaystyle \sum_{n=0}^\infty \left( \sin x - x + \frac{x^3}{3!} + \dots + (-1)^{n-1} \frac{x^{2n+1}}{(2n+1)!} \right)

= -\sin x - g(x).

Summarizing, we have shown that g'(x) = f(x) and f'(x) = -\sin x - g(x). Differentiating f'(x) a second time, we obtain

f''(x) = -\cos x - g'(x) = -\cos x - f(x)

or

f''(x) + f(x) = -\cos x.

This last equation is a second-order nonhomogeneous linear differential equation with constant coefficients. A particular solution, using the method of undetermined coefficients, must have the form F(x) = Ax\cos x + Bx \sin x. Substituting, we see that

[Ax \cos x + B x \sin x]'' + A x \cos x + Bx \sin x = -\cos x

-2A \sin x - Ax \cos x + 2B \cos x - B x \sin x + Ax \cos x + B x \sin x = -\cos x

-2A \sin x  + 2B \cos x = -\cos x

We see that A = 0 and B = -1/2, which then lead to the particular solution

F(x) = -\displaystyle \frac{1}{2} x \sin x

Since \cos x and \sin x are solutions of the associated homogeneous equation f''(x) + f(x) = 0, we conclude that

f(x) = c_1 \cos x + c_2 \sin x - \displaystyle \frac{1}{2} x \sin x,

where the values of c_1 and c_2 depend on the initial conditions on f. As it turns out, it is straightforward to compute f(0) and f'(0), so we will choose x=0 for the initial conditions. We observe that f(0) and g(0) are both clearly equal to 0, so that f'(0) = -\sin 0 - g(0) = 0 as well.

The initial condition f(0)=0 clearly imples that c_1 = 0:

f(0) = c_1 \cos 0 + c_2 \sin 0 - \displaystyle \frac{1}{2} \cdot 0 \sin 0

0 = c_1

To find c_2, we first find f'(x):

f'(x) = c_2 \cos x - \displaystyle \frac{1}{2} \sin x - \frac{1}{2} x \cos x

f'(0) = c_2 \cos 0 - \displaystyle  \frac{1}{2} \sin 0 - \frac{1}{2} \cdot 0 \cos 0

0 = c_2.

Since c_1 = c_2 = 0, we conclude that f(x) = - \displaystyle \frac{1}{2} x \sin x, and so

g(x) = -\sin x - f'(x)

= -\sin x - \displaystyle  \left( -\frac{1}{2} \sin x - \frac{1}{2} x \cos x \right)

= \displaystyle \frac{x \cos x - \sin x}{2}.

Solving Problems Submitted to MAA Journals (Part 5c)

The following problem appeared in Volume 96, Issue 3 (2023) of Mathematics Magazine.

Evaluate the following sums in closed form:

f(x) = \displaystyle \sum_{n=0}^\infty \left( \cos x - 1 + \frac{x^2}{2!} - \frac{x^4}{4!} \dots + (-1)^{n-1} \frac{x^{2n}}{(2n)!} \right)

and

g(x) = \displaystyle \sum_{n=0}^\infty \left( \sin x - x + \frac{x^3}{3!} - \frac{x^5}{5!} \dots + (-1)^{n-1} \frac{x^{2n+1}}{(2n+1)!} \right).

In the previous post, we showed that f(x) = - \frac{1}{2} x \sin x by writing the series as a double sum and then reversing the order of summation. We proceed with very similar logic to evaluate g(x). Since

\sin x = \displaystyle \sum_{k=0}^\infty (-1)^k \frac{x^{2k+1}}{(2k+1)!}

is the Taylor series expansion of \sin x, we may write g(x) as

g(x) = \displaystyle \sum_{n=0}^\infty \left( \sum_{k=0}^\infty (-1)^k \frac{x^{2k+1}}{(2k+1)!} - \sum_{k=0}^n (-1)^k \frac{x^{2k+1}}{(2k+1)!} \right)

= \displaystyle \sum_{n=0}^\infty \sum_{k=n+1}^\infty (-1)^k \frac{x^{2k+1}}{(2k+1)!}

As before, we employ one of my favorite techniques from the bag of tricks: reversing the order of summation. Also as before, the inner sum is inner sum is independent of n, and so the inner sum is simply equal to the summand times the number of terms. We see that

g(x) = \displaystyle \sum_{k=1}^\infty \sum_{n=0}^{k-1} (-1)^k \frac{x^{2k+1}}{(2k+1)!}

= \displaystyle \sum_{k=1}^\infty (-1)^k \cdot k \frac{x^{2k+1}}{(2k+1)!}

= \displaystyle \frac{1}{2} \sum_{k=1}^\infty (-1)^k \cdot 2k \frac{x^{2k+1}}{(2k+1)!}.

At this point, the solution for g(x) diverges from the previous solution for f(x). I want to cancel the factor of 2k in the summand; however, the denominator is

(2k+1)! = (2k+1)(2k)!,

and 2k doesn’t cancel cleanly with (2k+1). Hypothetically, I could cancel as follows:

\displaystyle \frac{2k}{(2k+1)!} = \frac{2k}{(2k+1)(2k)(2k-1)!} = \frac{1}{(2k+1)(2k-1)!},

but that introduces an extra (2k+1) in the denominator that I’d rather avoid.

So, instead, I’ll write 2k as (2k+1)-1 and then distribute and split into two different sums:

g(x) = \displaystyle \frac{1}{2} \sum_{k=1}^\infty (-1)^k \cdot 2k \frac{x^{2k+1}}{(2k+1)!}

= \displaystyle \frac{1}{2} \sum_{k=1}^\infty (-1)^k (2k+1-1) \frac{x^{2k+1}}{(2k+1)!}

= \displaystyle \frac{1}{2} \sum_{k=1}^\infty \left[ (-1)^k (2k+1) \frac{x^{2k+1}}{(2k+1)!} - (-1)^k \cdot 1 \frac{x^{2k+1}}{(2k+1)!} \right]

= \displaystyle \frac{1}{2} \sum_{k=1}^\infty (-1)^k (2k+1) \frac{x^{2k+1}}{(2k+1)!} - \frac{1}{2} \sum_{k=1}^\infty (-1)^k  \frac{x^{2k+1}}{(2k+1)!}

= \displaystyle \frac{1}{2} \sum_{k=1}^\infty (-1)^k (2k+1) \frac{x^{2k+1}}{(2k+1)(2k)!} - \frac{1}{2} \sum_{k=1}^\infty (-1)^k \frac{x^{2k+1}}{(2k+1)!}

= \displaystyle \frac{1}{2} \sum_{k=1}^\infty (-1)^k \frac{x^{2k+1}}{(2k)!} - \frac{1}{2} \sum_{k=1}^\infty (-1)^k \frac{x^{2k+1}}{(2k+1)!}.

At this point, I factored out a power of x from the first sum. In this way, the two sums are the Taylor series expansions of \cos x and \sin x:

g(x) = \displaystyle \frac{x}{2} \sum_{k=1}^\infty (-1)^k \cdot \frac{x^{2k}}{(2k)!} - \frac{1}{2} \sum_{k=1}^\infty (-1)^k \frac{x^{2k+1}}{(2k+1)!}

= \displaystyle \frac{x}{2} \cos x - \frac{1}{2} \sin x

= \displaystyle \frac{x \cos x - \sin x}{2}.

This was sufficiently complicated that I was unable to guess this solution by experimenting with Mathematica; nevertheless, Mathematica can give graphical confirmation of the solution since the graphs of the two expressions overlap perfectly.

Solving Problems Submitted to MAA Journals (Part 5b)

The following problem appeared in Volume 96, Issue 3 (2023) of Mathematics Magazine.

Evaluate the following sums in closed form:

f(x) =  \displaystyle \sum_{n=0}^\infty \left( \cos x - 1 + \frac{x^2}{2!} - \frac{x^4}{4!} \dots + (-1)^{n-1} \frac{x^{2n}}{(2n)!} \right)

and

g(x) = \displaystyle \sum_{n=0}^\infty \left( \sin x - x + \frac{x^3}{3!} - \frac{x^5}{5!} \dots + (-1)^{n-1} \frac{x^{2n+1}}{(2n+1)!} \right).

We start with f(x) and the Taylor series

\cos x = \displaystyle \sum_{k=0}^\infty (-1)^k \frac{x^{2k}}{(2k)!}.

With this, f(x) can be written as

f(x) = \displaystyle \sum_{n=0}^\infty \left( \sum_{k=0}^\infty (-1)^k \frac{x^{2k}}{(2k)!} - \sum_{k=0}^n (-1)^k \frac{x^{2k}}{(2k)!} \right)

= \displaystyle \sum_{n=0}^\infty \sum_{k=n+1}^\infty (-1)^k \frac{x^{2k}}{(2k)!}.

At this point, my immediate thought was one of my favorite techniques from the bag of tricks: reversing the order of summation. (Two or three chapters of my Ph.D. theses derived from knowing when to apply this technique.) We see that

f(x) = \displaystyle \sum_{k=1}^\infty \sum_{n=0}^{k-1} (-1)^k \frac{x^{2k}}{(2k)!}.

At this point, the inner sum is independent of n, and so the inner sum is simply equal to the summand times the number of terms. Since there are k terms for the inner sum (n = 0, 1, \dots, k-1), we see

f(x) =  \displaystyle \sum_{k=1}^\infty (-1)^k \cdot k \frac{x^{2k}}{(2k)!}.

To simplify, we multiply top and bottom by 2 so that the first term of (2k)! cancels:

f(x) = \displaystyle \frac{1}{2} \sum_{k=1}^\infty (-1)^k \cdot 2k \frac{x^{2k}}{(2k)(2k-1)!}

= \displaystyle \frac{1}{2} \sum_{k=1}^\infty (-1)^k \frac{x^{2k}}{(2k-1)!}

At this point, I factored out a (-1) and a power of x to make the sum match the Taylor series for \sin x:

f(x) = \displaystyle -\frac{x}{2} \sum_{k=1}^\infty (-1)^{k-1} \frac{x^{2k-1}}{(2k-1)!} = -\frac{x \sin x}{2}.

I was unsurprised but comforted that this matched the guess I had made by experimenting with Mathematica.

Solving Problems Submitted to MAA Journals (Part 5a)

The following problem appeared in Volume 96, Issue 3 (2023) of Mathematics Magazine.

Evaluate the following sums in closed form:

\displaystyle \sum_{n=0}^\infty \left( \cos x - 1 + \frac{x^2}{2!} - \frac{x^4}{4!} \dots + (-1)^{n-1} \frac{x^{2n}}{(2n)!} \right)

and

\displaystyle \sum_{n=0}^\infty \left( \sin x - x + \frac{x^3}{3!} - \frac{x^5}{5!} \dots + (-1)^{n-1} \frac{x^{2n+1}}{(2n+1)!} \right).

When I first read this problem, I immediately noticed that

\displaystyle 1 - \frac{x^2}{2!} + \frac{x^4}{4!} \dots - (-1)^{n-1} \frac{x^{2n}}{(2n)!} \right)

is a Taylor polynomial of \cos x and

\displaystyle x - \frac{x^3}{3!} + \frac{x^5}{5!} \dots - (-1)^{n-1} \frac{x^{2n+1}}{(2n+1)!} \right)

is a Taylor polynomial of \sin x. In other words, the given expressions are the sums of the tail-sums of the Taylor series for \cos x and \sin x.

As usual when stumped, I used technology to guide me. Here’s the graph of the first sum, adding the first 50 terms.

I immediately notice that the function oscillates, which makes me suspect that the answer involves either \cos x or \sin x. I also notice that the sizes of oscillations increase as |x| increases, so that the answer should have the form g(x) \cos x or g(x) \sin x, where g is an increasing function. I also notice that the graph is symmetric about the origin, so that the function is even. I also notice that the graph passes through the origin.

So, taking all of that in, one of my first guesses was y = x \sin x, which is satisfies all of the above criteria.

That’s not it, but it’s not far off. The oscillations of my guess in orange are too big and they’re inverted from the actual graph in blue. After some guessing, I eventually landed on y = -\frac{1}{2} x \sin x.

That was a very good sign… the two graphs were pretty much on top of each other. That’s not a proof that -\frac{1}{2} x \sin x is the answer, of course, but it’s certainly a good indicator.

I didn’t have the same luck with the other sum; I could graph it but wasn’t able to just guess what the curve could be.

Solving Problems Submitted to MAA Journals (Part 4)

The following problem appeared in Volume 96, Issue 3 (2023) of Mathematics Magazine.

Let A_1, \dots, A_n be arbitrary events in a probability field. Denote by B_k the event that at least k of A_1, \dots A_n occur. Prove that \displaystyle \sum_{k=1}^n P(B_k) = \sum_{k=1}^n P(A_k).

I’ll admit when I first read this problem, I didn’t believe it. I had to draw a couple of Venn diagrams to convince myself that it actually worked:

Of course, pictures are not proofs, so I started giving the problem more thought.

I wish I could say where I got the inspiration from, but I got the idea to define a new random variable N to be the number of events from A_1, \dots A_n that occur. With this definition, B_k becomes the event that N \ge k, so that

\displaystyle \sum_{k=1}^n P(B_k) = \sum_{k=1}^n P(N \ge k)

At this point, my Spidey Sense went off: that’s the tail-sum formula for expectation! Since N is a non-negative integer-valued random variable, the mean of N can be computed by

E(N) = \displaystyle \sum_{k=1}^n P(N \ge k).

Said another way, E(N) = \displaystyle \sum_{k=1}^n P(B_k).

Therefore, to solve the problem, it remains to show that \displaystyle \sum_{k=1}^n P(A_k) is also equal to E(N). To do this, I employed the standard technique from the bag of tricks of writing N as the sum of indicator random variables. Define

I_k = \displaystyle \bigg\{ \begin{array}{ll} 1, & A_k \hbox{~occurs} \\ 0, & A_k \hbox{~does not occur} \end{array}

Then N = I_1 + \dots + I_n, so that

E(N) = \displaystyle \sum_{k=1}^n E(I_k) =\sum_{k=1}^n [1 \cdot P(A_k) + 0 \cdot P(A_k^c)] =\sum_{k=1}^n P(A_k).

Equating the two expressions for E(N), we conclude that \displaystyle \sum_{k=1}^n P(B_k)  = \sum_{k=1}^n P(A_k), as claimed.