Well, I just couldn't help myself, because you guys were so interested in the Gaussian integers. Here is the basics of the argument for why primes of the form $4n+1$ can be written as a sum of squares, the complex numbers version!
Naturally, I am skipping whether we actually have unique factorization in $\mathbb{Z}[i]$. (It turns out you can prove this most easily using geometry as well!)
But this has some interesting implications that will serve us well going into our next topics. Think about the following two problems.
These are very natural generalizations. How could we approach them?
Fact: No number $$n\equiv 5\text{ or }n\equiv 7\text{ mod }(8)$$ can be written as $x^2+2y^2$.
Proof: Try all numbers modulo 8 and see what is possible!
So unsurprisingly, already Fermat claimed a partial converse  that any prime $p$ which is $p\equiv 1$ or $p\equiv 3\text{ mod }(8)$ could be written as a sum of a square and twice a square.
It turns out that Euler wasn't the one who proved that! But you could almost imagine that by factoring $$x^2+2y^2=(x\sqrt{2}iy)(x+\sqrt{2}iy)$$ you could start proving such things... and we will return to that idea again in passing.
[0, 1, 2, 3, 4, 6, 8, 9, 9, 11, 12, 16, 17, 18, 18, 19, 22, 24, 25, 27, 27, 32, 33, 33, 34, 36, 36, 38, 41, 43, 44, 48, 49, 50, 51, 51, 54, 54, 57, 57, 59, 64, 66, 66, 67, 68, 72, 72, 73, 75, 76, 81, 81, 81, 82, 83, 86, 88, 89, 96, 97, 98, 99, 99, 99, 100, 102, 102, 107, 108, 108, 113, 114, 114, 118, 121, 123, 128, 129, 131, 132, 132, 134, 136, 137, 144, 147, 150, 153, 153, 162, 162, 163, 164, 166, 171, 172, 177, 178, 179, 187, 192, 198, 198, 200, 201, 204, 209, 209, 211, 216, 225, 226, 228, 236, 243, 249, 262, 264, 281, 300] [0, 1, 2, 3, 4, 6, 8, 9, 9, 11, 12, 16, 17, 18, 18, 19, 22, 24, 25, 27, 27, 32, 33, 33, 34, 36, 36, 38, 41, 43, 44, 48, 49, 50, 51, 51, 54, 54, 57, 57, 59, 64, 66, 66, 67, 68, 72, 72, 73, 75, 76, 81, 81, 81, 82, 83, 86, 88, 89, 96, 97, 98, 99, 99, 99, 100, 102, 102, 107, 108, 108, 113, 114, 114, 118, 121, 123, 128, 129, 131, 132, 132, 134, 136, 137, 144, 147, 150, 153, 153, 162, 162, 163, 164, 166, 171, 172, 177, 178, 179, 187, 192, 198, 198, 200, 201, 204, 209, 209, 211, 216, 225, 226, 228, 236, 243, 249, 262, 264, 281, 300] 
But before we do, we will go more in depth with looking at what points are even possible on such a curve. Remember, if $x^2+y^2=n$ was a circle of radius $\sqrt{n}$, then $x^2+2y^2=n$ must be an ellipse! So we will spend a few days looking at the notion of (integer) lattice points on a curve.
It is a question at the heart of modern number theory, so we should at least spend a little more time on it  plus, it has such nice pictures! It turns out it will have a surprising connection to calculus and group theory too.
Click to the left again to hide and once more to show the dynamic interactive window 
We we are going to do is to try to make our way to finding integer solutions to some more difficult Diophantine equations, but slowly, using an idea which simplifies Pythagorean triple geometry.
Remember that we thought of Pythagorean triples as solutions to $$x^2+y^2=z^2\; .$$ Namely, let's divide the whole Pythagorean thing by $z^2$: $$\frac{x^2}{z^2}+\frac{y^2}{z^2}=1\Rightarrow \left(\frac{x}{z}\right)^2+\left(\frac{y}{z}\right)^2=1\, .$$ Since we can always get any two rational numbers to get a common denominator, what that means is the Pythagorean problem is the same as finding all rational solutions to $$a^2+b^2=1\, ,$$ which seems to be a very different problem. Let's investigate this.
Click to the left again to hide and once more to show the dynamic interactive window 
The blue line intersects the circle $x^2+y^2=1$ in the point $(1,0)$ and has rational slope denoted by 'slope'. If you change the variable 'slope', then the line will change. It is not a hard exercise to see that the line through two rational points on a curve will have rational slope, nor what its formula is, so that every rational point on the circle is gotten by intersecting $(1,0)$ with a line with rational slope.
It is a little harder to show that intersecting such a line with the circle always gives a rational point, but this is also true! It is also far more useful, as it gives us a technique to find all rational points and hence all Pythagorean triples. Here are the details:
Even the inputs $t=0$ and $t=\infty$ have an appropriate interpretation in this framework, believe it or not. Such a description of the (rational) points of the circle is called a parametrization. Plug in various $t$ and see what you get!
Note that the book started with $(1,0)$, and also got a parametrization  in fact, a slightly different one. Will this always work? Here is an amazing fact we will not prove.
Fact: If you have a quadratic equation with rational coefficients with at least one rational point, then you can get all others by intersecting all lines with rational slope through that point on the curve.
Click to the left again to hide and once more to show the dynamic interactive window 
Once again, the line above goes through $(1,0)$ and so has equation $y=t(x1)$. The ellipse is $x^2+3y^2=1$, so that $$x^2+3t^2(x1)^2=1\Rightarrow x^2+3t^2x^26t^2x+3t^21=0$$ is the equation we must solve for $x$ to find a parametrization of $x$ in terms of $t$. This seems daunting; however, we already know that there is a solution $x=1$, so that $x1$ must be a factor of the expression! So we could factor it out if we wished. Alternately, we could use the quadratic formula and discard the solution $x=1$. Let's do that now!
At the end we should get $x=\frac{3t^21}{3t^2+1},y=\frac{2t}{3t^2+1}$, which leads to very interesting solutions like $\left(\frac{11}{13},\frac{4}{13}\right)$.

