tildedave.comWebsite of Dave King, Bay Area Software person
http://www.tildedave.com
Why I've Stopped Playing Video Games<p>It’s been over a year since I spent any real time playing a video game. Video games have always been a force in my life - sometimes positive, often negative. I got obsessed with video games early; my parents are convinced that I learned to spell through the King’s Quest franchise, the early entries of which required you type out the action that your character is doing. I was a very motivated 6 year old.</p>
<p>In grad school I was one of the many who spent entirely too much time in World of Warcraft. I was seriously depressed in graduate school, for extremely typical reasons. Graduate school gives you very unclear goals beyond “finish your thesis” and the sense of progression was not there for me in my last two years. I would be submitting papers to conferences and if the paper got in, I’d be closer to finishing my thesis … but if my paper didn’t get in, we’d have to retool it and submit it to a different conference. Maybe it would get in there and then I’d be able to finish, but if not… another six months. I escaped from this hell into a world with clear systems and a sense of progression, where I got pretty good at pumping out a bunch of damage to raid bosses. This made me a lot more useful to my guild than whatever I was doing for my thesis projects on a week-to-week basis.</p>
<p>My most recent (last?) obsessions were with the Souls games, primarily Dark Souls and Bloodborne. These games present you with large worlds where you spend a lot of advancing your character’s stats, exploring the world, and learning the attack pattern of some <a href="https://www.youtube.com/watch?v=3HlXDYIOt4U">absurdly difficult bosses</a>. My real joy with these games came from achieving a familiarity with their systems that let me just glide through the world and, for lack of a better term, ‘dick around’. Use a weapon you’ve never used before, emphasize a certain set of stats that you’ve never tried, take the fastest route to get all the items you want, and so forth. These games weren’t just fun to play, they were also fun to replay, with the goal being achieving a kind of zen perfection with them.</p>
<p>With an actual job I’d had less time to pour into video games, and my ‘game time’ has receded for the last ten years. After the hours upon hours I’ve spent hooked to a screen, I feel a kind of physical revulsion after playing time now. I would sit down and then stand up hours later - the time would disappear. Looking back, the pattern has been to escape into these virtual worlds when something isn’t working in my life. Maybe I’ll need to escape again at some point, but gaming is no longer a healthy activity I want as part of a balanced life.</p>
<h2 id="however">However,</h2>
<p>The only reason I have the life I do is because of video games. Watching my dad play Infocom games and ADVENT made me want to learn how to make those kinds of games myself, and I spent hours and hours in junior high filling notebooks with worlds I wanted to create, which I eventually did - I must have created at least 20 distinct text adventure games in QBasic which used a primitive event loop that let your character move through the world, take items, and fight enemies. (I even figured out how to implement a save game state - good job, 13 year-old Dave). In college I spent hours building systems in <a href="/2011/12/28/mushcode-functional-programming-the-really-hard-way.html">MUSHCode</a>, including a vast amount of work into a space system that didn’t end up ever getting used out of internal tests. (It doesn’t matter, it was super fun to code.) My career nowadays uses the skills that I grew out of this crazed obsession.</p>
<p>Looking at the games that dominate today’s landscape, that sense of accessibility is gone. Game studios are larger than movie studios now, and no 13 year old is going to be able to figure out how to build something with the complexity of Fortnite from ‘first principles’. Yes, tools like Scratch allow kids to create games, but I don’t think this is the same thing. When I was a kid, <a href="https://en.wikipedia.org/wiki/Logo_(programming_language)">Logo</a> was our version of this same concept. You’d tell the turtle to move, and it would move. I certainly didn’t care about that. I cared about making games that looked like the games I could play at home. Today’s youth won’t have those opportunities now because the industry has changed, and that’s unfortunate.</p>
Fri, 15 Mar 2019 00:00:00 -0700
http://www.tildedave.com/2019/03/15/i-am-no-longer-a-gamer.html
http://www.tildedave.com/2019/03/15/i-am-no-longer-a-gamer.htmlExamples of Factoring in Biquadratic Fields<p>This is a solution to Exercises 4.6 and a partial solution to exercise 4.7 in Daniel A. Marcus, <em>Number Fields</em>.</p>
<p>Let <script type="math/tex">K = \mathbb{Q}[\sqrt{m}, \sqrt{n}]</script> be a field extension of the rational numbers <script type="math/tex">\mathbb{Q}</script>. <script type="math/tex">K</script> has degree 4 and contains three quadratic subfields: <script type="math/tex">\mathbb{Q}[\sqrt{m}]</script>, <script type="math/tex">\mathbb{Q}[\sqrt{m}]</script>, and <script type="math/tex">\mathbb{Q}[\sqrt{k}]</script>, where <script type="math/tex">k = \frac{mn}{\text{gcd}(m, n)^2}</script>. The Galois group of this field extension is the Klein 4-group, which has three normal subgroups. Let <script type="math/tex">p</script> be a prime of <script type="math/tex">\mathbb{Z}</script>. Take <script type="math/tex">R</script> to be the ring of integers of <script type="math/tex">K</script>.</p>
<p>Let <script type="math/tex">P</script> be a prime ideal with <script type="math/tex">Q</script> a prime lying over <script type="math/tex">P</script>. If <script type="math/tex">K</script> is a normal extension of the rationals with Galois Group <script type="math/tex">G</script>, then the decomposition group <script type="math/tex">D</script> of <script type="math/tex">P</script> is the subgroup of <script type="math/tex">G</script> containing all <script type="math/tex">\sigma</script> such that <script type="math/tex">\sigma(Q) = Q</script>. The inertia group <script type="math/tex">E</script> for a prime ideal <script type="math/tex">P</script> is the subgroup of <script type="math/tex">G</script> containing all <script type="math/tex">\sigma</script> such that <script type="math/tex">\sigma(\alpha) \equiv \alpha\ \text{mod}\ Q</script> for <script type="math/tex">\alpha</script> an algebraic integer of <script type="math/tex">K</script>.</p>
<h2 id="background-factoring-in-quadratic-fields">Background: Factoring in Quadratic Fields</h2>
<p>Let <script type="math/tex">m</script> be a squarefree integer.</p>
<p>Let <script type="math/tex">p = 2</script>. <script type="math/tex">p</script> ramifies if <script type="math/tex">m \equiv 0, 2, 3\ (4)</script> since the discriminant of the quadratic subfield is even in these cases. <script type="math/tex">2R</script> splits if <script type="math/tex">m \equiv 1\ (4)</script>.</p>
<p>Let <script type="math/tex">p</script> be an odd prime. If <script type="math/tex">p \mid m</script>, then <script type="math/tex">p</script> ramifies. If <script type="math/tex">m</script> is a quadratic residue mod <script type="math/tex">p</script>, then <script type="math/tex">p</script> splits in <script type="math/tex">\mathbb{Q}[\sqrt{m}]</script>. Otherwise <script type="math/tex">p</script> remains prime (<em>inert</em>).</p>
<h2 id="p-ramified-in-every-subfield"><script type="math/tex">p</script> ramified in every subfield</h2>
<p>If <script type="math/tex">p</script> is ramified in each of the subfields then <script type="math/tex">p</script> is totally ramified in <script type="math/tex">K</script>. <script type="math/tex">p</script> being totally ramified implies that the both the decomposition and inertia groups of <script type="math/tex">p</script> over <script type="math/tex">R</script> are the entire Galois group. To find an example we need to find <script type="math/tex">m, n</script> such that <script type="math/tex">p</script> divides both <script type="math/tex">m</script> and <script type="math/tex">n</script> along with the <script type="math/tex">k</script> expression above.</p>
<p>Take <script type="math/tex">K = \mathbb{Q}[\sqrt{2}, \sqrt{3}]</script>, so <script type="math/tex">m = 2</script> and <script type="math/tex">n = 3</script>. <script type="math/tex">K</script> then contains the subfields <script type="math/tex">K_1 = \mathbb{Q}[\sqrt{2}]</script>, <script type="math/tex">K_2 = \mathbb{Q}[\sqrt{3}]</script>, and <script type="math/tex">K_3 = \mathbb{Q}[\sqrt{6}]</script> with corresponding ring of integers <script type="math/tex">R_1, R_2, R_3</script> and discriminants <script type="math/tex">8, 12, 24</script>. The prime <script type="math/tex">p = 2</script> ramifies in each of these subfields.</p>
<p>We can confirm this in Sage:</p>
<div class="highlighter-rouge"><pre class="highlight"><code>sage: for i in [2, 3, 6]:
....: print(QuadraticField(i).ideal(2).factor())
....:
(Fractional ideal (a))^2
(Fractional ideal (a + 1))^2
(Fractional ideal (-a + 2))^2
sage: L = QQ.extension(x^2 - 2, 'a').extension(x^2 - 3, 'b')
sage: L.absolute_polynomial()
x^4 - 10*x^2 + 1
sage: L = QQ.extension(x^4 - 10*x^2 + 1, 'a')
sage: L.ideal(2).factor()
(Fractional ideal (-1/2*a*b + 1/2*a - 1))^4
sage: G = L.galois_group()
sage: L.primes_above(2)
[Fractional ideal (-1/4*a^3 + 1/4*a^2 + 9/4*a - 9/4)]
sage: G.decomposition_group(L.primes_above(2)[0]).order()
4
sage: G.inertia_group(L.primes_above(2)[0]).order()
4
</code></pre>
</div>
<h2 id="p-splits-completely-in-every-subfield"><script type="math/tex">p</script> splits completely in every subfield</h2>
<p>If <script type="math/tex">p</script> splits completely in each subfield, then it will split completely in the composite field (Marcus, Theorem 31). The decomposition group of <script type="math/tex">p</script> is the empty subgroup - every element of the Galois group permutes a prime lying over <script type="math/tex">p</script> it to a different prime lying over <script type="math/tex">p</script>, so no permutations fix the primes over <script type="math/tex">p</script>.</p>
<p>To find an example, we note that for <script type="math/tex">p</script> to split completely in every subfield, it must not divide the discriminant of each subfield, and each subfield must be a quadratic residue mod <script type="math/tex">p</script>.</p>
<p>Let’s take <script type="math/tex">p = 131</script> (I just wanted to try a larger number than the usuals ;)), and observe using Sage that <script type="math/tex">15, 21,</script> and <script type="math/tex">35 = \frac{15 \cdot 21}{\text{gcd}(15, 21)^2}</script> are each quadratic residues mod <script type="math/tex">131</script>, so <script type="math/tex">131</script> will split completely in each subfield.</p>
<p>We then confirm through Sage that 131 splits completely each subfield and then over the biquadratic field <script type="math/tex">\mathbb{Q}[\sqrt{15}, \sqrt{21}]</script>:</p>
<div class="highlighter-rouge"><pre class="highlight"><code>sage: for m in [15, 21, 35]:
....: print(QuadraticField(m).ideal(131).factor())
....:
(Fractional ideal (-3*a + 2)) * (Fractional ideal (3*a + 2))
(Fractional ideal (5/2*a + 1/2)) * (Fractional ideal (5/2*a - 1/2))
(Fractional ideal (-2*a + 3)) * (Fractional ideal (2*a + 3))
sage: L = QQ.extension(x^2 - 15, 'a').extension(x^2 - 21, 'b')
sage: L.ideal(131).factor()
(Fractional ideal ((1/3*a - 1)*b + 2*a - 7)) * (Fractional ideal ((-1/6*a - 1)*b + 3/2*a + 7)) * (Fractional ideal ((1/3*a - 3/2)*b + a - 11/2)) * (Fractional ideal ((1/3*a + 1)*b - a - 2))
</code></pre>
</div>
<h2 id="p-inert-in-every-subfield"><script type="math/tex">p</script> inert in every subfield</h2>
<p>This scenario can never occur. If <script type="math/tex">p</script> were inert in every subfield, then the decomposition group of <script type="math/tex">p</script> would be the entire Galois group, while the inertia group would be the empty subgroup. There would then be a surjective mapping from <script type="math/tex">D / E = G</script> onto a cyclic group of order 4 (the inertial degree of <script type="math/tex">p</script>), but this contradicts what we know about the structure of the Galois group (the Klein 4-group is not cyclic).</p>
<h2 id="p-splits-into-two-primes-p1-p2"><script type="math/tex">p</script> splits into two primes <script type="math/tex">p_1 p_2</script></h2>
<p>We need <script type="math/tex">p</script> to split in one subfield and be inert in another. Take <script type="math/tex">p = 13, m = 3, n = 5</script>. Here <script type="math/tex">m = 3</script> is a quadratic residue mod 13, but <script type="math/tex">n = 5</script> is not. Therefore 13 stays inert in <script type="math/tex">\mathbb{Q}[\sqrt{5}]</script> but splits in <script type="math/tex">\mathbb{Q}[\sqrt{3}]</script>. Sage confirms that 13 has the desired form in the biquadratic field:</p>
<div class="highlighter-rouge"><pre class="highlight"><code>sage: for m in [3, 5]:
....: print(QuadraticField(m).ideal(13).factor())
....:
(Fractional ideal (a + 4)) * (Fractional ideal (a - 4))
Fractional ideal (13)
sage: QQ.extension(x^2 - 5, 'a').extension(x^2 - 3, 'b').ideal(13).factor()
(Fractional ideal (b + 4)) * (Fractional ideal (b - 4))
</code></pre>
</div>
<p>Note that since <script type="math/tex">15 \equiv 2\ (13)</script> is not a quadratic residue mod 13, 13 stays inert in <script type="math/tex">\mathbb{Q}[\sqrt{15}]</script>, so this provides a scenario where a prime can be inert in two fields (here the quadratic subfields <script type="math/tex">m = 5, n = 15</script>) but not be inert in their composite (Marcus, Exercise 4.7 (c)).</p>
<h2 id="p-splits-into-two-primes-p12-p22"><script type="math/tex">p</script> splits into two primes <script type="math/tex">p_1^2 p_2^2</script></h2>
<p>We need <script type="math/tex">p</script> to split in one subfield and ramify in another. Take <script type="math/tex">p = 7, m = 2, n = 14</script>. Here <script type="math/tex">m = 2</script> is a quadratic residue mod <script type="math/tex">7</script>, and the quadratic field <script type="math/tex">\mathbb{Q}[\sqrt{14}]</script> will have a discriminant divisible by 7, since 7 divides 14.</p>
<div class="highlighter-rouge"><pre class="highlight"><code>sage: for m in [2, 14]:
....: print(QuadraticField(m).ideal(7).factor())
....:
(Fractional ideal (-2*a + 1)) * (Fractional ideal (2*a + 1))
(Fractional ideal (-2*a + 7))^2
sage: QQ.extension(x^2 - 14, 'a').extension(x^2 - 2, 'b').ideal(7).factor()
(Fractional ideal ((1/2*a - 3/2)*b + 1/2*a - 1))^2 * (Fractional ideal (1/2*b - 1/2*a + 2))^2
</code></pre>
</div>
<p>The third quadratic subfield of <script type="math/tex">K</script> is <script type="math/tex">\mathbb{Q}[\sqrt{7}]</script>, where <script type="math/tex">7</script> is totally ramified. This provides an example where a prime can be totally ramified in two fields (here the quadratic subfields <script type="math/tex">m = 7, n = 14</script>) but not totally ramified in their composite (Marcus, Exercise 4.7 (a)).</p>
<h2 id="p-ramifies-as-p12"><script type="math/tex">p</script> ramifies as <script type="math/tex">p_1^2</script></h2>
<p>We need <script type="math/tex">p</script> to ramify in one subfield and be inert in another. Take <script type="math/tex">p = 13, m = 5, n = 13</script>. 5 is not a quadratic residue mod 13, so 13 will stay inert in that quadratic subfield. Sage confirms:</p>
<div class="highlighter-rouge"><pre class="highlight"><code>sage: for m in [5, 13]:
....: print(QuadraticField(m).ideal(13).factor())
....:
Fractional ideal (13)
(Fractional ideal (-a))^2
sage: QQ.extension(x^2 - 5, 'a').extension(x^2 - 13, 'b').ideal(13).factor()
(Fractional ideal (-b))^2
</code></pre>
</div>
Sat, 09 Feb 2019 00:00:00 -0800
http://www.tildedave.com/2019/02/09/examples-of-factoring-in-biquadratic-fields.html
http://www.tildedave.com/2019/02/09/examples-of-factoring-in-biquadratic-fields.html2018: In Review<p>So it’s been a pretty good year over here. After four years in California I finally feel like I live here and I get to have my own life now, instead of performing some version of the life that I thought I wanted when I moved out here. My stress levels have been a lot lower and I’ve had time and energy after work to really develop my own interests.</p>
<p>I got a new job this year (Software Engineer at Chartio) and it’s helped clarify what I really enjoy out of work. I’ve worked enough different places now to get a feel for the types of projects I enjoy the most. These projects tend to be situations where I have a lot of autonomy while I get to learn a lot at the same time, and the new job lets me have that more often than not, fulltime. Pretty nice.</p>
<p>Another thing that’s quite nice is the company size - I really like a smaller team size. Tilt and Lyft oriented their teams around product verticals which may be the way you need to organize once you get to a certain size, but it’s not enjoyable to have any of the “my team” vs “your team” that comes out of a structure like that (works great if you’re on “my team” and never have to deal with “your team” I guess). It’s also really nice to have the more direct line to the customers that comes in a smaller environment.</p>
<p>I ended up doing some recreational coding. I did the first few <a href="https://cryptopals.com">Cryptopals</a> problem sets in April using <a href="https://github.com/tildedave/cryptopals-ocaml">OCaml</a>, implemented <a href="https://github.com/tildedave/go-finite-fields">Berklekamp and Cantor-Zassanhaus Factorization</a> for polynomials over finite fields in Golang for reasons I still can’t identify, and returned to my <a href="https://github.com/tildedave/ra-chess-engine">new Golang chess engine</a> that I started last year. Ra (new engine) still consistently loses to Apep (<a href="https://github.com/tildedave/apep-chess-engine">my old C++ chess engine</a>) but I’m pretty sure I can change that with a bit more work. Chess engines are super fun and they make me want to develop my chess skills so I can handle myself a little better over the board. Maybe one day I’ll get to writing some articles on chess programming up.</p>
<p>I also dedicated a bunch of time to improving my abilities with <a href="https://coq.inria.fr/">Coq</a>. I read through <a href="https://www.springer.com/us/book/9783540208549"><em>Interactive Theorem Proving and Program Development</em></a> and more or less grok everything in it. I <a href="https://github.com/tildedave/coq-playground/blob/master/digits.v">completed my proof</a> of grade-school arithmetic (started last year). After going through all the teeth-pulling that it takes to formalize proving base 10 addition with carry-over is the same as the built-in addition operator, I’m not sure how mainstream theorem proving will ever be. Obviously the startup world where I work has major issues to solve before it gets to certifying the correctness of our programs, but it feels impractical even in fields where it might ostensibly make sense, such as professional mathematics. The idea that modern math papers could come with a program proving it correct is extremely far out of reach, or at least that dependent typing isn’t the right tool for the job. It would take a herculean effort to certify the first 30 pages of one of the number theory textbooks that I read.</p>
<p>I did some reading. I finally read Ursula Le Guin, though unfortunately she had to die to get herself high enough on my radar. The <em>Left Hand of Darkness</em> was a wonderful book and I find myself wanting to return to its world (maybe in the new year). One of my goals for the Christmas break is to read through a few of her Earthsea books. I really liked <em>The Dispossessed</em>, which I interpreted as her take on <em>The Fountainhead</em>. I think it’s important for us whose politics are on the left to understand how the themes in <em>The Fountainhead</em> resonate with people, even if we disagree with the ends that its author turns them towards. Shevek is a brilliant scientist who is stranded in a backwater where he can’t work except as servant to a university elder. He rejects his homeland to join the place where “real science” is done, but then discovers he is nothing but a pawn of those in power, and must rebel again. Great stuff.</p>
<p>I also read the first four Dune novels. I’m not sure why it took me this long to get around to it - it was sort of intimidating, I guess. Afterwards, it’s easy to see its fingerprints over many of my favorite sci-fi/fantasy worlds. The one I spent the most time thinking about was Miyazaki’s <em>Nausicaa of the Valley of the Wind</em> (there’s a movie, but like any true nerd I’ll tell you the manga is way better). Nausicaa is a very similar protagonist in some ways but makes very different choices from the Atreides madmen. After the first Dune book, the Atreides consistently embrace autocracy over allowing the common people a voice, usually justifying it by some imagined horrific future that never seems to manifest. Nausicaa chooses differently - she rejects the mantle of rulership, and given the opportunity to remake her world into a paradise (like the Atreides eventually do for Arrakis), she destroys the tools of the past that the ruling class uses to dominate the world (while the Atreides horde the spice to cement their rule). Our world could use a lot more of Nausicaa and a lot less of the Atreides.</p>
<p>And of course, I did some surgery on this blog. I de-listed a bunch of older articles that didn’t age well for one reason or another. Either I now disagreed with them, didn’t think they made their points very well, or they just weren’t unique enough. One of my favorite internet jokes is Clickhole’s “The Time I Spent On A Commercial Whaling Ship Totally Changed My Perspective On The World”, where all of Melville’s beautiful prose in Moby Dick gets turned into the doggerel of the internet just by being presented on a webpage. There are enough programming blogs out there that talk about stuff you did in the context of work and isn’t work/my company/my team just the greatest. I feel a little embarrassed by my past contribution to the genre but I’m doing my best to turn this little corner of the internet into as weird and unique a place as I can possibly make it. Not sure where that will go but I guess that’s the point. Best wishes for a great 2019, all.</p>
Thu, 20 Dec 2018 00:00:00 -0800
http://www.tildedave.com/2018/12/20/year-in-review.html
http://www.tildedave.com/2018/12/20/year-in-review.htmlThe Joy of Algebraic Number Theory<p>Algebraic number theory is the study of how prime numbers behave in field extensions of the rational numbers. For example, 13 is a prime number in the integers. However, in the field extension <script type="math/tex">\mathbb{Q}[i]</script>, 13 is a product of two irreducible elements <script type="math/tex">(2 + 3i)</script> and <script type="math/tex">(2 - 3i)</script>, and so is no longer a “prime”.</p>
<p>Algebraic number theory grew out of Gauss and other mathematicians looking for a way to extend quadratic reciprocity (which numbers can be written as <script type="math/tex">x^2</script> mod <script type="math/tex">p</script>?) to higher dimensions. Adding new types of numbers allowed them to investigate these problems in fuller generality. Later, Kummer and others expanded its techniques in a failed attempt to solve Fermat’s Last Theorem (<script type="math/tex">x^p + y^p = z^p</script> has no integer solutions for <script type="math/tex">p > 2</script>). While these techniques did not succeed, it resulted in them developing out the theory of cyclotomic fields (the field extensions of the form <script type="math/tex">\mathbb{Q}[\zeta]</script>, <script type="math/tex">\zeta</script> being a complex root of unity).</p>
<p>I started learning algebraic number theory this year and I wanted to write a bit about its core concepts and convey some of its flavor, and the reasons I think it’s an interesting topic. There are a lot of high quality resources on the internet that I’ve used to augment my main resource, which has been the textbook <em>Number Fields</em> by Daniel Marcus.</p>
<h2 id="definitions">Definitions</h2>
<p>Let <script type="math/tex">K</script> by a finite field extension of <script type="math/tex">\mathcal{Q}</script>, i.e. there is some set <script type="math/tex">\{ e_1, \ldots, e_n \in K \}</script> that forms a basis of <script type="math/tex">K</script> over <script type="math/tex">\mathbb{Q}</script>. Call this type of extension a <em>number field</em>. Every number field <script type="math/tex">K</script> has a subring <script type="math/tex">\mathcal{O_K}</script> of the elements which are solutions to polynomials with integer coefficients: <script type="math/tex">a_n x^n + a_{n-1} x^{n-1} + \ldots + a_0</script> where each of the <script type="math/tex">a_i \in \mathbb{Z}</script>. (These are also called <em>algebraic integers</em>).</p>
<p>In a <em>quadratic</em> field extension <script type="math/tex">\mathbb{Q}[\sqrt{d}]</script>, you take the rational numbers adjoined with the square root of some number <script type="math/tex">d</script> m (e.g. <script type="math/tex">\sqrt{3}</script>, <script type="math/tex">\sqrt{6}</script>, etc), the algebraic integers end up being <script type="math/tex">\mathbb{Z}[\sqrt{d}]</script> if <script type="math/tex">d \equiv 2, 3\ (4)</script>, and <script type="math/tex">\mathbb{Z}[\frac{1 + \sqrt{d}}{2}]</script> if <script type="math/tex">d \equiv 1\ (4)</script>.</p>
<p><em>Cyclotomic number fields</em> are the rational numbers adjoined with <script type="math/tex">\zeta_{m}</script> for some <script type="math/tex">m</script>. The algebraic integers for a cyclotomic field <script type="math/tex">\mathbb{Q}[\zeta_m]</script> end up just being <script type="math/tex">\mathbb{Z}[\zeta_m]</script>.</p>
<p>We can use Sage to compute an basis for the ring of integers for various field extensions (called an <em>integral basis</em>). (The <code class="highlighter-rouge">a</code> that shows up is each field’s generating element.)</p>
<div class="highlighter-rouge"><pre class="highlight"><code>sage: K = QuadraticField(14)
sage: K.integral_basis()
[1, a]
sage: K = QuadraticField(17)
sage: K.integral_basis()
[1/2*a + 1/2, a]
sage: K = CyclotomicField(13)
sage: K.integral_basis()
[1, zeta13, zeta13^2, zeta13^3, zeta13^4, zeta13^5, zeta13^6, zeta13^7, zeta13^8, zeta13^9, zeta13^10, zeta13^11]
</code></pre>
</div>
<p>The above examples are a little deceiving in their lack of complexity, as the ring of integers for the field extension always has the form <script type="math/tex">\mathbb{Z}[\alpha]</script> for some <script type="math/tex">\alpha</script>. However, this is not always the case - <a href="https://math.stackexchange.com/questions/912148/why-a-particular-ring-of-integers-is-not-generated-by-a-single-element">a counterexample</a> is the field extension <script type="math/tex">\mathbb{Q}</script> extended by a root <script type="math/tex">\alpha</script> of the cubic equation <script type="math/tex">x^3 + x^2 - 2x + 8</script>.</p>
<div class="highlighter-rouge"><pre class="highlight"><code>sage: K.<a> = QQ.extension(x^3 + x^2 - 2*x + 8)
sage: K.integral_basis()
[1, 1/2*a^2 + 1/2*a, a^2]
</code></pre>
</div>
<p>Computing an integral basis turns out to be little trickier than computing the basis of a field extension. See [5] for more information.</p>
<h2 id="lack-of-unique-factorization">Lack of Unique Factorization</h2>
<p>One of the things that makes the integers really nice to work with is that every number can be broken down into a unique product of prime elements. For example, the number <script type="math/tex">1176 = 2^3 \cdot 3 \cdot 7^2</script>. Other than choosing negative numbers, there aren’t any alternative factorizations of <script type="math/tex">1176</script>.</p>
<p>This fundamental property of number theory may fail in a ring of integers. For example, let <script type="math/tex">K = \mathbb{Q}[\sqrt{-5}]</script>. Then <script type="math/tex">6 = 2 \cdot 3</script> but also <script type="math/tex">6 = (1 + \sqrt{-5})(1 - \sqrt{-5})</script>.</p>
<p>In order to solve this difficulty, we start operating on <em>ideals</em>. Ideals (denoted by the symbol <script type="math/tex">I</script>) are subsets of a mutiplicative ring that are internally closed under addition (so for any two elements <script type="math/tex">f, g \in I</script>, <script type="math/tex">f + g \in I</script>) and are closed under multiplication from the rest of the ring (so for any element <script type="math/tex">f \in I</script> and an element from the broader ring <script type="math/tex">r \in R</script>, <script type="math/tex">r \cdot f \in I</script>).</p>
<p>It’s not too difficult to see that the ideals of the integers <script type="math/tex">\mathbb{Z}</script> are all the multiples of some prime. However, in the ring of integers, ideals may be the product of multiple generating elements, written <script type="math/tex">I = (i_0, \ldots, i_n)</script>.</p>
<p>Given two ideals <script type="math/tex">I, J</script>, you can define the ideal <script type="math/tex">I \cdot J</script> to be the ideal generated by every element <script type="math/tex">i \in I</script> multiplied by every element <script type="math/tex">j \in J</script>.</p>
<p>Seen through the lens of ideals, the ring of integers admits unique factorization, except that now we’re not factoring numbers into a product of primes, we’re factoring ideals into a product of <em>prime ideals</em>.</p>
<p>Let’s ask Sage to shed some light on the situation where <script type="math/tex">F = \mathbb{Q}[\sqrt{-5}]</script>:</p>
<div class="highlighter-rouge"><pre class="highlight"><code>sage: K = QuadraticField(-5)
sage: K.factor(6)
(Fractional ideal (2, a + 1))^2 * (Fractional ideal (3, a + 1)) * (Fractional ideal (3, a + 2))
sage: I, J1, J2 = [x[0] for x in K.factor(6)]
sage: I * J1
Fractional ideal (a + 1)
sage: I * J2
Fractional ideal (-a + 1)
sage: I*I
Fractional ideal (2)
sage: J1*J2
Fractional ideal (3)
</code></pre>
</div>
<p>To summarize, in the ring of integers <script type="math/tex">\mathcal{O_F}</script>, we have the following factorizations:</p>
<script type="math/tex; mode=display">% <![CDATA[
\begin{eqnarray*}
(6) &=& (2, \sqrt{-5} + 1)^2 \cdot (3, \sqrt{-5} + 1) \cdot (3, \sqrt{-5} + 2) \\
(2) &=& (2, \sqrt{-5} + 1)^2 \\
(3) &=& (3, \sqrt{-5} + 1) \cdot (3, \sqrt{-5} + 2)\\
(1 + \alpha) &=& (2, \sqrt{-5} + 1) \cdot (3, \sqrt{-5} + 1)\\
(1 - \alpha) &=& (2, \sqrt{-5} + 1) \cdot (3, \sqrt{-5} + 2)\\
\end{eqnarray*} %]]></script>
<p>Above, you can also see that ideal <script type="math/tex">(2, \sqrt{-5} + 1)</script> is <em>non-principal</em> - that is, there is no element <script type="math/tex">\alpha</script> such that generates the ideal <script type="math/tex">(2, \sqrt{-5} + 1)</script>. In math-speak this means that the ring of integers may not be a <em>Principal Ideal Domain</em> (abbreviated PID). (This differs from the regular integers <script type="math/tex">\mathbb{Z}</script>, where every ideal is the multiples of some prime number.) It’s not even known if there are infinitely many quadratic extensions (degree 2) with a ring of integers that’s a PID.</p>
<h2 id="personal-reflection">Personal Reflection</h2>
<p>So obviously, I find this stuff pretty interesting. I can only really explain this in contrast to my reaction to mathematical logic, a subject I respect more than I love. Much of what you learn in mathematical logic is not just the history of the results, but the history of how the results are interpreted - many of the key results in logic end up having a political feel, wherein the ability to make a mathematical construction comes with some statement about the value of your assumptions.</p>
<p>For example, one of the main problems in logic is the Continuum Hypothesis (is the cardinality of the real line the first uncountable infinity?). Gödel showed you could construct models of set theory where it was true. Cohen showed you could make models where it was false, using an elaborate technique - you blow up an <script type="math/tex">\aleph_0</script>-sized model of ZFC Set Theory into an <script type="math/tex">\aleph_2</script>-sized model, then show that the statement “This is an <script type="math/tex">\aleph_2</script>-sized set”, provable in your new model, relativizes back to ‘real mathematics’ because “This is an <script type="math/tex">\aleph_2</script>-sized set” is a <script type="math/tex">\Pi^{0}_2</script> statement.</p>
<p>Whatever this says, it has a <em>meaning</em>. Should we change our assumptions to disallow this result? Should we say the Continuum Hypothesis is true anyways? Or false anyways? What does uncountable infinity even <em>mean</em>? Should we use other axiom systems than ZFC? Should we just ditch all this infinity stuff in the first place?</p>
<p>In contrast, the objects of study in algebra feel familiar (the rational numbers! irreducible polynomials!), useful in their own right (finite fields and their factorings are used in cryptosystems), and accessible (tools like Sage allow you to explore your understanding without needing your advisor’s intuition to walk you through the easy stuff). Results don’t trigger this metaphysical quandry, and the clear motivation from simple equations over the integers helps me stay engaged. These problems motivated these mathematical greats (Gauss, Euler, and Fermat), and centuries later we get to understand the issues to which they devoted their lives.</p>
<h2 id="references">References</h2>
<ol>
<li><a href="https://wstein.org/books/ant/">Algebraic Number Theory, a Computational Approach</a> by William Stein</li>
<li><a href="http://www.jmilne.org/math/CourseNotes/ant.html">Algebraic Number Theory</a> by J.S. Milne</li>
<li><a href="https://faculty.math.illinois.edu/~r-ash/ANT.html">A Course In Algebraic Number Theory</a> by Richard Ash</li>
<li><a href="https://ctnt-summer.math.uconn.edu/schedules-and-abstracts-2018/">Basic Algebraic Number Theory</a> from CTNT 2018, Liang Xiao,</li>
<li><a href="https://pdfs.semanticscholar.org/ac59/767929639347bb2d0ef52621d973ad743af8.pdf">Computing Integral Bases</a>, John Paul Cook.</li>
</ol>
Wed, 19 Dec 2018 00:00:00 -0800
http://www.tildedave.com/2018/12/19/the-joy-of-algebraic-number-theory.html
http://www.tildedave.com/2018/12/19/the-joy-of-algebraic-number-theory.htmlQuadratic Gaussian Sums<p>Let <script type="math/tex">p</script> be an odd prime. I’ll now show how sums over complex roots of unity can be used to show the law of <em>quadratic reciprocity</em>, which states that <script type="math/tex">p</script> being a square mod <script type="math/tex">q</script> is related to whether <script type="math/tex">q</script> is a square mod <script type="math/tex">p</script>.</p>
<p>Let <script type="math/tex">(p / q)</script> be the Legendre symbol: it takes on the value 0 if <script type="math/tex">p</script> is 0, <script type="math/tex">1</script> if <script type="math/tex">p</script> is a square mod <script type="math/tex">q</script>, and <script type="math/tex">-1</script> otherwise. We’ll be seeing what happens when you sum up some complex roots of unity and square the resulting value. I am following the proof given in <a href="https://www.springer.com/us/book/9780387973296">A Classical Introduction to Modern Number Theory, Ireland and Rosen</a>.</p>
<h2 id="summing-complex-roots-of-unity">Summing Complex Roots of Unity</h2>
<p>Let <script type="math/tex">\zeta</script> be a complex <script type="math/tex">p</script>-th root of unity <script type="math/tex">\zeta = e^{2\pi i/p}</script>. The quadratic Gaussian sum is the value <script type="math/tex">g_{a} = \sum_{t} (t/p) \zeta^{at}</script>.</p>
<p>Why might this be useful? It’s not hard to show that for all <script type="math/tex">a</script>, <script type="math/tex">g_a = (a/p)g_1</script>, meaning that we can recover the value <script type="math/tex">(a/p)</script> by knowing the value of <script type="math/tex">g_a</script>.</p>
<p>For example, when <script type="math/tex">p = 5</script>:</p>
<script type="math/tex; mode=display">% <![CDATA[
\begin{eqnarray*}
g_1 &=& \zeta - \zeta^{2} - \zeta^{3} + \zeta^{4}\\
g_2 &=& \zeta^{2} - \zeta^{4} - \zeta^{6} + \zeta^{8} = \zeta^{2} + \zeta^{3} - \zeta^{4} - \zeta &=& -g_1\\
g_3 &=& \zeta^{3} - \zeta^{6} - \zeta^{9} + \zeta^{12} = \zeta^{2} + \zeta^{3} - \zeta^{4} - \zeta &=& -g_1\\
g_4 &=& \zeta^{4} - \zeta^{8} - \zeta^{12} + \zeta^{16} = \zeta + \zeta^{4} - \zeta^{2} - \zeta^{3} &=& g_1\\
\end{eqnarray*} %]]></script>
<p>2 and 3 are non-residues mod 5, so the sign of the quadratic Gaussian sum <script type="math/tex">g_2</script> and <script type="math/tex">g_3</script> is negative.</p>
<p><strong>Lemma:</strong> <script type="math/tex">g_a = (a/p)g_1</script></p>
<p><strong>Proof:</strong> We only consider the case where <script type="math/tex">a</script> is coprime to <script type="math/tex">p</script>.</p>
<script type="math/tex; mode=display">\left(\frac{a}{p}\right) g_a = \sum_{t} \left(\frac{at}{p}\right) \zeta^{at} = \sum_{x} \left(\frac{x}{p}\right) \zeta^{x} = g_1</script>
<p>(Because <script type="math/tex">p</script> is a prime and <script type="math/tex">a</script> is coprime to <script type="math/tex">p</script>, <script type="math/tex">at</script> must take on all values <script type="math/tex">1, 2, \ldots, p - 1</script> mod <script type="math/tex">p</script>). Multiplying both sides by <script type="math/tex">\left(\frac{a}{p}\right)</script> gives the desired result. <script type="math/tex">\tag*{$\Box$}</script></p>
<p><strong>Lemma:</strong> <script type="math/tex">g_1^2 = (-1)^{(p - 1)/2} p</script></p>
<p><strong>Proof:</strong> To show this, we evaluate <script type="math/tex">\sum_{a} g_{a}g_{-a}</script> in two different ways. Again we only focus on <script type="math/tex">a</script> coprime to <script type="math/tex">p</script>.</p>
<p>First, by the previous lemma, we have <script type="math/tex">g_{a}g_{-a} = (a/p)(-a/p) g_1^2 = (-1/p) g_1^2</script>. Summing over all <script type="math/tex">a</script> gives us <script type="math/tex">\sum_{a} g_{a}g_{-a} = \left(\frac{-1}{p}\right)(p-1)g^2</script>.</p>
<p>Direct expansion gives:</p>
<script type="math/tex; mode=display">g_{a}g_{-a} = \sum_{x} \sum_{y} \left(\frac{x}{p}\right) \left(\frac{y}{p}\right) \zeta^{a(x - y)}</script>
<p>When summing this term over <script type="math/tex">a</script>, terms where <script type="math/tex">x \not\equiv y\ (p)</script> vanish, since these end up summing over all roots of unity. For each <script type="math/tex">x</script>, when <script type="math/tex">x \equiv y\ (p)</script>, there are <script type="math/tex">p</script> terms. Therefore:</p>
<script type="math/tex; mode=display">\sum_{a} g_{a}g_{-a} = \sum_{x} \left(\frac{x}{p}\right) \left(\frac{x}{p}\right) p = (p - 1)p</script>
<p>Therefore <script type="math/tex">(p - 1)p = \left(\frac{-1}{p}\right)(p-1)g^2</script>. Cancelling terms of <script type="math/tex">p - 1</script> and multiplying both sides by <script type="math/tex">(-1/p)</script> gives the desired result. (By Fermat’s little theorem we have <script type="math/tex">(-1/p) = (-1)^{(p-1)/2}</script>.)
<script type="math/tex">\tag*{$\Box$}</script></p>
<h2 id="quadratic-reciprocity">Quadratic Reciprocity</h2>
<p>We are in a place to prove the law of quadratic reciprocity, which links the values <script type="math/tex">\left(\frac{p}{q}\right)</script> and <script type="math/tex">\left(\frac{q}{p}\right)</script>.</p>
<div class="theorem" text="Quadratic Reciprocity">
$$\left(\frac{p}{q}\right)\left(\frac{q}{p}\right) = (-1)^{((p-1)/2)((q-1)/2)}$$
</div>
<p>If either <script type="math/tex">p</script> or <script type="math/tex">q</script> are <script type="math/tex">\equiv 1\ (4)</script>, the right hand side is <script type="math/tex">1</script>, and <script type="math/tex">p</script> is a residue in <script type="math/tex">q</script> if and only if <script type="math/tex">q</script> is a residue in <script type="math/tex">p</script>. Let <script type="math/tex">p = 13</script> and <script type="math/tex">q = 17</script> - it happens that <script type="math/tex">17 \equiv 4\ (13)</script>. <script type="math/tex">4</script> is a square mod <script type="math/tex">13</script> (<script type="math/tex">2^2 \equiv 4\ (13)</script>) and <script type="math/tex">13</script> is a square mod <script type="math/tex">17</script> (<script type="math/tex">8^2 \equiv 13\ (17)</script>).</p>
<p>However, if both <script type="math/tex">p</script> and <script type="math/tex">q</script> are <script type="math/tex">\equiv 3\ (4)</script>, then the relationship is flipped: <script type="math/tex">p</script> is a residue in <script type="math/tex">q</script> if and only if <script type="math/tex">q</script> is not a residue in <script type="math/tex">p</script>. For example, <script type="math/tex">p = 7</script> and <script type="math/tex">q = 23</script>: <script type="math/tex">23 \equiv 2\ (7)</script> and 2 is a square mod <script type="math/tex">7</script> (<script type="math/tex">3^2\equiv 2\ (7)</script>, but <script type="math/tex">7</script> is not a square mod <script type="math/tex">23</script>.</p>
<p><strong>Proof:</strong>
Let <script type="math/tex">p' = (-1)^{(p - 1)/2} p</script>. By the above lemma we have <script type="math/tex">g_1^2 = p'</script>. Take <script type="math/tex">q</script>, another odd prime. Then we have:</p>
<p><script type="math/tex">g_1^{q-1} = (g_1^2)^{(q-1)/2} = p'^{(q-1)/2} \equiv \left(\frac{p'}{q}\right)\ (q)</script>.</p>
<p>Multiplying both sides by <script type="math/tex">g_1</script> gives:</p>
<script type="math/tex; mode=display">g_1^{q} \equiv \left(\frac{p'}{q}\right)g_1\ (q)</script>
<p>Since we are examining congruences modulo <script type="math/tex">q</script>, we can “push” the exponent down into the sum, giving, <script type="math/tex">g_1^{q} = g_{q} = (q/p)g_1\ (q)</script> as per our first lemma. Therefore we have:</p>
<script type="math/tex; mode=display">% <![CDATA[
\begin{eqnarray*}
\left(\frac{q}{p}\right)g_1 &\equiv& \left(\frac{p'}{q}\right)g_1 \ (q)\\
\left(\frac{q}{p}\right)g_1^2 &\equiv& \left(\frac{p'}{q}\right)g_1^2 \ (q)\\
\left(\frac{q}{p}\right)p' &\equiv& \left(\frac{p'}{q}\right)p' \ (q)\\
\left(\frac{q}{p}\right) &\equiv& \left(\frac{p'}{q}\right) \ (q)\\
\left(\frac{q}{p}\right) &=& \left(\frac{p'}{q}\right)\\
\end{eqnarray*} %]]></script>
<p>The value <script type="math/tex">\left(\frac{p'}{q}\right)</script> can be seen to equal <script type="math/tex">(-1)^{((q-1)/2)((p - 1) / 2)} \left(\frac{p}{q}\right)</script> as <script type="math/tex">p' = (-1)^{(p-1)/2} p</script>: therefore <script type="math/tex">p'</script> is a residue mod <script type="math/tex">q</script> if both <script type="math/tex">(-1)^{(p-1)/2}</script> and <script type="math/tex">p</script> are residues mod <script type="math/tex">q</script> or they are both non-residues. Arranging terms gives the desired result.</p>
<script type="math/tex; mode=display">\tag*{$\Box$}</script>
<h2 id="notes">Notes</h2>
<p>Quadratic reciprocity is what really hooked me on my study of the Ireland and Rosen textbook. The previous few chapters had been about congruences and the structure of subrings of integers - interesting stuff but sort of dry, and not too different from the standard abstract algebra I had covered in undergrad.</p>
<p>However, <em>this</em> theorem sort of came out of left field: it seemed strange that <script type="math/tex">p</script> being a square mod <script type="math/tex">q</script> would be related at all to <script type="math/tex">q</script> being a square mod <script type="math/tex">p</script> - especially given that one of these numbers is larger than the other! (When you talk about <script type="math/tex">p</script> being a square mod <script type="math/tex">q</script>, it’s actually a statement about <script type="math/tex">p</script>’s coset in the integers mod <script type="math/tex">q</script>.)</p>
<p>There are a few different proofs presented in the textbook, but the presentation of quadratic Gaussian sums struck me as exceptionally simple. The Legendre symbol initially seemed to me as a strange thing to include in the sum terms, but it can be shown that the Legendre symbol is just an example of a <em>multiplicative character</em>, which maps a finite field into the unit circle in a way that preserves multiplication. The unit circle hooked me on trigonometry back in high school and I love seeing it appear again and again.</p>
Sun, 14 Oct 2018 00:00:00 -0700
http://www.tildedave.com/2018/10/14/quadratic-gaussian-sums.html
http://www.tildedave.com/2018/10/14/quadratic-gaussian-sums.htmlFor Which Primes is 2 a Square?<p>We work in the integers mod some odd prime <script type="math/tex">p</script>, and we start squaring things. It turns out that some numbers show up when we do this, and some don’t: for example, the numbers mod 5 are 0, 1, 2, 3, 4, and their squares are 0, 1, 4, 4, and 1. Since 4 shows up in this list, 4 is a square mod 5, but 2 doesn’t show up, so 2 is not a square.</p>
<p>If you’re given a <script type="math/tex">p</script>, it turns out to be relatively easy to test if a number is a square: just square everything and see if the number you’re looking for shows up. But what about the reverse problem: given a number <script type="math/tex">a</script>, for which primes <script type="math/tex">p</script> is <script type="math/tex">a</script> a square? This is the <em>quadratic residue</em> problem, one of the most famous problems in elementary number theory.</p>
<p>In this article I’ll show how to determine the primes for which the number 2 is a square, which follows a proof given in <a href="https://www.springer.com/us/book/9780387973296">A Classical Introduction to Modern Number Theory, Ireland and Rosen</a>. The proof relies on using complex roots of unity, which feels like a total non-sequitor after digging through a few chapters of congruences and mainly applications of classical algebra. Like all things math, I feel like this reveals some deep structure that requires a certain state of enlightenment to grasp.</p>
<h2 id="preliminaries">Preliminaries</h2>
<p>Looking over the first few primes see that 2 is not a square for <script type="math/tex">p = 3, p = 5, p = 11, p = 13</script> but is a square for <script type="math/tex">p = 7, p = 17, p = 23</script>.</p>
<p>Let <script type="math/tex">(a / p)</script> (the <em>Legendre symbol</em>) be 0 if <script type="math/tex">a = 0</script>, 1 if there is some <script type="math/tex">x</script> such that <script type="math/tex">x^2\equiv a\ (p)</script>, and -1 otherwise. Determining when 2 is a square means determining the <script type="math/tex">p</script> for which <script type="math/tex">(a / p) = 1</script>.</p>
<p>The key observation is that <script type="math/tex">a^{(p - 1)/2} \equiv (a / p)\ (p)</script>. This uses some group theory: every number <script type="math/tex">a^{p-1} \equiv 1\ (p)</script> (<em>Fermat’s Little Theorem</em>), so <script type="math/tex">(a^{(p-1)/2})^2 = 1</script>, meaning that it can only take on two possible values modulo <script type="math/tex">p</script>, 1 and -1.</p>
<h2 id="the-proof">The Proof</h2>
<p>Take <script type="math/tex">\zeta = e^{2\pi i / 8}</script>, a complex eighth root of unity which satisfies <script type="math/tex">\zeta^8 = 1</script>. Note that <script type="math/tex">\zeta^4 = -1</script> so <script type="math/tex">\zeta^2 = -\zeta^{-2}</script>. Consider the expression <script type="math/tex">\zeta + \zeta^{-1}</script> (this is just adding a number to its complex conjugate, so it’s a real number). Squaring this value yields <script type="math/tex">(\zeta + \zeta^{-1})^2 = \zeta^2 + 2 + \zeta^{-2} = 2</script>.</p>
<script type="math/tex; mode=display">% <![CDATA[
\begin{eqnarray*}
(2/p) &\equiv& 2^{(p-1)/2}\ (p)\\
&\equiv& (\zeta + \zeta^{-1})^2)^{(p - 1)/2}\ (p)\\
&\equiv& (\zeta + \zeta^{-1})^{p - 1}\ (p)\\
\end{eqnarray*} %]]></script>
<p>(Since <script type="math/tex">\zeta</script> is an <em>algebraic integer</em> - a root of a polynomial with integer coefficients - the concept of congruences can be shown to make sense.)</p>
<p>Multiplying both sides by <script type="math/tex">\zeta + \zeta^{-1}</script> gives:</p>
<script type="math/tex; mode=display">% <![CDATA[
\begin{eqnarray*}
(2/p)(\zeta + \zeta^{-1}) &\equiv& (\zeta + \zeta^{-1})^p\ (p)\\
&\equiv& \zeta^{p} + \zeta^{-p}\ (p)
\end{eqnarray*} %]]></script>
<p>(This uses the simplification <script type="math/tex">(x + y)^p \equiv x^p + y^p\ (p)</script> - this is possible because the binomial coefficients all being mod <script type="math/tex">p</script> and so zero out.)</p>
<p>Next, we split into cases based on the value <script type="math/tex">p</script> has congruent to 8. Since <script type="math/tex">p</script> is an odd prime, it can only take on four possible values: <script type="math/tex">p \equiv 1, 3, 5, 7\ (8)</script>.</p>
<script type="math/tex; mode=display">% <![CDATA[
\zeta^{p} + \zeta^{-p} = \left\{
\begin{array}{cc}
\zeta + \zeta^{-1} & p \equiv 1, 7\ (8)\\
\zeta^{3} + \zeta^{-3} = -(\zeta + \zeta^{-1}) & p \equiv 3, 5\ (8)
\end{array}
\right. %]]></script>
<p>This gives the result:</p>
<script type="math/tex; mode=display">% <![CDATA[
(2/p) = \left\{
\begin{array}{cc}
1 & p \equiv 1, 7\ (8)\\
-1 & p \equiv 3, 5\ (8)
\end{array}
\right. %]]></script>
<p>Verifying this with <a href="http://www.sagemath.org/">Sage</a> and choosing a random prime off a <a href="https://primes.utm.edu/lists/small/10000.txt">list of small primes</a>, we see:</p>
<div class="highlighter-rouge"><pre class="highlight"><code>sage: 102929 % 8
1
sage: 2 in quadratic_residues(102929)
True
</code></pre>
</div>
<p>We can also verify the pattern holds for the first 100 primes:</p>
<div class="highlighter-rouge"><pre class="highlight"><code>sage: P = Primes()
sage: for i in range(0, 100):
....: p = P.unrank(i)
....: print(p, p % 8, 2 in quadratic_residues(p))
....:
(2, 2, False)
(3, 3, False)
(5, 5, False)
(7, 7, True)
(11, 3, False)
(13, 5, False)
(17, 1, True)
(19, 3, False)
(23, 7, True)
(29, 5, False)
(31, 7, True)
(37, 5, False)
(41, 1, True)
(43, 3, False)
(47, 7, True)
(53, 5, False)
(59, 3, False)
(61, 5, False)
(67, 3, False)
(71, 7, True)
(73, 1, True)
(79, 7, True)
...
</code></pre>
</div>
<h2 id="references">References</h2>
<ul>
<li>Kenneth Ireland and Michael Rosen, <em>A Classical Introduction to Modern Number Theory</em> (2nd Edition)</li>
</ul>
Fri, 12 Oct 2018 00:00:00 -0700
http://www.tildedave.com/2018/10/12/for-which-primes-is-2-a-square.html
http://www.tildedave.com/2018/10/12/for-which-primes-is-2-a-square.htmlThe Joy of Field Extensions<p>One of my projects this year was learning Galois Theory, a subject in abstract algebra that goes into the structure of the roots of polynomial equations. In high school I learned that <script type="math/tex">x^2 + 1 = 0</script> had no solutions in the real numbers, but - good news! (massive leap of faith here) there’s some number <script type="math/tex">i</script> so that <script type="math/tex">i^2 + 1 = 0</script> is satisfied. Oh and by the way, <script type="math/tex">(-i)^2 + 1 = 0</script> also.</p>
<p>It turns out that by adding <script type="math/tex">i</script> to the real numbers you end up with this number system <script type="math/tex">\mathbb{C}</script>, the complex numbers. These behave similar to the familiar real numbers except that for any polynomial that describes a complex relationship there’s this transformation <em>complex conjugation</em> that turns one number satisfying the polynomial into another different number.</p>
<p>For example <script type="math/tex">x^3 - 2 = 0</script> has three solutions in the complex numbers, one is <script type="math/tex">\sqrt[3]{2}</script>, but it turns if you take <script type="math/tex">\omega</script> to be a complex number such that <script type="math/tex">\omega^3 = 1</script>, the other solutions to <script type="math/tex">x^3 - 2 = 0</script> are <script type="math/tex">\omega\sqrt[3]{2}</script> and <script type="math/tex">\omega^2\sqrt[3]{2}</script>, and it just so happens that <script type="math/tex">\omega\sqrt[3]{2}</script> is complex conjugate to <script type="math/tex">\omega^2\sqrt[3]{2}</script>. So the solutions to polynomial equations end up having this hidden structure to them that you might not have expected originally.</p>
<h2 id="jury-rigging-fields">Jury Rigging Fields</h2>
<p>The basic idea of a field extension is that you take a field (numbers can be multiplied, added, and divided with one another), adjoin extra elements to it, and see what the new object looks like. Generally you work in <script type="math/tex">\mathbb{Q}</script> which are the the rational numbers (1, -2, 3/4, 1/2, but no square roots, no crazy imaginary elements, etc).</p>
<p>The idea then is to take some polynomial that has no solutions in the “base field”, for example there are no rational numbers that satisfy <script type="math/tex">x^3 - 2 = 0</script>. So you say, “okay, since there’s no <script type="math/tex">x</script> such that cubing it is 2, let’s add an element that does and see what comes of it”. We’ll call that number <script type="math/tex">\sqrt[3]{2}</script> and add it to <script type="math/tex">\mathbb{Q}</script>. This ends up getting us a new field <script type="math/tex">\mathbb{Q}[\sqrt[3]{2}]</script>.</p>
<p>What does this new field look like? Well, it’s a field, it has all the same familiar rational numbers, but it also has this crazy new number <script type="math/tex">\sqrt[3]{2}</script>. Since it’s a field it has <script type="math/tex">1 / \sqrt[3]{2}</script>, and it also has all algebraic combinations of <script type="math/tex">\sqrt[3]{2}</script> with every other element in the field including itself. So this number system has all these new numbers <script type="math/tex">(\sqrt[3]{2})^2</script>, <script type="math/tex">(13 / \sqrt[3]{2})^8</script>, <script type="math/tex">(1 + \sqrt[3]{2})/17</script>, and so on. It’s still a number system like you’re used to, there’s just this new number along for the ride, and it turns out if you cube it you get <script type="math/tex">2</script>. Normal enough.</p>
<p>It turns out that for any field <script type="math/tex">K</script> and any irreducible polynomial <script type="math/tex">p(x)</script> (with coefficients in <script type="math/tex">K</script>), you can create a new field <script type="math/tex">L = K[x]</script> where <script type="math/tex">x</script> is a root of the irreducible polynomial. (The choice of what this <script type="math/tex">x</script> ‘actually is’ - for example if you consider what it is in projection into the complex numbers - ends up not mattering, there’s a theorem that all “stem fields” are the same.)</p>
<h2 id="thats-no-field">That’s No Field…</h2>
<p>Of course, mathematicians love it when they can recognize existing systems in new structures. It turns out you can view a field extension as a vector space over the original field - so our field <script type="math/tex">K</script> with all its new numbers is really a vector space with basis vectors <script type="math/tex">1, \sqrt[3]{2}, (\sqrt[3]{2})^2</script>. If you go back to all our “new numbers” we got, it turns out that each of these can be expressed as a combination of these basis vectors with constants from the base field <script type="math/tex">\mathbb{Q}</script>.</p>
<p>Since our field extension is now a vector space it makes sense to talk about its <em>dimension</em>, which in linear algebra is the size of its basis. Our extension <script type="math/tex">x^3 - 2</script> has dimension 3 because it has 3 basis vectors. It turns out that when you take an irreducible polynomial of degree <script type="math/tex">n</script> and adjoin it to a base field <script type="math/tex">K</script> the resulting vector space has degree <script type="math/tex">n</script> as well.</p>
<h2 id="extensions-of-extensions">Extensions of Extensions</h2>
<p>Looking back at the original polynomial <script type="math/tex">x^3 - 2</script> we notice it only has 1 solution in <script type="math/tex">\mathbb{Q}[\sqrt[3]{2}]</script>. In the complex numbers it has 3 solutions - <script type="math/tex">\sqrt[3]{2}, \omega\sqrt[3]{2}, \omega^2\sqrt[3]{2}</script>. So how we create a structure which has all three solutions?</p>
<p>It turns out that in the structure <script type="math/tex">\mathbb{Q}[\sqrt[3]{2}]</script> the polynomial <script type="math/tex">P = x^2 + (\sqrt[3]{2})x + (\sqrt[3]{2})^2</script> has no solutions, so we take a new element <script type="math/tex">x</script> that satisfies this equation (\if you call it <script type="math/tex">\omega\sqrt[3]{2}]</script> all the equations work out) and adjoin it to <script type="math/tex">\mathbb{Q}[\sqrt[3]{2}]</script>, getting us this new structure <script type="math/tex">\mathbb{Q}[\sqrt[3]{2}, \omega\sqrt[3]{2}]</script>. This new structure ends up having all 3 roots for <script type="math/tex">x^3 - 2</script>.</p>
<p>Since both <script type="math/tex">\sqrt[3]{2}</script> and <script type="math/tex">\omega\sqrt[3]{2}</script> are elements of this new field so is the <script type="math/tex">\omega</script> element (<script type="math/tex">\omega = \omega\sqrt[3]{2} \cdot 1/\sqrt[3]{2}</script>). Since <script type="math/tex">\omega^3 = 1</script> it also satisfies some strange-looking relationships: <script type="math/tex">\omega^{-1} = \omega^2</script> and <script type="math/tex">\omega^2 = -(\omega + 1)</script>. This shows us that the second root of the polynomial <script type="math/tex">P</script> is expressable as <script type="math/tex">-(\omega + 1) \cdot \sqrt[3]{2}</script>. So the members of this new field end up as being expressable as linear combinations of <script type="math/tex">1, \omega, \sqrt[3]{2}, (\sqrt[3]{2})^2, \omega\sqrt[3]{2}, \omega\sqrt[3]{2}</script> with coefficients from <script type="math/tex">\mathbb{Q}</script>. Thus the dimension of the new structure over the rationals is 6.</p>
<p>Since <script type="math/tex">\omega</script> is a member of <script type="math/tex">\mathbb{Q}[\sqrt[3]{2}, \omega\sqrt[3]{2}]</script> we know there’s also a subfield of $M$ that contains the rationals and <script type="math/tex">\omega</script> (dimension 2). Are there any other subfields? (Maybe some combination of <script type="math/tex">\omega</script> and <script type="math/tex">\sqrt[3]{2}</script>?)</p>
<p>It turns out there’s this great theorem that helps explain the structure of fields and their subextensions. Let <script type="math/tex">K</script> be a field, let <script type="math/tex">L</script> an extension of <script type="math/tex">K</script> and <script type="math/tex">M</script> an extension of <script type="math/tex">L</script>. Then:</p>
<div class="theorem" text="Tower Law">
$$[M : K] = [M : L][L : K]$$
</div>
<p>Since <script type="math/tex">M</script> over <script type="math/tex">K</script> has dimension 6 we know by the Tower Law that there can’t be any subfields of dimension 4 - 4 doesn’t divide 6. We can go through the divisors of the dimension of <script type="math/tex">M</script> to find all of its subfields. The final structure ends up looking like:</p>
<p><img class="img-responsive" style="display: block; margin: auto; max-width: 500px" src="/images/field-extension-subfields.svg" /></p>
<p>So, even though we constructed <script type="math/tex">M</script> by bolting on <script type="math/tex">\sqrt[3]{2}</script> and then <script type="math/tex">\omega\sqrt[3]{2}</script>, there’s another way to construct it by bolting on <script type="math/tex">\omega</script> and then <script type="math/tex">\sqrt[3]{2}</script>. It doesn’t matter what order you go, you get the same structure at the end.</p>
<h2 id="conclusion">Conclusion</h2>
<p>Field extensions are a way that you take one well-behaved structure and get another well-behaved structure. Irreducible polynomials are key to this as they express relationships that aren’t satisfied in the original structure but do end up satisfied in the new structure.</p>
<p>Field extensions actually end up being a really powerful tool - their theory can be used to show the impossibility of angle trisection with a compass and straightedge. The basic idea: start with numbers 0 and 1, allow constructing numbers in the complex plane through compass and straightedge. The only numbers that are constructible this way exist in field extensions that have dimension <script type="math/tex">2^n</script> over the rationals. However, to trisect the angle <script type="math/tex">2\pi/3</script>, we would need to be able to construct a number (<script type="math/tex">\cos {2\pi / 9}</script>) that exists in a field extension of dimension 3 over the rationals. Therefore general trisection is impossible.</p>
<h2 id="references">References</h2>
<ul>
<li>Ian Stewart, <em>Galois Theory</em> (4th Edition)</li>
</ul>
Sat, 04 Aug 2018 00:00:00 -0700
http://www.tildedave.com/2018/08/04/the-joy-of-field-extensions.html
http://www.tildedave.com/2018/08/04/the-joy-of-field-extensions.htmlNostalgia: Mr. Rogers and Mad Men's Carousel<p>One of the most famous scenes in AMC’s <em>Mad Men</em> comes at the end of Season 1. Don Draper’s been having a hard time of things lately - his marriage is falling apart and his relationship with his coworkers has taken a major downwards trend. To keep those plates spinning, Don gives the pitch of a lifetime.</p>
<center><iframe width="560" height="315" src="https://www.youtube.com/embed/suRDUFpsHus" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen=""></iframe></center>
<p>This is one of the most famous scenes of the series, but after having rewatched Mad Men a few times I’ve come to a really bleak reading of it. All the pictures of his wife are from their courtship and he’s just spent the last 13 episodes ignoring her, either by not being around, or by gaslighting her concerns about her life and their marriage. After the scene he tries to go home and live it and Betty’s gone, having taken the kids away for Thanksgiving (there was an argument earlier in the episode about this). Don might want to use nostalgia to go that place where he knows that he’s loved, but that place doesn’t exist inside of him. He can only summon it into being as an abstraction that he can use to land an account.</p>
<p>I found myself thinking about Don Draper’s Carousel after watching the new documentary <em>Won’t You Be My Neighbor</em>. I grew up a <em>Mr. Roger’s Neighborhood</em> kid and if you also watched while young, just try to make it through the trailer without tearing up a bit:</p>
<center><iframe width="560" height="315" src="https://www.youtube.com/embed/FhwktRDG_aQ" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen=""></iframe></center>
<p>Something that the documentary addresses is the everpresent question “<em>Was he really like that?</em>”, to which the answer appears to be “Yes”. Mr. Rogers wasn’t a Navy SEAL, he doesn’t have tattooed arms underneath his sweater, and the closest we see him get to angry is in a clip of him talking about how we are letting our children down. Mr. Rogers really <em>was</em> just a person who cared deeply about children, thought they had something to useful to say, and wanted the rest of society to care as much as he did.</p>
<p><em>Won’t You Be My Neighbor</em> is uses the same tools as Don Draper’s Carousel (nostaglia), except that instead of the fictional Don Draper using it to make you buy something, it’s summoning into your adult consciousness the perspective of a child and a language that makes the emotional issues we deal as adults super-explicit.</p>
<p>At one point they sing <a href="http://www.neighborhoodarchive.com/music/songs/sometimes_wonder_mistake.html"><em>Sometimes I Wonder If I’m a Mistake</em></a>. Daniel Striped Tiger vocalizes all these uncertainties and anxieties - he’s so different from everyone else and he can’t do anything right.</p>
<center><iframe width="560" height="315" src="https://www.youtube.com/embed/x6XAP_VThhk" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen=""></iframe></center>
<p>In the documentary, the Lady Aberlin actress points out that Daniel doesn’t “snap out of it” during singing - the fear doesn’t go away just because you’ve had someone tell you you’re better. And of course, the fears of Daniel aren’t just the anxieties of a child - adults have these same anxieties and just because you’re a little bigger, that doesn’t mean you don’t need someone to accept you just as you are.</p>
<p>Later, there’s a scene where various people who worked with Mr. Rogers think back to someone who helped them, someone who was there for them - their parents, old teachers, old friends and loved ones. They’re there, inside of you, and the documentary bought to life for me how important that emotional place is to maintain as an oasis among all the struggles of adulthood.</p>
<p>It’s powerful stuff, but the nostalgia is what makes it even more powerful: these songs and characters still rattle around my brain thirty years after the last time I sat down to watch an episode of it, and the documentary reframed all those songs and characters in a way that was really impactful to me as an adult viewer.</p>
Sun, 24 Jun 2018 00:00:00 -0700
http://www.tildedave.com/2018/06/24/mr-rogers-and-mad-mens-carousel.html
http://www.tildedave.com/2018/06/24/mr-rogers-and-mad-mens-carousel.htmlAn Appreciation - Blow-Up<p><em>Blow-Up</em> is Michalengelo Antonioni’s first English film and was released at the end of 1966. The plot is quickly summarized: in 1960s London, a professional photographer (Thomas) tries to escape his day-to-day by taking pictures in a nearby park. There he encounters a couple and takes their photos from a distance. He is confronted by a woman who demands he surrender his roll of film, and she persists in following him to his studio to try to get it back. Later he develops the pictures and notices a little detail in one of them - upon magnifying it (thus given name to the title), he discovers in the grainy detail of his photographs a potential murder plot.</p>
<center><iframe width="560" height="315" src="https://www.youtube.com/embed/Q62gRiUrylw" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen=""></iframe></center>
<p>He returns to the park and finds a dead body, hiding under the trees. Upon returning to his studio he finds all of his film and photographs of the scene have been taken. Later, returning to the park, he finds no evidence of the dead body. Was there ever a murder? The End.</p>
<p>For me <em>Blow-Up</em> is more relevant today than Antonioni’s other works, great though they are. His “alienation triology” (<em>L’Avventura</em>, <em>La Notte</em> and <em>L’Eclisse</em>) are great movies that touch on alienation in the modern world, but the characters in those movies always struck me as abstract and were just a bit harder to relate to.</p>
<p>In contrast it’s always been easy for me to identify with Thomas, and his emotional arc gets reinforced by the movie in ways that Antonioni’s other movies are less interested in. At the start of the movie, he is brash and overconfident. When he first “discovers” the murder plot he initially thinks he’s saved someone’s life (he’s basically a hero!). Then he takes another look at the photographs and discovers there might be a dead body body there (it’s so grainy!). He goes to the park again but it seems completely unreal, the dead body hasn’t moved in 12 hours. It seems fake. He loses his photos and then can’t even reconstruct a plausible story of what <em>did</em> happen. At the end of the movie in one of my favorite movie endings of all time, he watches the mimes playing tennis with an invisible ball … and then slowly begin to hear through his ear, the sounds of the invisible ball hitting the court. His feeling of objective truth is shattered, the camera pans out, and he vanishes into into landscape.</p>
<p>Outside its main arc, the themes of <em>Blow-Up</em> remain relevant in today’s world where everyone has a camera in their pocket and presents themselves to the world through a set of carefully curated pictures. Thomas’s lens of the world is one of intense privilege - he forces other people to adapt to his world as he encounters them. For his professional work, he forces the women in front of the camera to supplicate themselves to him, but it’s clear that they’re more complicated than the version of them that ends up captured by the film. In attempting to get back the park photos, Vanessa Redgrave tries to seduce him, presented as a “well, maybe this will work?” attempt by a goal-driven woman. It’s hard to feel like Thomas really <em>knows</em> anyone that he interacts with. Other people are just things be forced into perspective by his lens on the world.</p>
<p><img class="img-responsive" style="display: block; margin: auto; max-width: 600px" src="/images/blow-up-david-hemmings.jpg" /></p>
<p>Once the movie is over, I’m not sure where Thomas would go or what he would do. What happens after your view on the world has been totally shattered? Better to just leave him on the grass - he’s finally living in the real world instead a carefully managed construction. It’s a really great movie.</p>
Sun, 20 May 2018 00:00:00 -0700
http://www.tildedave.com/2018/05/20/an-appreciation-blow-up.html
http://www.tildedave.com/2018/05/20/an-appreciation-blow-up.htmlBook Review - A Distant Mirror<p>The middle ages weren’t a pleasant time to be alive. The Black Death killed half of the European population, out-of-control mercenary companies ravaged the land, peasants were exploited on every level by the nobility. In <em>A Distant Mirror</em>, Barbara Tuchman (author of <em>The Guns of August</em> on the runup to the Great War) walks through what life was like, with an eye towards the politics of the nobility and a focus on France in the midst of the Hundred Years war.</p>
<p>Wars between kings are expensive, usually funded by taxes on the peasantry around extremely pointless issues, and come to anticlimatic resolution. <a href="https://en.wikipedia.org/wiki/Louis_I,_Duke_of_Anjou">One French Duke</a> spends several chapters trying to get money to fund a company to go to Italy to press his claim on the Kingdom of Napes. In doing this he ignores the troubles of the French state (Charles VI has succeeded his father but is only a boy). Once he does get troops together they march down into Italy, manage to piss off all the Italian city states, ignores an opportunity to score a political win for the French state by capturing Urban VI (half of a papal schmism), and eventually dies without accomplishing much of anything. Later Tuchman characterizes this mindset:</p>
<blockquote>
<p>What moved knights to war was desire to do deeds of valor augmented by zeal for the faith, not the gaining of a political end by force of arms. They were concerned with the action, not the goal—which was why the given goal was so rarely attained.</p>
</blockquote>
<p>The book is full of stories like this - from our view of things, political actors pursue the wrong goals, squander their opportunities, and ultimately accomplish nothing. It’s clear George RR Martin took inspiration for his <em>Game of Thrones</em> from this portrait of the era. As much as his later books are criticized for going nowhere, history has way more examples of action that goes nowhere. If anything, <em>A Feast For Crows</em> and <em>A Dance With Dragons</em> have way more action than their historical models.</p>
<p><em>A Distant Mirror</em> ends with the story of the Battle of Nicopolis. The French knights go to Hungary to help the King of Hungary defend against the Ottoman Turks. In doing this they squander their money on luxuries for the traveling nobles, underestimate their opponents, ignore good battle advice, and make an ill-advise glory-seeking charge. The knights end up losing and are captured and ransomed by the Turks.. Later, French knights are cut down by English professional soldiers at the Battle of Agincourt, the English’s attempts to claim the French crown are foiled by revolts from Joan d’Arc and the emergence of a French national identity, and in a final act of pointlessness the main character’s castle is ultimately blown up in a show of force by Erich Luderdorff’s troops in the Great War.</p>
<p>Why do we read history? The fourteenth century is so disconnected from today’s political situation that it’s impossible to draw major connections, but people today are still much like people six hundred years earlier. What Tuchman does on page after page is to draw out the people - who they were, what they wanted, how they lived. There aren’t many books like this one.</p>
Sun, 11 Feb 2018 00:00:00 -0800
http://www.tildedave.com/2018/02/11/a-distant-mirror.html
http://www.tildedave.com/2018/02/11/a-distant-mirror.html