Recently, I’ve been thinking that being paid to do mathematics would be great because it would allow me to devote more time to it. For example, I am quite proud of my latest paper—but it took a lot of time to write, and would have taken even longer if I didn’t already have a job as a postdoctoral researcher. One of my previous papers was written during evenings and weekends since at the time I was working full-time at an internship and it wasn’t ideal.

Thus, I’ve been doing the things necessary to apply to academic positions like putting together a research statement. During this process the importance of direction has been made abundantly clear to me and I can’t help but lament the amount of time I spent as an undergraduate and graduate student with unclear direction and ridiculous misconceptions.

For example, as an undergraduate student I studied the Ramanujan–Nagell equation and came up with a new solution for it that I hadn’t seen published anywhere. My thought was: this is so cool, I have to share this with the world. So I wrote a short report, gave a copy to one of my professors who I thought might be interested, and uploaded a copy to my website. But what to do beyond that? My thinking was: I don’t know how to get it published somewhere, but I do know how to make it accessible to anyone who wants to read it via the Internet. I told myself that 99% of the value comes from writing the report and I didn’t need the additional 1% “seal of approval” that comes from getting it published. Now I know this is totally backwards—at least when it comes to job applications almost all of a paper’s value is derived from being published.

Looking back, my advice to myself would **absolutely** be to try to get the report published. Maybe I could’ve gotten it published and maybe not, but either way it would have been a very valuable learning experience. Incidentally, the report *does* seem to be of value to some people: it’s been cited by two OEIS entries, two published papers, a PhD thesis, and Noam Elkies recently gave a talk referencing it (!!!):

We state several finiteness theorems, outline some of the connections among them, explain how a finiteness proof can be ineffective, and (time permitting) sketch Nagell’s proof and an even more elementary one discovered only 12 years ago by C. Bright.

Maybe I’ll come back to that result and get it formally published some day, but I *already* have more than enough papers on the table. At the very least it’s encouraging to know that I’m in no danger of running out of material to research and write about anytime soon. Even more importantly, I’ve learned how important direction is to achieving your dreams.

I signed up for and took my first salsa class on May 28, 2013. I was absolutely terrified and struggled with the class but nevertheless committed to giving it my best effort for at least five years. It felt like a last-ditch effort: I wanted to improve at forming relationships but I had no idea what I could do to change. I didn’t know if salsa dancing would help, but I reasoned that the terror and incompetence that I felt while salsa dancing was temporary and would disappear once I had years of dancing under my belt. In short, I expected that dancing would eventually become second-nature if I kept at it—and then if nothing else I would be in a better position to improve my social relationships.

I kept that commitment I made 5 years ago, and since then the longest I’ve gone without salsa dancing has been the 1–2 weeks during the Christmas break. The result? Not only has my hypothesis that salsa dancing would eventually feel natural been confirmed, the effects on the rest of my life have been nothing short of transformative. I have a healthy social circle of friends, I’m much less shy to the point I enjoy socializing, and I’m much more comfortable using my physical body for things, even starting other hobbies like weight lifting. And yes, I started getting attention from girls.

For me, salsa dancing was a vehicle for changing one of the things most resistant to change but probably the thing I most needed to change: my identity. Previously my identity was the nerd who excelled at school but struggled at social relationships and as long as I thought of myself in those terms my ability to form social relationships was severely crippled. I had prioritized academics to the exclusion of everything else, and I was proud of it.

What I came to learn was that while taking actions that are at odds with one’s identity feels incredibly awkward and painful, it *is* possible to rewire your identity with consistent effort applied over an extended period of time. This was far from easy, as my identity resisted the change at every step of the way, and I would often slip back into my older more comfortable identity that I had built up over two decades. It would happen reflexively: One Thursday when I had been dancing for over a year I remembered that I would be going out that night to dance. A sudden wave of fear swept over me as I realized that I was going to have to ask girls to dance that night—immediately followed by a wave of relief when I remembered that I did that every week.

Because I started from an identity of almost the polar opposite of a salsa dancer, my case essentially provides a lower-bound on the amount that it is possible to change. I’ve taught and assisted many people taking salsa classes and there are only a few I’ve seen that I would consider less skilled than myself when I started. Nowadays people don’t believe me when I tell them how much I struggled for years in ways which at the time felt scarring. As an example of how exceptionally incompetent I was when I started, my very first salsa social dance of my life was interrupted by a random bystander who asked if I was okay or needed help.

