tl;dr I parodied my own book, download the new version here. People often complain to me about how olympiad geometry is just about knowing a bunch of configurations or theorems. But it recently occurred to me that when you actually … Continue reading

# Author Archives: Evan Chen (陳誼廷)

# RMM 2019 pictures and aftermath

Pictures, thoughts, and other festives from the 2019 Romania Masters in Math. See also the MAA press release. Summary Po-Shen Loh and I spent the last week in Bucharest with the United States team for the 11th RMM. The USA … Continue reading

# Napkin v1.5 (and more)

Careful readers of my blog might have heard about plans to have a second edition of Napkin out by the end of February. As it turns out I was overly ambitious, and (seeing that I am spending the next week … Continue reading

# Story: the morning after Valentine’s Day

When I finally open my eyes and look at the clock, it is 8am. It doesn’t *feel* like it’s only been eight hours, though. I’ve just had a long and complicated dream that I can’t remember much of anymore, except that I think I was running a lot, and trying to not die, so I somehow feel sore.

*That NyQuil stuff really works*, I think to myself, and crawl out of bed. (Even though it’s like trying to drink mouthwash.) I haven’t slept that soundly all week. Or maybe I’m finally slowly recovering from my cold, and that’s why that night was better? All I know is that I’m glad I didn’t spend another night coughing my lungs out and struggling to get some shut-eye.

I drag my sorry butt out of bed and head over to my nearby computer. It’s the Friday morning before Harvard-MIT math tournament, which means that the server is getting more traffic than usual, and I was supposed to have upgraded the server in anticipation yesterday night. But Valentine’s Day was too hectic for me this year, and I never got around to it.

Not hectic for any romantic reasons. It was because I had 5.5 hours of class more or less consecutively, after which I rushed back to my place to teach for another four hours straight, all the while coughing like a banshee. Okay, so maybe I would have slept fine without the NyQuil.

Officially, this is supposed to be the software team’s job. But the HMMT website has become a complete mess that I think I might be the only person left that still knows more than half of what it’s doing. (Well, actually, Banana seems have figured out a lot of it too.) It is sort the equivalent of Frankenstein’s monster, with parts being sewn in and out over the last who-knows-how-many-years by random undergraduates with various degrees of competence, and held together by the seams with spit and prayers. The top of the main settings files still reads

Django settings for mysite project. For more information on this file, see https://docs.djangoproject.com/en/1.6/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.6/ref/settings/

where the “1.6” version number still makes me wince every time I see it (that means this file was created *before* I made the IMO). I am looking forward to the end of this tournament season so I can burn the whole website to the ground and re-write it.

(Making matters worse, in terms of “various degrees of competence”, I am on the low end, with no formal CS experience at all. Not good I am in charge.)

So it’s time to bump up the servers belatedly. I need to bump the web server and then the database up from t2.micro to m1.medium. There will be some downtime, but no big deal — everyone’s probably still asleep. This should only take a few minutes, and then I can work on getting the grader ready for the approximately 100,000 grading inputs that we’re going to force-feed it on Saturday.

So I push a few buttons, and let Amazon Web Services do its magic, just like the last five times I had to do this.

Something’s wrong. It’s been ten minutes already, and the website still won’t load. The upgrades should be done by now. I refresh again, and realize that it’s throwing a 500 error.

I feel a twinge of despair, which causes my cough to start to return. Looks like the NyQuil wore off. *It always starts like this. One little error, followed by another, and then…* I clench my teeth and SSH into the new server, and navigate to the log files (which I remember having to set up myself a few years ago, precisely for situations like this).

And indeed, when I get there, the same message is repeated, over and over, for the last several minutes, like a harbinger of doom:

OperationalError: (1045, "Access denied for user 'ebroot'@'xx.xx.xx.xx' (using password: YES)")

Oh, well, here we go.

My first guess is VPC groups, which have bitten me plenty in the past. Unfortunately, tinkering with these has no effect, so it seems like there is something new going on.

I double-check and triple-check the password, but it seems right. (This is the same error you get if you enter the wrong password!) So that’s not it, either.

This is a connection issue, so, the first thing I want to do is figure out whether the issue is with the upgraded server or the upgraded database. So, I go to my command bar and launch MySQL workbench, which promptly gives me

mysql-workbench: command not found

Oh, right, I don’t have Workbench installed on my desktop. So I go over to my laptop, which does have it, and try to fire up a connection to the database. This time, it gives me

喊叫 org.freedesktop.secrets 發生錯誤

Uhh, what? Okay, I have a keyring error of some sort here. I decide it’s not worth it to try to fix the workbench, and decide to do it the old fashioned way. I fire another terminal and call mysql, which promptly returns with:

mysql: command not found

Great. Okay, well, I guess I can install it, no problem. So I type in `sudo pacman -S mysql`

which gives

:: 有 2 個提供者可供 mysql：:: 軟體庫 extra1) mariadb:: 軟體庫 community2) percona-server輸入某個數字（預設=1）:

Huh? Oh, Arch Linux prefers MariaDB over MySQL, I remember now. That means SQL, unlike MariaDB, is not pre-packaged, and I’ll need to download it from the Arch User Repository and compile it form source. So I download the PKGBUILD and let it start going.

Unfortunately, this means that the binary needs to build from source, and so maybe minutes later I’m staring at the build progress and it’s at 14%. All the while the website is down, and people are starting to notice. I can feel the tension all over my body as I realize that the tournament will simply not function if I can’t get this back up and working, and the nightmare from February 2018 starts coming back to my mind again. I explode into a symphony of coughs as I struggle to gain my composure.

The compile-from-source doesn’t respond to my please. I decided that’s not good enough, and I have to do something faster.

At this point I decide I maybe should get help, so I hit up Banana who has saved HMMT on numerous occasions as well, and ask him why I can’t connect to the HMMT database. He’s done so successfully on his computer in the past, and he even has a little script he’s written to do so. His response puzzles me:

“Seems connectable. Might need to reset your DNS?”

Uh, what?

This is the only lead I have to go after, so I start prodding him like crazy, since I can’t seem to get it to do anything from my end. At first I get a couple suggestions, which don’t work, but eventually Banana finally gives me:

“Uhhhh. Can you try running db-connect on your machine and going from there? I have to start hauling.”

Right. Unlike me, Banana is actually helping the directors move around the 30 gallons of apple juice and 50 gallons of mango nectar and way-too-many gallons of water that will be used today or tomorrow. So I am really on my own.

At least I now know that it’s on the database end, sorta. I quickly locate db-connect: it’s the mini-script that Banana has been using to do the connection. Maybe this will let me get in and see what’s happening. I type:

./db-connect.sh dev

which promptly gives

mysql: command not found

Ah right, we’re still working on that, huh? The sql compilation is going nowhere fast, and so I have to think of something else.

I think of one possible approach: the workbench won’t work on my laptop, but maybe it’ll work on my desktop? I order pacman to install MySQL Workbench on my desktop too, and after a couple dozen agonizing seconds, the download is all done. To my delight, there is no error about org.freedesktop.secrets, and so I impatiently set everything up and login to find:

ERROR 1045 (28000): Access denied for user 'ebroot'@'xx.xx.xx.xx' (using password: YES)

*Oh, no, no, no.* I explode into another fit of coughs which prevent me from screaming at the monitor in frustration.

At this point, I decide this isn’t worth fighting. I can figure it out another time. For now, *the show must go on*.

That means that if I restore a backup of the old database — reverting it back to how it was yesterday, when everything went totally fine — then I can at least get the computer to work now, and worry about what the error was later.

Unfortunately, this is a painfully slow process. (The way backups work is that they don’t *replace* the existing database. Instead, it creates a brand new database somewhere on the cloud, but that has a copy of the same data as the point in time.) I load the backup, and twitch in agony as it slowly creates a new database from the image, setting everything back to how it was earlier. I hope that’s good enough.

After what feels like an eternity, the database is all set. I change the pointer of my now-working WorkBench to the new database and try to connect to see what happens, only to be greeted with 45 seconds of nothing, followed by a simple error message telling me that the connection failed.

Why? Oh yeah, I didn’t send the VPC for the new database. I do that, exhaling, it should be fine now, and connect to the new restored database, only to find:

ERROR 1045 (28000): Access denied for user 'ebroot'@'xx.xx.xx.xx' (using password: YES)

I practically choke on my own spit, which results in another several seconds of me wheezing like heck.

*Nooooooooooooooooooooooo.*

Okay, I have to fix this now.

The only clue I have is that the database script from Banana still works. But on my computer I can’t for some reason run it.

I go back to Google (which I have been using extensively the whole time), and then after another few minutes of frantic searching, realize that MariaDB is actually good enough for me: once I have that installed, I’ll have a (slightly different) SQL client, but the script should work. Hmm.

Since MariaDB is pre-packaged, that means the installation is easy, and I run it. This might be it. I fire the script again, and run into:

mysql: unknown option '--enable-cleartext-plugin'

Oh, huh. Okay, well, maybe it doesn’t matter. I delete that flag from the script, and get

mysql: unknown variable 'ssl-mode=VERIFY_IDENTITY'

Uhh. Let’s cross our fingers that doesn’t matter either? I try that again, and — much to my amazement — the connection works.

I start examining the db-connect script closely, and see that instead of the user `ebroot`

it’s connecting using some user name `dev`

. So maybe there is some new permission issues with `ebroot`

? With my new connection, I try to

GRANT ALL PRIVILEGES ON *.* TO 'ebroot'@'%';

which then returns with the following message:

ERROR 1045 (28000): Access denied for user 'dev'@'%' (using password: YES)

Uhhh.

Okay, maybe something else. I read the db-connect script again. Is there anything else that’s different? Well, there’s one more change in the code that I can at least work with: there is a CA certificate that’s being used.

I fire up WorkBench again, and try to log in again, but this time I pass a newfound CA certificate (appropriately named *rds-combined-ca-bundle.pem*) and to my relief, I find that I can now log in as ebroot. That’s the issue!

Except I have no idea how to make Django do that and I have no intention if finding out. But another Google search suggests the answer: now that I’m finally connected with ebroot I type

ALTER USER 'ebroot'@'%' REQUIRE NONE;

And breathed a sigh of relief when I refreshed hmmt.co, and harmony was restored in the world.

I looked at the clock. It was 11am. There goes my whole morning. I go downstairs to drink a bottle of Soylent for breakfast, resolving to never become a programmer for a living, or at least to get some proper training first if I ever consider it.

Meanwhile, the rest of the Harvard-MIT math tournament go on with their day, blissfully unaware of the debacle narrowly averted.

# Math contest platitudes, v3

I think it would be nice if every few years I updated my generic answer to “how do I get better at math contests?”. So here is the 2019 version. Unlike previous instances, I’m going to be a little less olympiad-focused than I usually am, since these days I get a lot of people asking for help on the AMC and AIME too.

(Historical notes: you can see the version from right after I graduated and the version from when I was still in high school. I admit both of them make me cringe slightly when I read them today. I still think everything written there is right, but the style and focus seems off to me now.)

## 0. Stop looking for the “right” training (or: be yourself)

These days many of the questions I get are clearly most focused on trying to find a perfect plan — questions like “what did YOU do to get to X” or “how EXACTLY do I practice for Y”. (Often these words are in all-caps in the email, too!) When I see these I always feel very hesitant to answer. The reason is that I always feel like there’s some implicit hope that I can give you some recipe that, if you follow it, will guarantee reaching your goals.

I’m sorry, math contests don’t work that way (and can’t work that way). I actually think that if I gave you a list of which chapters of which books I read in 2009-2010 over which weeks, and which problems I did on each day, and you followed it to the letter, it would go horribly.

Why? It’s not just a talent thing, I think. Solving math problems is actually a deeply personal art: despite being what might appear to be a cold and logical discipline, learning math and getting better at it actually requires being *human*. Different people find different things natural or unnatural, easy or hard, et cetera. If you try to squeeze yourself into some mold or timeline then the results will probably be counterproductive.

On the flip side, this means that you can worry a lot less. I actually think that surprisingly often, you can get a first-order approximation of what’s the “best” thing to do by simply doing whatever feels the most engaging or rewarding (assuming you like math, of course). Of course there are some places where this is not correct (e.g., you might hate geometry, but cannot just ignore it). But the first-order approximation is actually quite decent.

That’s why in the introduction to my geometry book, I explicitly have the line:

Readers are encouraged to not be bureaucratic in their learning and move around as they see fit, e.g., skipping complicated sections and returning to them later, or moving quickly through familiar material.

Put another way: as learning math is quite personal, the advice “**be yourself**” is well-taken.

## 1. Some brief recommendations (anyways)

With all that said, probably no serious harm will come from me listing a little bit of references I think are reasonable — so that you have somewhere to start, and can oscillate from there.

For learning theory and fundamentals:

- AMC – mid AIME: Volume 2
- Late AIME and beyond: E.G.M.O., OTIS Excerpts, and more

For sources of additional practice problems (other than the particular test you’re preparing for):

- The collegiate contests HMMT November, PUMaC, CMIMC will typically have decent short-answer problems.
- HMMT February is by far the hardest short-answer contest I know of.
- At the olympiad level, there are so many national olympiads and team selection tests that you will never finish. (My website has an archive of USA problems and solutions if you’re interested in those in particular.)

The IMO Shortlist is also good place to work as it contains proposals of varying difficulty from many countries — and thus is the most culturally diverse. As for other nations, as a rule of thumb, any country that often finishes in the top 20 at the IMO (say) will probably have a good questions on their national olympiad or TST.

For every subject that’s not olympiad geometry, there are actually surprisingly few named theorems.

## 2. Premature optimization is the root of all evil (so just get your hands dirty)

For some people, the easiest first step to getting better is to double the amount of time you spend practicing. (Unless that amount is zero, in which case, you should just start.)

There is a time and place for spending time thinking about how to practice — one example is if you’ve been working a while and feel like nothing has changed, or you’ve been working on some book and it just doesn’t feel fun, etc. Another common example is if you notice you keep missing all the functional equations on the USAMO: then, maybe it’s time to search up some handouts on functional equations. Put another way, if you feel *stuck*, then you can start thinking about whether you’re not doing something right.

On the other extreme, if you’re wondering whether you are ready to read book X or do problems from Y contest, my advice is to just try it and see if you like it. There is no commitment: just read Chapter 1, see how you feel. If it works, keep doing it, if not, try something else.

(I can draw an analogy from my own life. Whenever I am learning a new board game or card game, like Catan or Splendor or whatever, I always overthink it. I spend all this time thinking and theorizing and trying to come up with this brilliant strategy — which never works, because it’s my *first game*, for crying out loud. It turns out that until you start grappling at close range and getting your hands dirty, your internal model of something you’ve never done is probably not that good.)

## 3. Doing problems just above your level (and a bit on reflecting on them)

There is one pitfall that I do see sometimes, common enough I will point it out. If you mostly (only?) do old practice tests or past problems, then you’re liable to be spending too much time on easy problems. That was the topic of another old post of mine, but the short story is that if you find yourself constantly getting 130ish on AMC10 practice tests, then maybe you should spend most of your time working on problems 21-25 rather than repeatedly grinding 1-20 over and over. (See 28:30-29:00 here to hear Zuming make fun of them.)

The common wisdom is that you should **consistently do problems just above your level** so that you gradually increase the difficulty of problems you are able to solve. The situation is a little more nuanced at the AMC/AIME level, since for those short-answer contests it’s *also* important to be able to do routine problems quickly and accurately. However, I think for most people, you really should be spending at least 70% of your time getting smarter, rather than just faster.

I think in this case, I want to give concrete descriptions. Here’s some examples of what can happen after a problem.

*You looked at the problem and immediately (already?) knew how to do it.*Then you probably didn’t learn much from it. (But at least you’ll get faster, if not smarter.)*You looked at the problem and didn’t know right away how to start, but after a little while figured it out.*That’s a little better.*You struggled with the problem and eventually figured out a solution, but maybe not the most elegant one.*I think that’s a great situation to be in. You came up with*some*solution to the problem, so you understand it fairly well, but there’s still more for you to update your instincts on. What can you do in the future to get solutions more like the elegant one?*You struggled with the problem and eventually gave up, then when you read the solution you realize quickly what you were missing.*I think that’s a great situation to be in, too. You now want to update your instincts by a little bit — how could you make sure you don’t miss something like that again in the future?*The official solution quoted some theorem you don’t know.*If this was among a batch of problems where the other problems felt about the right level to you, then I think often this is a pretty good time to see if you can learn the statement (better, proof) of the theorem. You have just spent some time working on a situation in which the theorem was useful, so that data is fresh in your mind. And pleasantly often, you will find that ideas you came up with during your attempt on the problem correspond to ideas in the statement or proof of the theorem, which is great!*You didn’t solve the problem, and the solution makes sense, but you don’t see how you would have come up with it.*It’s possible that this is the fault of the solutions author (many people are actually quite bad at making solutions read naturally). If you have a teacher, this is the right time to ask them about it. But it’s also possible that the problem was too hard. In general, I think it’s better to miss problems “by a little”, whatever that means, so that you can update your intuition correctly.*You can’t even understand the solution.*Okay, too hard.

You’ll notice how much emphasis I place on the post-problem reflection process. This is actually important — after all the time you spent working on the problem itself, you want to update your instincts as much as possible to get the payoff. In particular, I think it’s usually worth it to read the solutions to problems you worked on, whether or not you solve them. In general, after reading a solution, I think you should be able to state in a couple sentences all the main ideas of the solution, and basically know how to solve the problem from there.

For the olympiad level, I have a whole different post dedicated to reading solutions, and interested readers can read more there. (One point from that post I do want to emphasize since it wasn’t covered explicitly in any of the above examples: by USA(J)MO level it becomes important to begin building intuition that you can’t explicitly formalize. You may start having vague feelings and notions that you can’t quite put your finger on, but you can feel it. These non-formalizable feelings are valuable, take note of them.)

## 4. Leave your ego out (e.g. be willing to give up on problems)

This is easy advice to give, but it’s hard advice to follow. For concreteness, here are examples of things I think can be explained this way.

Sometimes people will ask me whether they need to solve *every* problem in each chapter of EGMO, or do *every* past practice test, or so on. The answer is: of course not, and why would you even think that? There’s nothing magical about doing 80% of the problems versus 100% of them. (If there was, then EGMO is secretly a terrible book, because I commented out some problems, and so OH NO YOU SKIPPED SOME AAAHHHHH.) And so it’s okay to start Chapter 5 even though you didn’t finish that last challenge problem at the end. Otherwise you let one problem prevent you from working on the next several.

Or, sometimes I learn about people who, if they do not solve an olympiad problem, will refuse to look at the solution; instead they will mark it in a spreadsheet and to come back to later. In short, they *never* give up on a problem: which I think is a bad idea, since reflecting on missed problems is so important. (It is not as if you can realistically run out of olympiad problems to do.) And while this is still better than giving up too early, I mean, all things in moderation, right?

I think if somehow people were able to completely leave your ego out, and not worry at all about how good you are and rather just maximize learning, then mistakes like these two would be a lot rarer. Of course, this is impossible to do in practice (we’re all human), but it’s good to keep in mind at least that this is an ideal we can strive for.

## 5. Enjoy it

Which leads me to the one bit that everyone already knows, but that no platitude-filled post would be complete without: to do well at math contests (or anything hard) you probably have to enjoy the process of getting better. Not just the end result. You have to enjoy the work itself.

Which is not to say you have to do it all the time or for hours a day. Doing math is hard, so you get tired eventually, and beyond that forcing yourself to work is not productive. Thus when I see people talk about how they plan to do every shortlist problem, or they will work N hours per day over M time, I always feel a little uneasy, because it always seems too results-oriented.

In particular, I actually think it’s quite hard to spend more than two or three good hours per day on a regular basis. I certainly never did — back in high school (and even now), if I solved one problem that took me more than an hour, that was considered a good day. (But I should also note that the work ethic of my best students consistently amazes me; it far surpasses mine.) In that sense, the learning process can’t be forced or rushed.

There is one sense in which you *can* get more hours a day, that I am on record saying quite often: if you think about math in the shower, then you know you’re doing it right.

# Some things Evan is working on for 2019

With Christmas Day, here are some announcements about my work that will possibly interest readers of this blog.

## OTIS V Applications

Applications for OTIS V are open now, so if you are an olympiad contestant interested in working with me during the 2019-2020 school year, here is your chance. I’m hoping to find 20-40 students for the next school year. Note that the application has math problems in it, unlike previous years, so you have to start early.

## OTIS Lecture Series

At the same time, I realize that I will never be able to take everyone for OTIS. So I am planning to post a substantial fraction of OTIS materials for public consumption, hopefully by late January, but no promises.

## Napkin 2nd edition

The Napkin is getting a second edition which, if all goes well, should come out by the end of February (but that is a big “if”). Most chapters will be mostly unchanged modulo typos, but a few big changes:

- I am hoping to add a new part on measure theory with an eye towards probability applications (e.g. law of large numbers, central limit theorem, stopped martingales).
- There will be a bit of real analysis / calculus now. (Not much.)
- Maybe two-ish bonus chapters on other topics being added.
- The earliest chapters (on algebra and topology) are being re-organized significantly, though most of the content should remain the same.
- The algebraic geometry chapters on schemes are getting a major facelift, because the old ones were terrible. They will still cover roughly the same content, but in a way that makes more sense, has more examples, and has more pictures.

This means that for the first time the numbering of the chapters is going to break with the new update. This also means there will be plenty of new typos and mistakes for readers to find. I’m looking forward to it!

## SPARC 2019 applications

For high school students, SPARC applications will open soon. The deadline will probably be the end of February. This year SPARC will be held in the Bay Area from July 24 to August 2.

# A few shockingly linear graphs

There’s a recent working paper by economists Ruchir Agarwal and Patrick Gaule which I think would be of much interest to this readership: a systematic study of IMO performance versus success as a mathematician later on.

Here is a link to the working paper.

Despite the click-baity title and dreamy introduction about the Millenium Prizes, the rest of the paper is fascinating, and the figures section is a gold mine. Here are two that stood out to me:

There’s also one really nice idea they had, which was to investigate the effect of getting one point less than a gold medal, versus getting exactly a gold medal. This is a pretty clever way to account for the effect of the prestige of the IMO, since “IMO gold” sounds so much better on a CV than “IMO silver” even though in any given year they may not differ so much. To my surprise, the authors found that “being awarded a better medal appears to have no additional impact on becoming a professional mathematician or future knowledge production”. I included the relevant graph below here.

The data used in the paper spans from IMO 1981 to IMO 2000. This is before the rise of Art of Problem Solving and the Internet (and the IMO was smaller back then, anyways), so I imagine these graphs might look different if we did them in 2040 using IMO 2000 – IMO 2020 data, although I’m not even sure whether I expect the effects to be larger or smaller.

(As usual: I do not mean to suggest that non-IMO participants cannot do well in math later. This is so that I do not get flooded with angry messages like last time.)

# A trailer for p-adic analysis, second half: Mahler coefficients

In the previous post we defined -adic numbers. This post will state (mostly without proof) some more surprising results about continuous functions . Then we give the famous proof of the Skolem-Mahler-Lech theorem using -adic analysis.

## 1. Digression on

Before I go on, I want to mention that is not algebraically closed. So, we can take its algebraic closure — but this field is now no longer complete (in the topological sense). However, we can then take the completion of this space to obtain . In general, completing an algebraically closed field remains algebraically closed, and so there is a larger space which is algebraically closed *and* complete. This space is called the -adic complex numbers.

We won’t need at all in what follows, so you can forget everything you just read.

## 2. Mahler coefficients: a description of continuous functions on

One of the big surprises of -adic analysis is that we can concretely describe all continuous functions . They are given by a basis of functions

in the following way.

**Theorem 1** **(Mahler; see Schikhof Theorem 51.1 and Exercise 51.B)**

Conversely, if is any sequence converging to zero, then defines a continuous function satisfying (1).

The are called the *Mahler coefficients* of .

**Exercise 2**

Last post we proved that if is continuous and for every then . Re-prove this using Mahler’s theorem, and this time show conversely that a unique such exists when .

You’ll note that these are the same finite differences that one uses on polynomials in high school math contests, which is why they are also called “Mahler differences”.

Thus one can think of as saying that the values of , , \dots behave like a polynomial modulo for every . Amusingly, this fact was used on a USA TST in 2011:

**Exercise 3** **(USA TST 2011/3)**

Let be a prime. We say that a sequence of integers is a *-pod* if for each , there is an such that whenever , divides the sum

Prove that if both sequences and are -pods, then the sequence is a -pod.

## 3. Analytic functions

We say that a function is **analytic** if it has a power series expansion

As before there is a characterization in terms of the Mahler coefficients:

**Theorem 4** **(Schikhof Theorem 54.4)**

The function is analytic if and only if

Just as holomorphic functions have finitely many zeros, we have the following result on analytic functions on .

**Theorem 5** **(Strassmann’s theorem)**

Let be analytic. Then has finitely many zeros.

## 4. Skolem-Mahler-Lech

We close off with an application of the analyticity results above.

**Theorem 6** **(Skolem-Mahler-Lech)**

Let be an integral linear recurrence. Then the zero set of is eventually periodic.

*Proof:* According to the theory of linear recurrences, there exists a matrix such that we can write as a dot product

Let be a prime not dividing . Let be an integer such that .

Fix any . We will prove that either all the terms

are zero, or at most finitely many of them are. This will conclude the proof.

Let for some integer matrix . We have

Thus we have written in Mahler form. Initially, we define , but by Mahler’s theorem (since ) it follows that extends to a function . Also, we can check that hence is even analytic.

Thus by Strassman’s theorem, is either identically zero, or else it has finitely many zeros, as desired.

# A trailer for p-adic analysis, first half: USA TST 2003

I think this post is more than two years late in coming, but anywhow…

This post introduces the -adic integers , and the -adic numbers . The one-sentence description is that these are “integers/rationals carrying full mod information” (and only that information).

The first four sections will cover the founding definitions culminating in a short solution to a USA TST problem.

In this whole post, is always a prime. Much of this is based off of Chapter 3A from *Straight from the Book*.

## 1. Motivation

Before really telling you what and are, let me tell you what you might expect them to do.

In elementary/olympiad number theory, we’re already well-familiar with the following two ideas:

- Taking modulo a prime or prime , and
- Looking at the exponent .

Let me expand on the first point. Suppose we have some Diophantine equation. In olympiad contexts, one can take an equation modulo to gain something else to work with. Unfortunately, taking modulo loses some information: (the reduction is far from injective).

If we want finer control, we could consider instead taking modulo , rather than taking modulo . This can also give some new information (cubes modulo , anyone?), but it has the disadvantage that isn’t a field, so we lose a lot of the nice algebraic properties that we got if we take modulo .

One of the goals of -adic numbers is that we can get around these two issues I described. The -adic numbers we introduce is going to have the following properties:

- You can “take modulo for all at once”. In olympiad contexts, we are used to picking a particular modulus and then seeing what happens if we take that modulus. But with -adic numbers, we won’t have to make that choice. An equation of -adic numbers carries enough information to take modulo .
- The numbers form a field, the nicest possible algebraic structure: makes sense. Contrast this with , which is not even an integral domain.
- It doesn’t lose as much information as taking modulo does: rather than the surjective we have an
*injective*map . - Despite this, you “ignore” some “irrelevant” data. Just like taking modulo , you want to zoom-in on a particular type of algebraic information, and this means necessarily losing sight of other things. (To draw an analogy: the equation has no integer solutions, because, well, squares are nonnegative. But you will find that this equation has solutions modulo any prime , because once you take modulo you stop being able to talk about numbers being nonnegative. The same thing will happen if we work in -adics: the above equation has a solution in for every prime .)

So, you can think of -adic numbers as the right tool to use if you only really care about modulo information, but normal isn’t quite powerful enough.

To be more concrete, I’ll give a poster example now:

Here is a problem where we *clearly* only care about -type information. Yet it’s a nontrivial challenge to do the necessary manipulations mod (try it!). The basic issue is that there is no good way to deal with the denominators modulo (in part is not even an integral domain).

However, with -adic analysis we’re going to be able to overcome these limitations and give a “straightforward” proof by using the identity

Such an identity makes no sense over or for converge reasons, but it will work fine over the , which is all we need.

## 2. Algebraic perspective

We now construct and . I promised earlier that a -adic integer will let you look at “all residues modulo ” at once. This definition will formalize this.

### 2.1. Definition of

**Definition 2** **(Introducing )**

A **-adic integer** is a sequence

of residues modulo for each integer , satisfying the compatibility relations for .

The set of -adic integers forms a ring under component-wise addition and multiplication.

**Example 3** **(Some -adic integers)**

Let . Every usual integer generates a (compatible) sequence of residues modulo for each , so we can view each ordinary integer as -adic one:

On the other hand, there are sequences of residues which do not correspond to any usual integer despite satisfying compatibility relations, such as

which can be thought of as .

In this way we get an injective map

which is not surjective. So there are more -adic integers than usual integers.

(Remark for experts: those of you familiar with category theory might recognize that this definition can be written concisely as

where the inverse limit is taken across .)

**Exercise 4**

Check that is an integral domain.

### 2.2. Base expansion

Here is another way to think about -adic integers using “base ”. As in the example earlier, every usual integer can be written in base , for example

More generally, given any , we can write down a “base ” expansion in the sense that there are exactly choices of given . Continuing the example earlier, we would write

and in general we can write

where , such that the equation holds modulo for each . Note the expansion is infinite to the *left*, which is different from what you’re used to.

(Amusingly, negative integers also have infinite base expansions: , corresponding to .)

Thus you may often hear the advertisement that a -adic integer is an “possibly infinite base expansion”. This is correct, but later on we’ll be thinking of in a more and more “analytic” way, and so I prefer to think of this as a **“Taylor series with base ”**. Indeed, much of your intuition from generating functions (where is a field) will carry over to .

### 2.3. Constructing

Here is one way in which your intuition from generating functions carries over:

**Proposition 5** **(Non-multiples of are all invertible)**

The number is invertible if and only if . In symbols,

Contrast this with the corresponding statement for : a generating function is invertible iff .

*Proof:* If then , so clearly not invertible. Otherwise, for all , so we can take an inverse modulo , with . As the are themselves compatible, the element is an inverse.

**Example 6** **(We have )**

We claim the earlier example is actually

Indeed, multiplying it by gives

(Compare this with the “geometric series” . We’ll actually be able to formalize this later, but not yet.)

**Remark 7** **( is an integer for )**

The earlier proposition implies that (among other things); your intuition about what is an “integer” is different here! In olympiad terms, we already knew made sense, which is why calling an “integer” in the -adics is correct, even though it doesn’t correspond to any element of .

Fun (but trickier) exercise: rational numbers correspond exactly to eventually periodic base expansions.

With this observation, here is now the definition of .

**Definition 8** **(Introducing )**

Since is an integral domain, we let denote its field of fractions. These are the **-adic numbers**.

Continuing our generating functions analogy:

This means is “**Laurent series with base **”, and in particular according to the earlier proposition we deduce:

**Proposition 9** **( looks like formal Laurent series)**

Every nonzero element of is uniquely of the form

Thus, continuing our base analogy, elements of are in bijection with “Laurent series”

for . So the base representations of elements of can be thought of as the same as usual, but extending infinitely far to the left (rather than to the right).

(Fair warning: the field has characteristic *zero*, not .)

**Remark 10** **(Warning on fraction field)**

This result implies that you shouldn’t think about elements of as (for ) in practice, even though this is the official definition (and what you’d expect from the name ). The only denominators you need are powers of .

To keep pushing the formal Laurent series analogy, is usually not thought of as quotient of generating functions but rather as “formal series with some negative exponents”. You should apply the same intuition on .

(At this point I want to make a remark about the fact , connecting it to the wish-list of properties I had before. In elementary number theory you can take equations modulo , but if you do the quantity doesn’t make sense unless you know . You can’t fix this by just taking modulo since then you need to get , ad infinitum. You can work around issues like this, but the nice feature of and is that you have modulo information for “all at once”: the information of packages all the modulo information simultaneously. So you can divide by with no repercussions.)

## 3. Analytic perspective

### 3.1. Definition

Up until now we’ve been thinking about things mostly algebraically, but moving forward it will be helpful to start using the language of analysis. Usually, two real numbers are considered “close” if they are close on the number of line, but for -adic purposes we only care about modulo information. So, we’ll instead think of two elements of or as “close” if they differ by a large multiple of .

For this we’ll borrow the familiar from elementary number theory.

**Definition 11** **(-adic valuation and absolute value)**

