The Incomplete Gamma and Confluent Hypergeometric Functions (Part 6)

In the previous posts, I showed that the curious integral

\displaystyle \int_0^z t^{a-1} e^{-t} \, dt = \displaystyle e^{-z} \sum_{s=0}^\infty \frac{(a-1)!}{(a+s)!} z^{a+s},

where the right-hand side is a special case of the confluent hypergeometric function when a is a positive integer, can be confirmed if I can show that

\displaystyle \sum_{s=0}^a (-1)^s \binom{n}{s} = (-1)^a \binom{n-1}{a},

where 0 \le a \le n-1. We now prove this combinatorical identity.

Case 1. If a=0, then

\displaystyle \sum_{s=0}^0 (-1)^s \binom{n}{s} = (-1)^0 \binom{n}{0} = 1 = (-1)^0 \binom{n-1}{0}.

Case 2. If 1 \le a \le n-1, then

\displaystyle \sum_{s=0}^a (-1)^s \binom{n}{s} = (-1)^0 \binom{n}{0} + \sum_{s=1}^{a} (-1)^s \binom{n}{s}

\displaystyle = 1 + \sum_{s=1}^{a} (-1)^s \binom{n}{s}

\displaystyle = 1  + \sum_{s=1}^a (-1)^s \left[\binom{n-1}{s-1} + \binom{n-1}{s}\right]

\displaystyle = 1 + \sum_{s=1}^a (-1)^s \binom{n-1}{s-1} + \sum_{s=1}^{a-1} (-1)^s \binom{n-1}{s}

\displaystyle = 1  + \sum_{s=0}^{a-1} (-1)^{s+1} \binom{n-1}{s} + \sum_{s=1}^a (-1)^s \binom{n-1}{s}

\displaystyle = 1  + (-1)^1 \binom{n-1}{0} + \sum_{s=1}^{a-1} (-1)^{s+1} \binom{n-1}{s} + \sum_{s=1}^{a-1} (-1)^s \binom{n-1}{s} + (-1)^a \binom{n-1}{a}

\displaystyle = 1  -1 + (-1)^a \binom{n-1}{a} + \sum_{s=1}^{a-1} (-1)^{s+1} \binom{n-1}{s} + \sum_{s=1}^{a-1} (-1)^s \binom{n-1}{s}

\displaystyle = (-1)^a \binom{n-1}{a} +\sum_{s=1}^{a-1} \left[(-1)^{s+1} \binom{n-1}{s} + (-1)^s \binom{n-1}{s} \right]

\displaystyle = (-1)^a \binom{n-1}{a} + \sum_{s=1}^{a-1} (-1)^s \binom{n-1}{s} \left[ -1 + 1 \right]

\displaystyle = (-1)^a \binom{n-1}{a} + \sum_{s=1}^{a-1} 0

\displaystyle = (-1)^a \binom{n-1}{a}

In retrospect, I’m really surprised that I don’t remember seeing this identity before. The proof uses many of the techniques that we teach in discrete mathematics, including peeling off a term from either the start or end of a series, reindexing a sum, and the identity for constructing the terms in Pascal’s triangle in terms of the binomial coefficients. So I would’ve thought that I would’ve come across this, either in my own studies as a student or else in a textbook while preparing to teach discrete mathematics.

The observant reader may have noted that the “proof” over the past few posts isn’t really a proof since I started with the equation that I wanted to prove and then ended up with a true statement. While working backwards helped me see what was going on, this logic is ultimately flawed since it’s possible for false statements to imply true statements (another principle from discrete mathematics). I’ll clean this up in the next post.

The Incomplete Gamma and Confluent Hypergeometric Functions (Part 5)

In the previous two posts, I show that the curious integral

\displaystyle \int_0^z t^{a-1} e^{-t} \, dt = \displaystyle e^{-z} \sum_{s=0}^\infty \frac{(a-1)!}{(a+s)!} z^{a+s},

where the right-hand side is a special case of the confluent hypergeometric function when a is a positive integer, can be confirmed if I can show that

\displaystyle \sum_{s=0}^a (-1)^s \binom{n}{s} =^? (-1)^a \binom{n-1}{a}.

When I first arrived at this equation, I noticed that this was really a property about the numbers in Pascal’s triangle: if we alternate adding and subtracting the binomial coefficients \displaystyle \binom{n}{s} on the nth row of Pascal’s triangle, the result is supposed to be an entry in the previous row (perhaps multiplied by -1).

For example, using the 10th row of Pascal’s triangle:

  • 1 - 10 = -9, which is negative the number to the “northeast” of 10.
  • 1 - 10 + 45 = 36, which is the number northeast of 45.
  • 1 - 10 + 45 - 120 = -84, which is negative the number northeast of 120.
  • 1 - 10 + 45 -120 + 210 = 126, which is the number northeast of 210.

And so on.

These computations suggest a proof of this identity. Any term in the interior of Pascal’s triangle can be found by adding the two terms immediately above it. Indeed, we can see this working out in the sequence of sums listed above.

I’ll write up the formal proof of the identity in the next post.

The Incomplete Gamma and Confluent Hypergeometric Functions (Part 4)

In the previous post, I show that the curious integral

\displaystyle \int_0^z t^{a-1} e^{-t} \, dt = \displaystyle e^{-z} \sum_{s=0}^\infty \frac{(a-1)!}{(a+s)!} z^{a+s},

where the right-hand side is a special case of the confluent hypergeometric function when a is a positive integer, can be confirmed if I can show that

\displaystyle \sum_{s=0}^n \frac{(-1)^s (a-1)!}{s! (a+n-s)!} =^? \frac{(-1)^n}{n! (a+n)}.

I’m using the symbol =^? to emphasize that I haven’t proven that this equality is true. To be honest, I didn’t immediately believe that this worked; however, I was psychologically convinced after using Mathematica to compute this sum for about a dozen values of n and a.

To attempt a proof, we first note that if n=0, then

\displaystyle \sum_{s=0}^0 \frac{(-1)^s (a-1)!}{s! (a+0-s)!} = (-1)^0 \frac{(a-1)!}{0!a!} = \frac{(-1)^0}{0! (a+0)},

and so the equality works if n=0. So, for the following, we will assume that n \ge 1. I tried replacing n with n-a in the above equation to hopefully simplify the summation a little bit:

\displaystyle \sum_{s=0}^{n-a} \frac{(-1)^s (a-1)!}{s! (a+n-a-s)!} =^? \frac{(-1)^{n-a}}{(n-a)! (a+n-a)}

\displaystyle \sum_{s=0}^{n-a} \frac{(-1)^s (a-1)!}{s! (n-s)!} =^? \frac{(-1)^{n-a}}{n \cdot (n-a)!}

\displaystyle \sum_{s=0}^{n-a} \frac{(-1)^s}{s! (n-s)!} =^? \frac{(-1)^{n-a}}{n \cdot (a-1)!(n-a)!}

The left-hand side looks like a binomial coefficient, which suggest multiplying both sides by n!:

\displaystyle \sum_{s=0}^{n-a} (-1)^s \frac{n!}{s! (n-s)!} =^? \frac{(-1)^{n-a} n!}{n \cdot (a-1)!(n-a)!}

\displaystyle \sum_{s=0}^{n-a} (-1)^s \binom{n}{s} =^? \frac{(-1)^{n-a} (n-1)!}{(a-1)!(n-a)!}

Surprise, surprise: the right-hand side is also a binomial coefficient since (a-1)+(n-a) = n-1:

\displaystyle \sum_{s=0}^{n-a} (-1)^s \binom{n}{s} =^? (-1)^{n-a} \binom{n-1}{n-a}.

Now we’re getting somewhere. To again make a sum a little simpler, let’s replace a with n-a:

\displaystyle \sum_{s=0}^{n-(n-a)} (-1)^s \binom{n}{s} =^? (-1)^{n-(n-a)} \binom{n-1}{n-(n-a)}

\displaystyle \sum_{s=0}^a (-1)^s \binom{n}{s} =^? (-1)^a \binom{n-1}{a}

Therefore, it appears that the confirming the complicated integral at the top of this post reduces to this equality involving binomial coefficients. In the next post, I’ll directly confirm this equality.

The Incomplete Gamma and Confluent Hypergeometric Functions (Part 3)

In the previous post, I confirmed the curious integral

\displaystyle \int_0^z t^{a-1} e^{-t} \, dt = \displaystyle e^{-z} \sum_{s=0}^\infty \frac{(a-1)!}{(a+s)!} z^{a+s},

where the right-hand side is a special case of the confluent hypergeometric function when a is a positive integer, by differentiating the right-hand side. However, the confirmation psychologically felt very unsatisfactory — we basically guessed the answer and then confirmed that it worked.

A seemingly better way to approach the integral is to use the Taylor series representation of e^{-t} to integrate the left-hand side term-by-term:

\displaystyle \int_0^z t^{a-1} e^{-t} \, dt = \int_0^z t^{a-1} \sum_{n=0}^\infty \frac{(-t)^n}{n!} \,  dt

= \displaystyle \sum_{n=0}^\infty \frac{(-1)^n}{n!} \int_0^z t^{a+n-1} \, dt

= \displaystyle \sum_{n=0}^\infty \frac{(-1)^n}{n!} \frac{z^{a+n}}{a+n}.

Well, that doesn’t look like the right-hand side of the top equation. However, the right-hand side of the top equation also has a e^{-z} in it. Let’s also convert that to its Taylor series expansion and then use the formula for multiplying two infinite series:

\displaystyle e^{-z} \sum_{s=0}^\infty \frac{(a-1)!}{(a+s)!} z^{a+s} = \left( \sum_{s=0}^\infty \frac{(-z)^s}{s!} \right) \left( \sum_{s=0}^\infty \frac{(a-1)!}{(a+s)!} z^{a+s} \right)

= \displaystyle z^a \left( \sum_{s=0}^\infty \frac{(-1)^s z^s}{s!} \right) \left( \sum_{s=0}^\infty \frac{(a-1)!}{(a+s)!} z^s \right)

= \displaystyle z^a \sum_{n=0}^\infty \sum_{s=0}^n \frac{(-1)^s z^s}{s!} \frac{(a-1)!}{(a+n-s)!} z^{n-s}

= \displaystyle \sum_{n=0}^\infty \sum_{s=0}^n \frac{(-1)^s}{s!} \frac{(a-1)!}{(a+n-s)!} z^{a+n}

Summarizing, apparently the following two infinite series are supposed to be equal:

\displaystyle \sum_{n=0}^\infty \frac{(-1)^n}{n!} \frac{z^{a+n}}{a+n} = \sum_{n=0}^\infty \sum_{s=0}^n \frac{(-1)^s}{s!} \frac{(a-1)!}{(a+n-s)!} z^{a+n},

or, matching coefficients of z^{a+n},

\displaystyle \frac{(-1)^n}{n! (a+n)} = \sum_{s=0}^n \frac{(-1)^s (a-1)!}{s! (a+n-s)!}.

When I first came to this equality, my immediate reaction was to throw up my hands and assume I made a calculation error someplace — I had a hard time believing that this sum from s=0 to s=n was true. However, after using Mathematica to evaluate this sum for about a dozen different values of n and a, I was able to psychologically assure myself that this identity was somehow true.

But why does this awkward summation work? This is no longer a question about integration: it’s a question about a finite sum with factorials. I continue this exploration in the next post.

Solving Problems Submitted to MAA Journals: Index

I’m doing something that I should have done a long time ago: collecting a series of posts into one single post. The links below show my series on solving problems submitted to the journals of the Mathematical Association of America.

Part 1: Introduction

Part 2a: Suppose that X and Y are independent, uniform random variables over [0,1]. Now define the random variable Z by

Z = (Y-X) {\bf 1}(Y \ge X) + (1-X+Y) {\bf 1}(Y<X).

Prove that Z is uniform over [0,1]. Here, {\bf 1}[S] is the indicator function that is equal to 1 if S is true and 0 otherwise.

Part 2b: Suppose that X and Y are independent, uniform random variables over [0,1]. Define U_X, V_X, B_X, and W_X as follows:

U_X is uniform over [0,X],

V_X is uniform over [X,1],

B_X \in \{0,1\} with P(B_X=1) = X and P(B_X=0)=1-X, and

W_X = B_X \cdot U_X + (1-B_X) \cdot V_X.

Prove that W_X is uniform over [0,1].

Part 3: Define, for every non-negative integer n, the nth Catalan number by

C_n := \displaystyle \frac{1}{n+1} {2n \choose n}.

Consider the sequence of complex polynomials in z defined by z_k := z_{k-1}^2 + z for every non-negative integer k, where z_0 := z. It is clear that z_k has degree 2^k and thus has the representation

z_k =\displaystyle \sum_{n=1}^{2^k} M_{n,k} z^n,

where each M_{n,k} is a positive integer. Prove that M_{n,k} = C_{n-1} for 1 \le n \le k+1.

Part 4: 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).

Parts 5a, 5b, 5c, 5d, and 5e: 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).

Parts 6a, 6b, 6c, 6d, and 6e: 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?

Parts 7a, 7b, 7c, 7d, 7e, 7f, 7g, 7h, and 7i: Let X and Y be independent normally distributed random variables, each with its own mean and variance. Show that the variance of X conditioned on the event X>Y is smaller than the variance of X alone.

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.