In fact, I’m still struggling, because there is no end point you reach when you know it all. This is perhaps the biggest lesson I’ve learned from 5 years of dancing: the struggle itself is inherently meaningful, and I’ve learned to embrace the struggle as a purposeful and worthwhile part of learning and growing.

]]>\[ \sum_{n=1}^\infty\frac{a^n}{n} = -\ln(1-a) \]

which is valid for $a\in\mathbb{C}$ which satisfies $\lvert a\rvert\leq 1$ and $a\neq 1$. This comes from a simple rewriting of the so-called Mercator series (replace $x$ with $-x$ in the Taylor series of $\ln(1+x)$ and then take the negative).

Then we have

\begin{align*}

\sum_{n=1}^\infty\frac{\cos n}{n} &= \sum_{n=1}^\infty\frac{e^{in}+e^{-in}}{2n} \\

&= -\bigl(\ln(1-e^i)+\ln(1-e^{-i})\bigr)/2 \\

&= -\ln\bigl((1-e^i)(1-e^{-i})\bigr)/2 \\

&= -\ln(2-e^i-e^{-i})/2 \\

&= -\ln(2-2\cos1)/2 \\

&\approx 0.0420195

\end{align*}

since $\lvert e^i\rvert=\lvert e^{-i}\rvert=1$, but $e^i\neq1$ and $e^{-i}\neq1$.

]]>

Our analysis starts off with the Calc 1 identity

\[ \newcommand{\d}{\,\mathrm{d}} \int \sin(nx)\d x = \frac{-\cos(nx)}{n} . \]

From this and the fundamental theorem of calculus, we find that

\[ \int_1^\pi\sin(nx)\d x = \frac{\cos n}{n}-\frac{\cos(n\pi)}{n} = \frac{\cos n}{n}-\frac{(-1)^n}{n} . \]

Rearranging and summing over all $n\geq1$ we get that

\begin{align*}

\sum_{n=1}^\infty \frac{\cos n}{n} &= \sum_{n=1}^\infty\biggl(\frac{(-1)^n}{n}+\int_1^\pi\sin(nx)\d x\biggr) \\

&= \sum_{n=1}^\infty\frac{(-1)^n}{n}+\sum_{n=1}^\infty\int_1^\pi\sin(nx)\d x ,

\end{align*}

assuming that $\sum_{n=1}^\infty(-1)^n/n$ converges—which it does; this series is known as the (negative) alternating harmonic series and is well-known to converge to $-\ln2$. The second is trickier but we have that

\[ \lim_{m\to\infty}\sum_{n=1}^m\int_1^\pi\sin(nx)\d x = \lim_{m\to\infty}\int_1^\pi\sum_{n=1}^m\sin(nx)\d x \]

by the sum rule in integration. By the sum of sines lemma I previously proved the integral on the right simplifies to

\[ \int_1^\pi\frac{\sin(mx)-\sin((m+1)x)+\sin x}{4\sin(x/2)^2}\d x \]

which we now split into a sum of three integrals and deal with them individually.

The third integral does not depend on $m$ and can be dealt with directly. We use the double-angle formula $\sin x=2\sin(x/2)\cos(x/2)$ and the substitution $u:=\sin(x/2)$ to show that

\[ \int\frac{\sin x}{4\sin(x/2)^2}\d x = \int\frac{\cos(x/2)}{2\sin(x/2)}\d x = \int\frac{\mathrm{d}u}{u} = \ln u , \]

and then

\[ I_3 = \int_1^\pi\frac{\sin x}{4\sin(x/2)^2}\d x = \Bigl[\ln(\sin(x/2))\Bigr]_1^\pi = -\ln(\sin(1/2)) . \]

We won’t exactly evaluate the value of $I_1$, but we will show that

\[ I_1 = \int_1^\pi\frac{\sin(mx)}{4\sin(x/2)^2}\d x \to 0 \]

as $m\to\infty$. First, we’ll split the integral into integrals over intervals of length $2\pi/m$, which is the period of the numerator $\sin(mx)$. Letting $l$ be some number between $1$ and $\pi-2\pi/m$, we’ll consider the integral

\[ \int_l^{l+2\pi/m}\frac{\sin(mx)}{4\sin(x/2)^2}\d x \tag{1} . \]