And such solutions lead us directly to INTEGER solutions of equations like $x^2+3y^2=z^2$! Since $x$ and $y$ have a common denominator, we can just multiply through by the square of that denominator to get a solution to this. E.g. $$11^2+3(4)^2=13^2$$ which is rather nonobvious solution, to say the least, and only one of many that this method can help us find.
However, this method does NOT always work. Namely, you need at least one rational point to start off with. And what if there isn't one that exists? It turns out that Diophantus already knew of some such curves:
Fact: $x^2+y^2=15$ has no rational points.
The way to prove this is to correspond this to integer points on $x^2+y^2=15z^2$. Every rational point on the first curve looks like $(p/q,r/q)$ for some $p,r,q\in\mathbb{Z}$, so multiplying through by the common denominator gives us integer points on the second surface. But now consider the whole thing modulo 4  what are the possibilities?

So as we can see there are NO rational points on a circle of radius $\sqrt{15}$ because there are no integer points on the corresponding surface other than ones with $x,y=0$  and those correspond to $z=0$, which would give a zero denominator on the circle. Here is a place where rational points are helped by integer points instead of vice versa.
Another one to try is finding rational points on the ellipse $2x^2+3y^2=1$, which would correspond to $2x^2+3y^2=z^2$. Here a different technique might help  look at it modulo 3! In this case it reduces to $$2\equiv (zx^{1})^2\text{ mod }(3)$$ which is impossible since $[0],[1],[2]$ all square to $[0]$ or $[1]$ in $\mathbb{Z}_3$.
In any case, our investigation of integer points has led us through rational points back to integer points! Next time we will look at some remarkable properties that sets of integer points on certain curves have, and whether any such points even exist. With that in view, let's take any remaining time by trying to find integer points on the following curves:
We've already discussed the first one in the context of Bachet and Euler discussing that $$3^3=5^2+2$$ seeming to be the only possible solution. It is one of a more general type called the Mordell equation ($y^3=x^2+k$). Mordell had a lot to do with these; notice that unlike the others discussed today, it is not quadratic/conic but rather cubic, which makes them far more mysterious  and useful for cryptography, though we won't get into that.
The second is of a type often called Pell's equation; it is just a hyperbola. In the event, Pell did not have anything to do with them.
Click to the left again to hide and once more to show the dynamic interactive window 
Click to the left again to hide and once more to show the dynamic interactive window 
The homework, due Monday:
