Thursday, May 31, 2018

A Walk to School

Today, I have a problem for you. Cut the philosophical discussion - let's dive right in.
Every morning, Herbosquon II walks 3 miles to school. He lives in Kansas, so we don't have to worry about silly obstructions and buildings - Herbosquon walks straight from point A (his house) to point B (Dennis Rodman's School for Unfortunately Named Children). However, Herbosquon has a problem. 50% of the time, when he goes on his walk, there is an invisible wall at a random point between his house and the school extending for a mile in both directions, perpendicular to his path.

Herbosqon's no dummy - he knows walking straight and having to take a 2-mile detour half the time can't be the most efficient way to do things. What is the best strategy for him to take to minimize his walking distance?

Well, let's simplify our problem a bit. We're looking at a path between two points, $A$ and $B$.


Instead of considering paths between $A$ and $B$, let's consider an equivalent problem: Set the $x$-axis as the line intersecting $A$ and $B$, and set $A$ as the origin. Basically, just rotating the whole problem until the points above are at the same height and shifting it until $A$ is at $(0,0)$. And, consider that any solution to this problem will be totally symmetric - i.e., it will not cross the $x$-axis multiple times (because that would be inefficient) and if we have a solution path in quadrant $1$ we can just reflect it for one in quadrant $4$.

So, now we're just looking at a path between $(0,0)$ and $(3,0)$ (remember - $3$ miles away), subject to our 'invisible wall' rule. Let's call such a path $p(x)$. We want to minimize the length of the walk, so let's calculate the length.

First, on a wall day - If you follow a path $p(x)$, you to $(l,p(l))$ before hitting the wall, and you will then have to travel $1-p(x)$ to get over the wall, and after that, simply a straight line to $B$ of length $\sqrt{1-(3-l)^2}$. Using the formula for arc-length, the length of your path is therefore:
$$\int_0^l \sqrt{1+p'(x)^2}dx+1-p(l)+\sqrt{1-(3-l)^2}$$
So the expected length on a wall day is:
$$\frac{1}{3} \int_0^3 \left(\int_0^u \sqrt{1+p'(x)^2}dx+1-p(u)+\sqrt{1-(3-u)^2}\right)du$$

Now, on a non-wall day, the length is simply the length of our path $\int_0^3 \sqrt{1+p'(x)^2}dx$, and since half of our days are wall-days, we have an average path length of:
\begin{align}
\frac1{6}\int_0^3\left(\int_0^u\sqrt{1+\left(p'(x)\right)^2}dx+1-p(u)+\\
\sqrt{1+(3-u)^2}+3\sqrt{1+\left(p'(u)\right)^2}\right)du
\end{align}
I will leave the details of the simplification to the reader (Hint: Change the order of integration), because it is quite tedious, but this integral can be simplified into this:
$$F(p)=\frac{1}{6}\int_0^3 (6-x)\sqrt{1+p'(x)^2}+1-p(x)+\sqrt{1+(3-x)^2}$$
This is great! Now, we finally have a short expression that we are trying to find a minimal $p(x)$ for. Just for reference, if $p(x)=0$, the straight path, we have $F(p)\approx3.69211$. So, how can we find a function that minimizes this integral? Well, here is where something called the Euler-Lagrange Equation comes in. The Euler-Lagrange equation deals with functionals, functions that take other functions as arguments. For example, we could define $L(f)=f(x)^2+f(x)$. It states that for a functional:

$$S(\boldsymbol q) = \int_a^b L(t,\boldsymbol q(t),\boldsymbol q'(t))\, \mathrm{d}t$$

That we can minimize our function $q(t)$ by solving the ODE:
$$L_q(t,q(t),\dot{q}(t))-\frac{\mathrm{d}}{\mathrm{d}t}L_{q'}(t,q(t),\dot{q}(t)) = 0$$
Where $L_q$ and $L_{q'}$ denote the partial derivatives of $L$ with respect to $q$ and $q'$, respectively. In our example, we have:
$$L(x,p(x),p'(x))= (6-x)\sqrt{1+p'(x)^2}+1-p(x)+\sqrt{1+(3-x)^2}$$
Now we can calculate our partial derivatives:
$${\displaystyle {\frac {\partial F(x,p,p')}{\partial y'}}={\frac {(6-x)y'(x)}{\sqrt {1+y'(x)^{2}}}}\quad {\text{and}}\quad {\frac {\partial F(x,p,p')}{\partial p}}=0}$$
Meaning that the ODE we are solving is:
$$\frac{\mathrm{d}}{\mathrm{d}x}\frac {(6-x)y'(x)}{\sqrt {1+y'(x)^{2}}}=-1$$
We can integrate both sides, re-arrange and integrate again to find:
$$p(x)=c_1-\cfrac{1}{3}(2 c_0+x+6) (c_0+2 x-6) \sqrt{\cfrac{1}{(c_0+6)(6-2x-c_0)}}$$
And since $p(0)=0$ and $p(3)=0$, we can solve directly for our constants. Actually, it's incredibly tedious, so we'll let Mathematica handle it for us. This is the most simplified form of $p(x)$ it could get out:
$$\frac{-3 \sqrt{163+9 \sqrt{57}}-\frac{2 i \sqrt{6
   \left(\sqrt{57}-20\right)-\left(\sqrt{57}-27\right) x} \left(\left(\sqrt{57}-27\right)
   x-6 \left(1+\sqrt{57}\right)\right)}{\sqrt{57}-27}}{6 \sqrt{42}}$$
So it seems Herbosquon has found his optimal curve, but will probably suffer an aneurysm on the way to school trying to calculate his next step. The curve looks like this:


Which, intuitively, seems to check the boxes. Herbosquon will only have to walk an average of $3.64827$ miles a day, saving him just around 100 feet a day! Over the course of $12$ years of schooling, Herbosquon will have saved himself the distance to space, or 25 $F1$ laps! Happy walking, Herbosquon. 


Tuesday, May 30, 2017

Godel and the Foundation of Mathematics

Hey guys! Now that school is over, I have a lot more time to work on these posts. The subject of this post is one of my favorites ever - the very foundations of mathematics itself.  This was adapted from an explanation I gave to one of my friends about Godel's Incompleteness Theorem, and so it is geared towards as general an audience as possible. No mathematical prerequisite - in fact, there will be a severe lack of math. However, there will be a lot of logic, a lot of self-reference, apparent contradictions, and symbolic wizardry that anyone can understand but may take a few read-throughs to really understand.

Without further ado, an explorations of the basis of math.

Have you ever had a kid start asking you “why”?

You: “The sky is blue”
Little Timmy: “Why?”
You: “The way the sun reflects off of the atmosphere”
Little Timmy: “Why?”

... and so on. Eventually it delves into questions that are almost impossible to answer. This was the problem with 19th century mathematics - Why does $1+1=2$, Why does $0=0$? Does that have to be how it is?

The way mathematicians solved this was “axiomatizing” the way that we do mathematics. We created “axioms”, which are just things we assume from the beginning when doing math. It’s stuff like $1+1=2$, $a+b=b+a$, etc. that can’t be proved, but we just assume because they seem to be natural truths. Any set of axioms is called a “formal system”. For example, the set of axioms we usually use is called “ZFC”, and is made of 9 assumptions. From those assumptions we can derive (pretty much) everything in mathematics.

Formal systems can be consistent, or inconsistent. If a formal system is inconsistent, then there is a theorem such that that formal system can prove the theorem to be true, and that formal system can prove the theorem to be false. More generally, a formal system is inconsistent if can prove a contradiction (i.e. $0=1$). A formal system is consistent if there is no such theorem. We believe that our usual set of axioms, ZFC, is consistent, because in the hundreds of years we have done math with it (knowingly or not), no one has discovered a proof of $0=1$ or any other contradiction.

People were very happy with this system of "axioms", and thought they had finally found a foundation for all of mathematics to rest on. They thought it was air-tight. Then, in 1931, a logician named Kurt Godel turn their hopes on their heads. He proved 2 main things:

  1. In any formal system that can do elementary arithmetic, there exists some statements that are true but unprovable.
  2. Any consistent formal system can never prove it's own consistency.

These, respectively, are called the first and second "Incompleteness Theorems" of Godel. I'm going to venture into some tough territory here, and try to outline a proof of both of these theorems to give some intuition as to why they are true.1

First, assign a number to every symbol used in mathematics. Any way will work, but you don’t actually have to construct an explicit method. Just assume that every symbol has an associated number.

Second, construct a function to assign a number to any statement by combining the numbers of each symbol in it. For example, if we just assign A=1, B=2, C=3, etc., “ADD” would be 144.

Third, extend that function to assign a number to any proof (which is, of course, just a bunch of statements that eventually prove something) by combining the numbers associated with every statement within it. So, now we have assigned a number to every theorem, as well as every statement. So, let’s take the statement “1+1=2”. It has a number associated with it, and it's proof also has a different number assigned to it.

Here’s the cool part. Take the number associated with the statement:
$$\text{“The number associated with this statement does not stand for a theorem”}$$By theorem, of course, I mean something provable in our formal system.  Take a moment to process this. Obviously, this statement must be either true or false.

If this statement is false, then that statement is a theorem (because the statement is asserting that it isn’t), which means that statement is true (since something being provable and a theorem means it is true). So, if the statement is false, it's true, a contradiction.

And in mathematics, if something being false implies that that thing is true, it must not be false. So, our statement is true. The number does not stand for a theorem, and since the number stands for that statement, that statement is not a theorem. By our definition of theorem above, that means that statement is not provable, but as I asserted in bold, it’s true.

Therefore, in any system (because we aren’t working in any specific system here), there is at least one unprovable statement, “The number associated with this statement does not stand for a theorem”.

Now, let’s extend this to prove that there are infinite unprovable statements. First, assume that there does exist a system $A$ such that there is only $1$ unprovable statement. Take that unprovable statement, and make a new system $B$ which is just $A$ but with one extra axiom: That unprovable statement is true. So since we already assumed that $1$ unprovable statement to be true in our axioms, $B$ has no unprovable statements. But this contradicts Godel's First Incompleteness Theorem that every formal system has at least $1$ unprovable statement.

The same argument works for any finite amount of unprovable statements - just make a new system where they are axioms, and it violates our theorem. Therefore, every formal system, has an infinite amount of theorems that are unprovable within it.
Exercise 1 For the determined and well-versed reader, prove Godel's Second Incompleteness Theorem using the techniques outlined above. Hint: Note that inconsistency of a formal system is equivalent to $0=1$ in that system. 
I will not try to prove Godel's Second Incompleteness Theorem here, I don't have the talent to outline it in a similar fashion. However, there are many proofs available online for those well-versed in mathematical logic. For now, we will assume it.

These two theorems are amazing in their counter-intuitive nature and their immense power.  The literature, both philosophically and mathematically, on these two theorems is absolutely titanic. For now, I will go over what I believe to be some of the most interesting and and least mainstream consequences.

Starting with the first incompleteness theorem, we have a dilemma if we look at physics. For years, physicists have been trying to make a "Theory of Everything", one theory that describes the whole universe. On a large scale, general relativity does an amazing job of predicting things. On a small scale, quantum mechanics prevails. But try to apply GR to a small scale, or QM to a large scale, and you fail miserably. Physicists have been trying to unite these two theories in attempts such as string theory, M-Theory, supersymmetry, etc. Godel's First Incompleteness Theorem, however, seems to suggest this is impossible.

A "Theory of Everything", at it's core, is a finite set of statements and equations that describes every physical phenomena. But, Godel's First Incompleteness Theorem seems to suggest that any set of axioms cannot prove everything, or describe every phenomena. This has been the subject of much debate between physicists, but comes down to more a question of semantics than actual mathematical formalism.

Now, the Second Incompleteness Theorem, which is my personal favorite. Any consistent formal system can never prove it's own consistency. But let me ask the seemingly obvious question - can a consistent formal system prove it's own inconsistency? Here's something really unintuitive - yes. 

Take any consistent formal system $S$. $S$ cannot prove it's own consistency by the second incompleteness theorem, therefore if we add the axiom that $S$ is inconsistent, there is no contradiction, because there is no proof stating the opposite. So, our new "extended" version of $S$ proves it's own inconsistency yet is consistent. Weird.

A natural question that comes out of this is what happens if we take a formal system $S$, and instead of adding the axiom "$S$ is inconsistent", add the axiom, "$S$ is consistent". Well, let's try it.

Take any formal system, call it $S_0$. Create a new system $S_1$, defined as $$S_0+S_0\text{ is consistent}$$ Where I'm using $+$ to signify adding an axiom.
Now, this system does not, as it first seems, prove it's own consistency and violate our theorem. Within $S_1$, you can prove that $S_0$ is consistent (since it's an axiom), but you cannot prove $S_1$ is consistent. Here's the cool part - we can go farther.

We could make a system $S_2$ defined as $S_1+S_1\text{ is consistent}$. And we can continue this process, defining $S_n$ as $S_{n-1} + S_{n-1} \text{ is consistent}$.
Now, an apparent contradiction arises. Consider $S_\infty$.  Shouldn't this system prove it's own
consistency, since for all $S_n$, $S_{n+1}$ assert's $S_n$'s consistency?

Well, no.  $S_\infty$ proves the statement "$S_n$ is consistent" for every $n$, but $S_\infty$ does not prove the statement "$S_n$ is consistent for every $n$". Note the placement of the quotes. A softer analogy to this is the fact that you can easily take a proof $P$ in a system $S$ and prove that $P$ doesn't prove a contradiction, for every proof $P$ in $S$ (by simply looking at it and asking whether it's result is something like $0=1$). However, you cannot prove that $P$ doesn't prove a contradiction for every proof $P$, as this is literally the definition of consistency of $S$.

All of this is extremely unintuitive, and I don't expect anyone to understand any of it at a first reading. It took me a very long time to wrap my head around this, even with a pretty good background in mathematical logic. If you don't understand something, read it over again and again, google it, and feel free to email me at nicktwoa@gmail.com or contact me through some medium.

Hope you enjoyed!

1Of course, a lot of this is different from the actual proof and very simplified. But it's still true, just more general.

Tuesday, December 13, 2016

The Riemann Hypothesis and Primes

Hey guys! I know it's been awhile, but with exams this week, I've been spending a lot of time recently procrastinating studying. But those are (almost) over now, so it's time for some new stuff! Today, a favorite topic of mine, the Riemann Zeta function, and it's (one of many) connections to the primes! I'm not going to lie, this is going to be a little complicated. But anyone with a cursory knowledge of calculus should be able to grasp it.

By the way, if you don't know what the Riemann Zeta function is, or what a zeta zero is, you should read my last post or do some quick googling.

Now, there is a "common" approach to this problem, which works but is not very elegant, and hard to understand without some concepts in complex analysis. For that reason, and the fact that I can never understand where the apostrophe goes in "Grams Series" (Is it the series belonging to gram, is gram plural, is it the series belonging to my grandmother? So many questions), I will be taking a less known approach.

So, let's jump right in.

Chebyshev introduced the function:
$$ \psi(x) =\sum_{n \leq x} \Lambda(n)$$

Which not only sums prime numbers, but also every power of a prime, but takes its natural log before summing it, because, well, it's math.
Formally, the von Mangoldt function (the big upside down V thing in the sum) is 0 when its argument is not a prime power, and the natural log of it's argument when it is a prime power.

Now, one may feel inclined to ask at this point why we are mucking around with von Mangoldt functions when we have a perfectly good function, $\pi(x)$, that is robust, does it's job, and seems much closer to the actual goal than this one.
The naive answer to this question is that the second Chesbyshev function (the formal name of the function I introduced) is much better approximated by a straight line, and therefore is easier to work with.
Graph of $y=\psi(x)$ over graph of $y=x$
The real answer is that at some point, you have to stop asking these kind of questions and just accept the fact that it will all work out in the end.

Kind of.

So, returning to our original topic, what does this function have to do with the zeta zeroes? Well, first, we define a slightly different function, which is simply the original function except that at its points of discontinuity (the prime powers) it takes the value halfway between the values to the left and the right.
$$ \psi_0(x)=\begin{cases} \psi(x) - \frac{1}{2} \Lambda(x) & x = 2,3,4,5,7,8,9,11,13,16,\dots \\
\psi(x) & \mbox{otherwise.} \end{cases}$$

Now, prepare for your mind to be blown.
$$\psi_0(x) = x - \ln(2\pi) \sum_{\rho} \frac{x^{\rho}}{\rho} - \frac{1}{2} \log (1-\frac{1}{x^2})$$

Where $\rho$ represents the zeroes of the Riemann Zeta function. Let me re-iterate: You can express a formula for primes in terms of only zeta zeroes. Insane, right? But surely, there must be some explanation for this explicit, incredible formula in its proof?

Nope. This is simply a result of applying Perron's Formula to our original definition, which leaves you with a complex integral of the function $\frac{\zeta ' (s)}{\zeta(s)}\frac{x^s}{s}$ over $\mathbb{C}$, do some contour integration using rectangular contours, and evaluate the integral in terms of the residues of the integrand. The details of this integration will be left as an exercise to the reader.

Fun fact: The $\ln(2\pi)$ in our wonderful formula comes from the fact that $\frac{\zeta ' (0)}{\zeta(0)}=\ln(2\pi)$.

Here's the fun part. It is immediately obvious from the explicit formula that we can calculate this $\psi_0(x)$ function by taking $x-\ln(2\pi)-1/2\ln(1-\frac{1}{x^2})$ and adding pairs of these zeta zero functions, since this sum is taken over both negative and positive zeroes:
$$\frac{x^p}{p}+\frac{x^\overline{p}}{\overline{p}}$$

Using this, we can finally approximate our prime power sum function $\psi_0(x)$, using only zeta zeroes. Here is a gif of our function gradually approximated by the first 50 pairs of zeta zeroes.


Connections like these are rare in math, but they seem to pop up everywhere with the Riemann Zeta function. It's almost creepy how mysterious this function is. In fact, a few years ago, the zeta zeroes were found in the energy levels of quantum particles, of all thingw. It's one of the most astounding and deep functions in all of number theory, and I encourage each and every one of you to research it, because it is simply mind-boggling. 

And we still have no idea why.

Friday, August 26, 2016

The Riemann Hypothesis for Anyone

One of the longest standing conjectures in mathematics has been the ever elusive "Riemann Hypothesis" (RH). A proof of RH would have giant repercussions throughout not just pure mathematics, but physics as well. There are hundreds are equivalent forms, but perhaps the most famous is the simple question, "Is there some order in the distribution of the primes?". Most people just accept this as an answer, but it really isn't. So, after reading a few books and a few articles, I want to explain, in layman's terms, what the Riemann Hypothesis actually is.

To begin, let's talk about Euler. Euler was a 17th-century mathematician who was famous, among many other things, for his work on the harmonic series. The harmonic series is defined as the following:

$$\frac11+\frac12+\frac13+\frac14...$$

This series blows up to infinity, and it is relatively simple to prove so. Mathematicians had known such a result for hundreds of years before Euler. But what Euler was concerned with was that same series, but with the denominators raised to an integer power.

$$\frac{1}{1^s}+\frac{1}{2^s}+\frac{1}{3^s}+\frac{1}{4^s}...$$

Euler went on to prove wonderful things about this function, which you can learn more about in my earlier blog post, but it was Riemann who really analyzed this function, and extended it to the complex plane.

So, what is the complex plane? Well, let's first talk about i. The number i is defined as $\sqrt{-1}$. To most people, this seems like an absolute absurdity. How can a negative number be square rooted? There are no solutions to $x^2=-1$! But, to put this in perspective, take another equation. $x+2=0$. Well, obviously, x is -2. But to people in the early centuries, they thought of negative numbers in the way most people think of imaginary numbers (i and multiples of i). We are simply extending our number system in order to provide solutions to an equation. But the real fun comes when we have complex numbers. A complex number is of the form $x+yi$, where $x$ and $y$ are real numbers. Now, remember from your days of schooling, plotting on an x y graph. Well, if we take an x y plane, can't we just treat x and y as x and y in our complex number equation? Here lies the complex plane:





The y is our imaginary numbers, and the x is our real numbers. So if x is 2 and y is -2i, our complex number is 2+-2i. 

Bringing it back to the Riemann zeta function, Riemann found a genius way to extend the function so that the denominators could be raised to complex number powers. After doing this, he wondered about where this function equaled 0. He knew that if he plugged in any negative even number (-2, -4, -6, etc) into his function, it would be 0. These are called the trivial zeroes of the zeta function. But, looking at the graph of the zeroes, you should see a pattern:

All of these zeroes that are not trivial (called, aptly, nontrivial zeroes), seem to lie on one line, specifically x=1/2. The Riemann Hypothesis is the statement that all the nontrivial zeroes lie on that line. We have searched extremely far, and so far nothing has told us otherwise. We also know more than 40% of the zeroes line on the critical line, and that none lie off the line for less than $10^{20}$. 

We are so sure of ourselves that many proofs nowadays start with "Assuming the Riemann hypothesis..." But we are yet to find a proof, or really even come close to one. This is the true Riemann hypothesis, and (perhaps) in my next post I will talk about how it relates to the primes, and some attempts made at cracking it. Thank you so much for reading, and I'll see you in the next post!












Tuesday, August 16, 2016

A Mathematical Gem Explained With an Elegant Proof

There is so much beauty in mathematics - past the quadratic equations of your horrid algebra class and the tedious long division that seems to be present in every single badly-constructed problem.
There are gems, things that you simply wouldn't believe, that leave people's jaws hanging open thinking that something must be fundamentally wrong with the universe in order to allow for such an insane equality. But most of that doesn't get taught in math classes, because it's "above" the level of most common core math classes. I'm here today to prove that as a falsehood and introduce to you one of the most exciting functions in all of mathematics: $\zeta(s)$

Now, I don't believe I have the ability nor the writing talent to provide a proof of the following that any layperson could understand. So, in this, I'm going to assume a basic knowledge of calculus, including what an integral is, how to integrate, and what sin and cos are.

So - first, let's get a refresher on the cool concept of an "infinite sum". Most people assume that if you add up an infinite amount of positive terms, you will end up with infinity. Well, that's not actually right. Under certain conditions, an infinite sum will slowly come creeping up to a certain number and never surpass it. In that case, we say the infinite sum converges to that number. 
How about an example? Well, let's ask the question, what is the value of the following sum?
$$1+\frac12+\frac13+\frac14+\frac15+\frac16...$$

It turns out the answer is that it blows up to infinity, making the above a bad question. Let's instead look at that same series but with all the denominators squared:
$$1+\frac{1}{2^2}+\frac{1}{3^2}+\frac{1}{4^2}+\frac{1}{5^2}+\frac{1}{6^2}...$$

Miraculously, it turns out this series converges to a number:
$$\frac{\pi^2}{6}\tag1$$

To me, this is absolutely insane. Pi is the ratio of a circle's circumference to it's diameter, so what is it doing popping up in infinite sums? Well - this blog post is about exactly that. 
So first, let's introduce some notation. Instead of expressing the infinite sum in terms of a few terms and then ellipsis, we have a precise notation:
$$S=\sum_{n=1}^{\infty}\frac{1}{n^2}$$

Let's break this down. Because I know most of the people reading this are going to be programming people, it's like a big for loop or repeat loop. We start with $S=0$, and then we add $\frac{1}{n^2}$ to it for $n=1$ (which is why the bottom of the sum says $n=1$). Then, we add $\frac{1}{n^2}$ to it for $n=2$. Then for $n=3$. And so on, all the way to infinity. 

And we don't have to just square the number. We're interested in raising it to every power. In general, that sum with the denominator raised to the $s^{th}$ power is called $\zeta(s)$. We are going to talk about $\zeta(2)$. 

Now that we have introduced the notation, how do we actually prove our original theorem $(1)$? Well, here is the hard part. I will now introduce the concept of a Fourier Series. A Fourier series is a way of approximating a function in a certain range as a sum of sines and cosines. Let's say we have the graph of $x^2$ between $-\pi$ and $pi$. Call this $f(x)$. We can then, using a Fourier series, create an infinite sum that models this curve exactly. This infinite sum will be the sum of $\cos(x*n)$ multiplied by the nth term of $a$ (a is a list of numbers) plus  $\sin(x*n)$ multiplied by the nth term of $b$ (b is also a list of numbers). That whole infinite sum will then be added to the first term of $a$ (actually the zeroth term, 'cause we index from zero like real men) over 2. Expressed using our notation:
$$\dfrac{a_{0}}{2}+\sum_{n=1}^{\infty }(a_{n}\cos nx+b_{n}\sin x)$$ 

So, the problem is finding what the nth term of a and b is. 
Well, thanks to the man himself (Fourier), we know that:
$$a_{n}=\dfrac{1}{\pi }\int_{-\pi }^{\pi }f(x)\cos nx\;dx\qquad n=0,1,2,3,...,$$ 
$$b_{n}=\dfrac{1}{\pi }\int_{-\pi }^{\pi }f(x)\sin nx\;dx\qquad n=1,2,3,... .$$ 

The graph of the integrand of $b_n$ looks like this:

The lines intersect y=0 at our integral bounds, and recalling that the definition of the integral is the area under the curve, since the curve is mirrored on both sides of the x axis, they cancel out which means $b_n$ is always 0. This reduces our equation to:

$$\dfrac{a_{0}}{2}+\sum_{n=1}^{\infty }(a_{n}\cos nx)$$ 

So all we  have to do is integrate $a_n$. This can be done by changing the integral bounds to 0, Pi, observing the antiderivative of the integrand and evaluating at the limits. For a more in-depthh explanation of how to integrate, just message me on whatever platform you know me from or at my email. 

But, in the end, we get:
$$a_{n}=(-1)^{n}\dfrac{4}{n^{2}}$$
Excluding the special case of $a=0$, which can be easily integrated to be $\frac{2\pi^2}{3}$.

Thus

$$f(x)=\dfrac{\pi ^{2}}{3}+\sum_{n=1}^{\infty }\left( (-1)^{n}\dfrac{4}{n^{2}}\cos nx\right) .$$

Remembering that $f(x)=x^2$, which is the function we just found the fourier series of,  $f(\pi )=\pi ^{2}$, plugging in $\pi$ for x, we obtain

$$\pi ^{2}=\dfrac{\pi ^{2}}{3}+\sum_{n=1}^{\infty }\left( (-1)^{n}\dfrac{4}{n^{2}}\cos \left( n\pi \right) \right) $$ 

Extracting the constant 4 from the sum and simplifying:
$$\pi ^{2}=\dfrac{\pi ^{2}}{3}+4\sum_{n=1}^{\infty }\left( (-1)^{n}(-1)^{n}\dfrac{1}{n^{2}}\right) $$

$$\pi ^{2}=\dfrac{\pi ^{2}}{3}+4\sum_{n=1}^{\infty }\dfrac{1}{n^{2}}.$$

Therefore

$$\sum_{n=1}^{\infty }\dfrac{1}{n^{2}}=\dfrac{\pi ^{2}}{4}-\dfrac{\pi ^{2}}{12}=\dfrac{\pi ^{2}}{6}$$

It always is so baffling how you think such a result is so impossible, but then just show, with cold hard logic, that it must be true. It seems insane, but it's true. I am sorry that I sort of jumped around in difficulty levels, if you need further clarification on something feel free to contact me via email, Twitter, Hopscotch forum, or whatever. Thank you so much for reading through, and I'll see you in the next (less math-y) post! :D







Tuesday, July 19, 2016

A tricky equation

Hey guys! First blog post. I wanna share with you, the story of a seemingly easy but startlingly complex equation I stumbled upon.

$$y^2=x^3-2$$

To add to it, this was in our rising 8th 'math placement' worksheet, right next to a question about finding the area of a square with a width of 5. So, naturally, I thought it was going to be easy. But upon further inspection, after attacking it with many tools of Algebra 1, I hadn't even made a dent.

It is hard not to show that the question is equivalent to finding a perfect square that is 2 less than a perfect cube (I should mention we are looking for non negative integral solutions). Well, immediately, a solution sprang to mind. $(3,5)$. $3^3=27$, $5^2=25$. Looking back, I think that's all the teacher wanted us to do. Find that solution by trial and error. But, was it the only solution?

Looking back, I could have spared myself a lot of time and energy if I just assumed that solution was the only one and moved on with my life. But that's not how we roll :)
So, the first thing to do was an exhaustive search. I checked it up to $100,000$, and it seemed like there were no other solutions. But remember, a pattern is not a proof. Remember Richard Guy's conjecture that $\gcd(n^{17}+9, (n+1)^{17}+9)$ is always 1? Well, the first counterexample is $$n=8424432925592889329288197322308900672459420460792433$$.
So yeah, an exhaustive search is not a proof. We are here for mathematical rigor.

Well, first, let's establish some preliminary results.
Assuming there is an $x$ and $y$ other than $(3,5)$, both x and y would have to be odd.
Proof:
Assume $x$ is even. Then, $x$ can be expressed as $2z$ for some integer z. So $x^3$ can be expressed as $8z^3$ Rearranging the original equation with these new terms, we get:
$$y^2+2=8z^3$$
And it is, from that, obvious that $y^2+2$ is a multiple of 8. We can also express this as a modular congruence. But before I do that, let me explain what modular congruence is.

For a positive integer $n$, two integers $a$ and $b$ are called congruent if their difference $a-b$  is a multiple of $n$. This is notated:
$$a \equiv b \pmod{n}$$
Notice that is not an equals sign, it's 3 bars.
So, we know the difference between $y^2$ and $-2$ is a multiple of 8. We can notate this:
$$y^2 \equiv -2 \pmod{8}$$
However, $-2 \pmod{8}$ is not a perfect square, so $y^2$ is not even, which implies $x^3$ is not even (Because $x^3$ is $y^2+2$ and and odd number plus two is always odd), which implies both $x$ and $y$ are not even.
So, we have established that both $x$ and $y$ are odd. Now what? Well, here is where it gets a bit tricky.

First, from now on we will be working with the equivalent equation:
$$y^2+2=x^3$$
Which was gotten by simply adding 2 to both sides.
We can factor this equation quite easily:
$$x^3=(y+\sqrt{-2})(y-\sqrt{-2})$$

Now, at this point, I got stuck. I had no idea what do from here. I tried a bunch of different stuff, but nothing worked. But after a few days of thinking, some help from the Math Stackexchange + some personal stupidity worked out.

I am going to prove that $(y+\sqrt{-2})$ and $(y-\sqrt{-2})$ are relatively prime (i.e they share no factors) within $Z[\sqrt{-2}]$. Now, to understand what that means, consider the set of all integers. Well, we can do operations outside of just the numbers. $\mathbb{Z}[\sqrt{-2}]$ is  the set of all numbers of the form $(m+n\sqrt{-2})$ where $m$ and $n$ are integers. So, to say that $(y+\sqrt{-2})$ and $(y-\sqrt{-2})$ are relatively prime in $\mathbb{Z}[\sqrt{2}]$ means they have no common factors within that set other than 1)
To prove this, let us consider a variable $d$ which is a common divisor. $d$ divides their difference: $$(y+\sqrt{-2})-(y-\sqrt{-2})=2\sqrt{2}$$
Which means $N(d)$ divides $N(2\sqrt{2})=8$* but $N(d)$ also divides $N(y+\sqrt{-2})=y^2+2$, which is odd because $y$ is odd, as we established.  And the only factor of 8 that also divides odd numbers is $1$. So because $N(d)$ is 1, $d$ is a unit in $\mathbb{Z}[\sqrt{-2}]$. So, $(y+\sqrt{-2})$ and $(y-\sqrt{-2})$ are both unit multiples of $+1$ and $-1$. Those are both cubes, so $(y+\sqrt{-2})$ and $(y-\sqrt{-2})$ are both cubes. We can express it this way:

$$y+\sqrt{-2}=(m+n\sqrt{-2})^3$$
For some integers $m$ and $n$.
Distributing and subtracting the square root gives us:
$$y = m^3 − 6mn^2 = m(m^2 − 6n^2 ), 1 = 3m^2n − 2n 3 = n(3m^2 − 2n^2 )$$
And from this we can extract solutions, with the help of Mathematica.
From the second equation, $n=\pm{1}$. When $n = 1$ the second equation says $1 = 3m^2 − 2$, so $m = \pm1$. Then $y = \pm1(1 − 6) = ±5$ and $x^3 = y^2 + 2 = 27$, so we recover the solutions $(x, y) = (3, \pm5)$. When $n = −1$ we have $1 = −(3m2 − 2 \cdot 1^2 ) = −(3m2 − 2)$, so $1 = 3m^2$ , which has no solution in $\mathbb{Z}$. (Thanks to Andre Nicolas on MSE for pointing this out)

So boom, there we go! We have extracted the solutions from this equation. I'm not sure it's what our math teacher wanted us to do... but, it was fun in any case :) See you in the next post!

*$N(m+n\sqrt{D})=a^2+Db^2$
Note: To actual people who know a lot more math than me, this might seem like a very shaky proof. I'm putting out a lot of assumptions and not really explaining a lot of things in depth. This is because I didn't want to get too into unique factorization domains and modular arithmetic. If you do want to discuss it in depth, feel free to email me!
Also, a lot of it is probably wrong! I had mathematica check most of it for me, but diving straight into something like this with no experience probably means my logic is flawed in places. For