Note that the varying denominator is what makes the integral cumbersome to evaluate—if denominator was constant, the integral would be easy to evaluate, e.g.,

\[ \int_l^{l+2\pi/m}\frac{\sin(mx)}{4\sin(l/2)^2}\d x = 0 \tag{2} \]

because $\sin(mx)=-\sin(m(x+\pi/m))$ for all $x$. Thus we may subtract (2) from (1) without changing its value, and after doing this (1) becomes equal to

\[\int_l^{l+2\pi/m}\frac{\sin(mx)}{4}\biggl(\frac{1}{\sin(x/2)^2}-\frac{1}{\sin(l/2)^2}\biggr)\d x . \tag{3} \]

We now examine the absolute value of the parenthesized expression in (3). Finding a common denominator and using the difference of squared sines identity we find that the the parenthesized expression has absolute value

\[ \frac{\lvert\sin(l/2)^2-\sin(x/2)^2\rvert}{(\sin(x/2)\sin(l/2))^2} = \frac{\lvert\sin((l+x)/2)\sin((l-x)/2)\rvert}{(\sin(x/2)\sin(l/2))^2} . \]

Since $1\leq l\leq x\leq\pi$ the denominator has value at least $\sin(1/2)^4$. Using that $\lvert\sin x\rvert\leq\lvert x\rvert$ and $\lvert\sin x\rvert\leq1$, the numerator has value at most $\lvert l-x\rvert/2$. Since $x-l\leq 2\pi/m$, the parenthesized expression has absolute value at most

\[ \frac{\pi}{m\sin(1/2)^4} . \]

By the M-L inequality the integral (3) has absolute value at most

\[ \frac{2\pi}{m}\cdot\frac{\pi}{4m\sin(1/2)^4} = \frac{\pi^2}{m^2\sin(1/2)^4} . \tag{4} \]

We’re now ready to bound the value of the first integral $I_1$. As motivated above, we split this into pieces by splitting up the interval $[1,\pi]$ via

\[ \int_1^\pi = {\int_1^{(2\pi/m)\lceil m/(2\pi)\rceil}} + {\sum_{k=\lceil m/(2\pi)\rceil}^{\lfloor m/2\rfloor-1}\int_{(2\pi/m)k}^{(2\pi/m)(k+1)}} + {\int_{(2\pi/m)\lfloor m/2\rfloor}^\pi} . \]

The first and last intervals each have length at most $2\pi/m$, whereas each of the middle intervals have length exactly $2\pi/m$. Furthermore, each of the integrals whose intervals have length exactly $2\pi/m$ are of the form of (1), and therefore we may use the expression in (4) to bound their value. The integrals over the first and last intervals may be bounded by a direct application of the M-L inequality, and our final bound on $I_1$ becomes

\[ \begin{gathered} 2\cdot\frac{2\pi}{m}\cdot\frac{1}{4\sin(1/2)^2} + \sum_{k=\lceil2\pi/m\rceil}^{\lfloor m/2\rfloor-1}\frac{\pi^2}{m^2\sin(1/2)^4} \\ \leq \frac{\pi}{m\sin(1/2)^2} + \frac{\pi^2}{2m\sin(1/2)^4} . \end{gathered} \]

This goes to zero as $m$ goes to infinity, so we have that $\lim_{m\to\infty}I_1=0$.

Since $\lim_{m\to\infty}f(m+1)=\lim_{m\to\infty}f(m)$ and $I_2$ is simply $-I_1$ with $m$ replaced by $m+1$, we have that

\[ \lim_{m\to\infty}I_2 = -\lim_{m\to\infty}I_1 = 0 . \]

Continuing from the expression found for $\sum_{n=1}^\infty\cos n/n$ back in the first section, we find that

\[ \sum_{n=1}^\infty\frac{\cos n}{n} = -\ln2 + \lim_{m\to\infty}(I_1+I_2+I_3) = -\ln2-\ln(\sin(1/2)) . \]

This value is approximately $0.042$, and as a nice “double-check” of the above work one finds that this indeed corresponds with the value one gets by adding up many terms of $\sum_{n=1}^\infty\cos n/n$.

The argumentation was brought to my attention in an answer to a Dr. Math question, though the above presentation is mine.

]]>100 prisoners have their names placed in 100 boxes so that each box contains exactly one name. Each prisoner is permitted to look inside 50 boxes of their choice, but is not allowed any communication with the other prisoners. What strategy maximizes the probability that every prisoner finds their own name?

I heard about this puzzle years ago, spent several days thinking about it, and never quite solved it. Actually, I did think of a strategy in which they would succeed with probability over 30% (!), which was the unbelievably-high success rate quoted in the puzzle as I heard it posed. However, I ended up discarding the strategy, as I didn’t think it could possibly work (and probably wouldn’t have been able to prove it would work in any case).

]]>\[ \sin(x)^2-\sin(y)^2 = \sin(x+y)\sin(x-y) . \]

In fact, this is a simple consequence of the sine addition identity

\[ \sin(x\pm y) = \sin x\cos y\pm\cos x\sin y \]

and the fundamental Pythagorean identity $\sin(\theta)^2+\cos(\theta)^2=1$.

The demonstration is a pretty straightforward usage of the above identities, but involves a little bit of trickery—on the third step, we add and subtract the quantity $\sin(x)^2\sin(y)^2$:

\begin{align*}

\sin(x+y)\sin(x-y) &= (\sin x\cos y+\cos x\sin y)(\sin x\cos y-\cos x\sin y) \\

&= \sin(x)^2\cos(y)^2-\cos(x)^2\sin(y)^2 \\

&\qquad+\cos x\sin y\sin x\cos y-\cos x\sin y\sin x\cos y \\

&= \sin(x)^2\cos(y)^2-\cos(x)^2\sin(y)^2 \\

&\qquad+\sin(x)^2\sin(y)^2-\sin(x)^2\sin(y)^2 \\

&= \sin(x)^2(\cos(y)^2+\sin(y)^2) \\

&\qquad-\sin(y)^2(\cos(x)^2+\sin(x)^2) \\

&= \sin(x)^2-\sin(y)^2

\end{align*}

This was not an identity I knew off the top of my head, but it came up on a problem I was working on. We’ll have reason to use it in a later post, which is why I wanted to single it out right now.

]]>

\begin{align*}

\sum_{n=1}^m\sin(nx) &= \sum_{n=1}^m \frac{e^{inx}-e^{-inx}}{2i} \\

&= \frac{1}{2i}\Bigl(e^{ix}\frac{e^{imx}-1}{e^{ix}-1}-e^{-ix}\frac{e^{-imx}-1}{e^{-ix}-1}\Bigr) \\

&= \frac{e^{ix}(e^{-ix}-1)(e^{imx}-1)-e^{-ix}(e^{ix}-1)(e^{-mx}-1)}{2i(e^{ix}-1)(e^{-ix}-1)} \\

&= \frac{(1-e^{ix})(e^{imx}-1)-(1-e^{-ix})(e^{-mx}-1)}{2i(e^{ix/2}-e^{-ix/2})(e^{-ix/2}-e^{ix/2})} \\

&= \frac{e^{imx}-e^{-imx}-(e^{i(m+1)x}-e^{-i(m+1)x})+e^{ix}-e^{-ix}}{-2i(e^{ix/2}-e^{-ix/2})^2} \\

&= \frac{\sin(mx)-\sin((m+1)x)+\sin x}{4((e^{ix/2}-e^{-ix/2})/2i)^2} \\

&= \frac{\sin(mx)-\sin((m+1)x)+\sin x}{4\sin(x/2)^2}

\end{align*}

Most of this is just grunt-work algebra, although in the fourth line a factor of $e^{ix/2}$ was creatively moved from one factor in the denominator to the other. This allows us to write the denominator in terms of sine; the denominator would end up being $2-2\cos x$ if this step was skipped.

]]>

The proof is a straightforward application of the complex exponential expression for sine and cosine:

\begin{align*}

2\sin(1/2)\sin(m+1/2) &= 2\frac{e^{i/2}-e^{-i/2}}{2i}\cdot\frac{e^{i(m+1/2)}-e^{-i(m+1/2)}}{2i} \\

&= \frac{e^{i(m+1)}-e^{im}-e^{-im}+e^{-i(m+1)}}{-2} \\

&= \cos m-\cos(m+1)

\end{align*}

Applying this with $m:=0$ yields $2\sin(1/2)^2=1-\cos 1$, and we have

\begin{align*}

C(m) &= \frac{\cos m-\cos(m+1)}{2(1-\cos 1)}-\frac{1}{2} \\

&= \frac{2\sin(1/2)\sin(m+1/2)}{4\sin(1/2)^2}-\frac{1}{2} \\

&= \frac{\sin(m+1/2)}{2\sin(1/2)}-\frac{1}{2} .

\end{align*}

Written in this form, the naive upper bound on $\lvert C(m)\rvert$ becomes

\[ \frac{1}{2\sin(1/2)}+\frac{1}{2} \approx 1.54 , \]

which is actually slightly better than the previous upper bound we gave of

\[ \frac{1}{1-\cos1}+\frac{1}{2} \approx 2.68 . \]

In fact, it is easy to see that our new upper bound the best possible, since it is reached at for example $m:=(3\pi-1)/2$.

]]>\[ \sum_{n=1}^\infty\frac{\cos n}{n} = \sum_{n=1}^\infty\sum_{m=1}^n\cos m\Bigl(\frac{1}{n}-\frac{1}{n+1}\Bigr) , \]

and then showed that the series on the right converges absolutely, by comparison with the series $\sum_{n=1}^\infty3/n^2$.

Since the series on the right converges and the two series have the same value, the series on the left also converges. However, this does not imply that the series on the left also converges absolutely. As a trivial counterexample, if a conditionally convergent series sums to $c$ then $c\sum_{n=1}^\infty \href{http://en.wikipedia.org/wiki/Kronecker_delta}{\delta_{n,1}}$ is an absolutely convergent series which sums to the same value.

In this post, we answer the question of whether $\sum_{n=1}^\infty\cos n/n$ converges absolutely or not.

First, note that the function $\lvert\cos(x)\rvert+\lvert\cos(x+1)\rvert$ has a positive lower bound (for example, $1/2$), as can be seen from plotting the function:

Now, we note that

\[ \frac{\lvert\cos n\rvert}{n} + \frac{\lvert\cos(n+1)\rvert}{n+1} \geq \frac{\lvert\cos(n)\rvert + \lvert\cos(n+1)\rvert}{n+1} \geq \frac{1}{2(n+1)} . \]

Applying this inequality for all odd $n$ and on each two consecutive terms of $\sum_{n=1}^\infty\lvert\cos(n)\rvert/n$ we find that

\begin{align*}

\sum_{n=1}^\infty\frac{\lvert\cos n\rvert}{n} &\geq \sum_{\text{$n$ odd}}\frac{1}{2(n+1)} \\

&= \sum_{n=1}^\infty\frac{1}{2((2n-1)+1)} \\

&= \sum_{n=1}^\infty\frac{1}{4n} = \infty .

\end{align*}

By the comparison test, we find $\sum_{n=1}^\infty\lvert\cos n\rvert/n$ does not converge, and thus $\sum_{n=1}^\infty\cos n/n$ does not converge absolutely.

]]>Here’s my strategy for the wizards: first, they agree on an ordering of themselves. Each wizard can be indexed by a natural number, since there are countably many of them. They then consider the set of all possible hat configurations $S$ with respect to that ordering. By the well-ordering theorem (which is equivalent to the axiom of choice) a well-ordering of $S$ exists; the wizards also agree on a specific well-ordering.

Note that this step is *non-constructive* because it relies on the axiom of choice. That is, such a well-ordering exists but there may not be a way to explicitly construct it. The point of the note about assuming the axiom of choice was a tip-off that the wizards need to make their decision based off of a set whose existence is only ensured by the axiom of choice.

Once the well-ordering has been chosen the wizards are ready to receive their hats. Once they are able to see everyone else’s hat, they each construct a subset $T$ of $S$ which contains the hat configurations which differ from the configuration they can see in only finitely many hats. The lack of knowledge about a wizard’s own hat is irrelevant to this construction, since that lack of knowledge only changes the configuration they see in finitely many hats. In particular, for every wizard their subset $T$ will consist of the true configuration along with all configurations which differ from the true configuration in finitely many hats, and therefore be the same for all wizards.

Now that all the wizards have constructed the same $T\subset S$, they use the well-ordering of $S$ to find the least element of $T$, and everyone guesses the hat colour which they have in the least element. Since every element of $T$ differs from the true configuration in finitely many hats, the configuration that the wizards guess will also differ in finitely many hats. Thus *almost all* wizards will choose correctly.

I heard about the problem on a list of good logic puzzles compiled by Philip Thomas. I purposely haven’t read his solution yet, since I didn’t want that to influence me while writing down my solution.

]]>