We define the **-adic valuation** in the following two equivalent ways:

- For we let be the largest such that (or if ). Then extend to all of by .
- Each can be written uniquely as for , . We let .

By convention we set . Finally, define the **-adic absolute value** by

In particular .

This fulfills the promise that and are close if they look the same modulo for large ; in that case is large and accordingly is small.

### 3.2. Ultrametric space

In this way, and becomes a metric space with metric given by .

In fact, these spaces satisfy a stronger form of the triangle inequality than you are used to from .

**Proposition 13** **( is an ultrametric)**

For any , we have the **strong triangle inequality**

Equality holds if (but not only if) .

However, is more than just a metric space: it is a field, with its own addition and multiplication. This means we can do analysis just like in or : basically, any notion such as “continuous function”, “convergent series”, et cetera has a -adic analog. In particular, we can define what it means for an infinite sum to converge:

**Definition 14** **(Convergence notions)**

Here are some examples of -adic analogs of “real-world” notions.

- A sequence , \dots converges to a limit if .
- The infinite series converges if the sequence of partial sums , , \dots, converges to some limit.
- \dots et cetera \dots

With this definition in place, the “base ” discussion we had earlier is now true in the analytic sense: if then

Indeed, the th partial sum is divisible by , hence the partial sums approach as .

While the definitions are all the same, there are some changes in properties that should be true. For example, in convergence of partial sums is simpler:

Contrast this with in . You can think of this as a consequence of strong triangle inequality. *Proof:* By multiplying by a large enough power of , we may assume . (This isn’t actually necessary, but makes the notation nicer.)

Observe that must eventually stabilize, since for large enough we have . So let be the eventual residue modulo of for large . In the same way let be the eventual residue modulo , and so on. Then one can check we approach the limit .

Here’s a couple exercises to get you used to thinking of and as metric spaces.

**Exercise 16** **( is compact)**

Show that is not compact, but is. (For the latter, I recommend using sequential continuity.)

**Exercise 17** **(Totally disconnected)**

Show that both and are *totally disconnected*: there are no connected sets other than the empty set and singleton sets.

### 3.3. More fun with geometric series

While we’re at it, let’s finally state the -adic analog of the geometric series formula.

**Proposition 18** **(Geometric series)**

Let with . Then

*Proof:* Note that the partial sums satisfy , and as since .

So, is really a correct convergence in . And so on.

If you buy the analogy that is generating functions with base , then all the olympiad generating functions you might be used to have -adic analogs. For example, you can prove more generally that:

**Theorem 19** **(Generalized binomial theorem)**

If and , then for any we have the series convergence

(I haven’t defined , but it has the properties you expect.) The proof is as in the real case; even the theorem statement is the same except for the change for the extra subscript of . I won’t elaborate too much on this now, since -adic exponentiation will be described in much more detail in the next post.

### 3.4. Completeness

Note that the definition of could have been given for as well; we didn’t need to introduce it (after all, we have in olympiads already). The big important theorem I must state now is:

**Theorem 20** **( is complete)**

The space is the completion of with respect to .

This is the definition of you’ll see more frequently; one then defines in terms of (rather than vice-versa) according to

(Remark for experts: is a field with a non-Arcihmedian valuation; then is its valuation ring.)

Let me justify why this definition is philosophically nice.

Suppose you are a numerical analyst and you want to estimate the value of the sum

to within . The sum consists entirely of rational numbers, so the problem statement would be fair game for ancient Greece. But it turns out that in order to get a good estimate, it *really helps* if you know about the real numbers: because then you can construct the infinite series , and deduce that , up to some small error term from the terms past , which can be bounded.

Of course, in order to have access to enough theory to prove that , you need to have the real numbers; it’s impossible to do serious analysis in the non-complete space , where e.g. the sequence , , , , \dots is considered “not convergent” because . Instead, all analysis is done in the completion of , namely .

Now suppose you are an olympiad contestant and want to estimate the sum

to within mod (i.e. to within in ). Even though is a rational number, it still helps to be able to do analysis with infinite sums, and then bound the error term (i.e. take mod ). But the space is not complete with respect to either, and thus it makes sense to work in the completion of with respect to . This is exactly .

## 4. Solving USA TST 2002/2

Let’s finally solve Example~1, which asks to compute

Armed with the generalized binomial theorem, this becomes straightforward.

Using the elementary facts that and , this solves the problem.

# New oly handout: Constructing Diagrams

I’ve added a new Euclidean geometry handout, Constructing Diagrams, to my webpage.

Some of the stuff covered in this handout:

- Advice for constructing the triangle centers (hint: circumcenter goes first)
- An example of how to rearrange the conditions of a problem and draw a diagram out-of-order
- Some mechanical suggestions such as dealing with phantom points
- Some examples of computer-generated figures

Enjoy.