MOHS hardness scale

There’s a new addition to my olympiad problems and solutions archive: I created an index of many past IMO/USAMO/USA TST(ST) problems by what my opinions on their difficulties are. You can grab the direct link to the file below:

https://evanchen.cc/upload/MOHS-hardness.pdf

In short, the scale runs from 0M to 50M in increments of 5M, and every USAMO / IMO problem on my archive now has a rating too.

My hope is that this can be useful in a couple ways. One is that I hope it’s a nice reference for students, so that they can better make choices about what practice problems would be most useful for them to work on. The other is that the hardness scale contains a very long discussion about how I judge the difficulty of problems. While this is my own personal opinion, obviously, I hope it might still be useful for coaches or at least interesting to read about.

As long as I’m here, I should express some concern that it’s possible this document does more harm than good, too. (I held off on posting this for a few months, but eventually decided to at least try it and see for myself, and just learn from it if it turns out to be a mistake.) I think there’s something special about solving your first IMO problem or USAMO problem or whatever and suddenly realizing that these problems are actually doable — I hope it would not be diminished by me rating the problem as 0M. Maybe more information isn’t always a good thing!

Understanding with System 1

Math must be presented for System 1 to absorb and only incidentally for System 2 to verify.

I finally have a sort-of formalizable guideline for teaching and writing math, and what it means to “understand” math. I’ve been unconsciously following this for years and only now managed to write down explicitly what it is that I’ve been doing.

(This post is written from a math-centric perspective, because that’s the domain where my concrete object-level examples from. But I suspect much of it applies to communicating hard ideas in general.)

S1 and S2

The quote above refers to the System 1 and System 2 framework from Thinking, Fast and Slow. Roughly it divides the brain’s thoughts into two categories:

  • S1 is the part of the brain characterized by fast, intuitive, automatic, instinctive, emotional responses, For example, when you read the text “2+2=?”, S1 tells you (without any effort) that this equals 4.
  • S2 is the part of the brain characterized by slow, deliberative, effortful, logical responses; for example, S2 is used to count the number of words in this sentence.

(The link above gives some more examples.)

The premise of this post is that understanding math well is largely about having the concept resonate with your S1, rather than your S2. For example, let’s take groups from abstract algebra. Then I claim that

G = \{ a/b \mid a,b \text{ odd integers} \}

is a group under the usual multiplication. Now, if you have a student who’s learning group theory for the first time, the only way they could see this is a group is to compare it against a list of the group axioms, and have their S2 verify them one by one. But experienced people don’t do this: their S1 automatically tells them that G “feels” like a group (because e.g. it’s closed and doesn’t have division-by-zero issues).

I think this S1-level understanding is what it means to “get it”. Verifying a solution to a hard olympiad problem by having S2 check each individual step is straightforward in principle, albeit time-consuming. The tricky part is to get this solution to resonate with S1. Hence my advice to never read a solution line by line.

Writing for S1

What this means is that if you’re trying to teach someone an idea, then you should be focusing on trying to get their S1 to grasp it, rather than just their S2. For example, in math it’s not enough to just give a sequence of logical steps which implies the result: give it life.

Here are some examples of ways I (try to) do this.

First, giving good concrete examples. S1 reacts well when it “sees” a concrete object like G above, and can see some intuitive properties about it right away. Abstract “symbol-pushing” is usually left to S2 instead.

Similarly, drawing pictures, so your S1 can actually see the object. On one extreme end, you can write something like “a point $S$ lies on the polar of $T$ if and only if $T$ lies on the polar of $S$”, but it’s much better to just have a picture:

You can even do this for things that aren’t really geometrical in nature. For example, my Napkin features the following picture of cardinal collapse when forcing.

Third, write like you talk, and share your feelings. S1 is emotional. S1 wants to know that compactness is a good property for a space to have, or that non-Noetherian rings are way too big and “only weirdos care about non-Noetherian rings” (just kidding!), or that ramified primes are the “finitely many edge cases” and aren’t worth worrying about. These S1 reactions you get are the things you want to pass on. In particular, avoid standard formal college-textbook-bleed-your-eyes-dry-in-boredom style. (To be fair, not all textbooks do this; this is one reason why I like Pugh’s book so much, for example.)

Even the mechanics on the page can be made to accommodate S1 in this way. S1 can’t read a wall of text; S2 has to put in effort to do that. But S1 can pick out section headers, or bolded phrases like this one, and so on and so forth. That’s why in Napkin all the examples are in separate red boxes and all the big theorems are in blue boxes, and important philosophical points are typeset in bold centered green text. This way S1 naturally puts its attention there.

But do not force it

On the flip side, if you’re trying to learn something, there’s a common failure mode where you try to keep forcing S2 to do something unnatural (rather than trying to have S1 figure it out). This is the kind of thing when you don’t understand what the Chinese Remainder Theorem is trying to say, so you try to fix this by repeatedly reading the proof line by line, and still not really understanding what is going on. Usually this ends up in S2 getting tired and not actually reading the proof after the third or fourth iteration.

(For the Chinese remainder theorem the right thing to do is ask yourself why any arithmetic progression with common difference 7 must contain multiples of 3: credits to Dominic Yeo again for that. I’m not actually sure what you’re supposed to do when stuck on math in general. Usually I just ask my friends what is going on, or give up for now and come back later.)

Actually, I really like the advice that SSC mentions: “develop instincts, then use them”.

MOP should do a better job of supporting its students in not-June

Up to now I always felt a little saddened when I see people drop out of the IMO or EGMO team selection. But actually, really I should be asking myself what I (as a coach) could do better to make sure the students know we value their effort, even if they ultimately don’t make the team.

Because we sure do an awful job of being supportive of the students, or, well, really doing anything at all. There’s no practice material, no encouragement, or actually no form of contact whatsoever. Just three unreasonably hard problems each month, followed by a score report about a week later, starting in December and dragging in to April.

One of a teacher’s important jobs is to encourage their students. And even though we get the best students in the USA, probably we shouldn’t skip that step entirely, especially given the level of competition we put the students through.

So, what should we do about it? Suggestions welcome.

An opening speech for MOP

While making preparations for this year’s MOP, I imagined to myself what I would say on orientation night if I was director of the camp, and came up with the following speech. I thought it might be nice to share on this blog. Of course, it represents my own views, not the actual views of MOP or MAA. And since I am not actually director of MOP, the speech was never given.

People sometimes ask me, why do we have international students at MOP? Doesn’t that mean we’re training teams from other countries? So I want to make this clear now: the purpose of MOP is not to train and select future IMO teams.

I know it might seem that way, because we invite by score and grade. But I really think the purpose of MOP is to give each one of you the experience of working hard and meeting new people, among other things. Learn math, face challenges, make friends, the usual good stuff, right? And that’s something you can get no matter what your final rank is, or whether you make IMO or EGMO or even next year’s MOP. The MOP community is an extended family, and you are all part of it now.

What I mean to say is, the camp is designed with all 80 of you in mind. It made me sad back in 2012 when one of my friends realized he had little chance of making it back next year, and told me that MAA shouldn’t have invited him to begin with. Even if I can only take six students to the IMO each year, I never forget the other 74 of you are part of MOP too.

This means one important thing: everyone who puts in their best shot deserves to be here. (And unfortunately this also means there are many other people who deserve to be here tonight too, and are not. Maybe they solved one or two fewer problems than you did; or maybe they even solved the same number of problems, but they are in 11th grade and you are in 10th grade.)

Therefore, I hope to see all of you put in your best effort. And I should say this is not easy to do, because MOP is brutal in many ways. The classes are mandatory, we have a 4.5-hour test every two days, and you will be constantly graded. You will likely miss problems that others claim are easy. You might find out you know less than you thought you did, and this can be discouraging. Especially in the last week, when we run the TSTST, many of you will suddenly realize just how strong Team USA is.

So I want to tell you now, stay determined in the face of adversity. This struggle is your own, and we promise it’s worth it, no matter the outcome. We are rooting for you, and your friends sitting around you are too. (And if the people around you aren’t your friends yet, change that asap.)

Hard and soft techniques

In yet another contest-based post, I want to distinguish between two types of thinking: things that could help you solve a problem, and things that could help you understand the problem better. Then I’ll talk a little about how you can use the latter. (I’ve talked about this in my own classes for a while by now, but only recently realized I’ve never gotten the whole thing in writing. So here goes.)

1. More silly terminology

As usual, to make these things easier to talk about, I’m going to introduce some words to describe these two. Taking a page from martial arts, I’m going to run with hard and soft techniques.

A hard technique is something you try in the hopes it will prove something — ideally, solve the problem, but at least give you some intermediate lemma. Perhaps a better definition is “things that will end up in the actual proof”. Examples include:

  • Angle chasing in geometry, or proving quadrilaterals are cyclic.
  • Throwing complex numbers at a geometry problem.
  • Plugging in some values into a functional equation (which gives more equations to work with).
  • Taking a given Diophantine equation modulo {p} to get some information, or taking {p}-adic evaluations.
  • Trying to perform an induction, for example by deleting an element.
  • Trying to write down an inequality that when summed cyclically gives the desired conclusion.
  • Reducing the problem to one or more equivalent claims.

and so on. I’m sure you can come up with more examples.

In contrast, a soft technique is something you might try to help you understand the problem better — even if it might not prove anything. Perhaps a better definition is “things not written up”. Examples include:

  • Examining particular small cases of the problem.
  • Looking at the equality cases of a min/max problem.
  • Considering variants of the problem (for example, adding or deleting conditions).
  • Coming up with lots of concrete examples and playing with them.
  • Trying to come with a counterexample to the problem’s assertion and seeing what the obstructions are.
  • Drawing pictures, even on non-geometry problems (see JMO2 and JMO5 in my 2019 notes for example).
  • Deciding whether or not a geometry problem is “purely projective”.
  • Counting the algebraic degrees of freedom in a geometry problem.
  • Checking all the linear/polynomial solutions to a functional equation, in order to get a guess what the answer might be.
  • Blindly trying to guess solutions to an algebraic equation.
  • Making up an artificial unnatural function in a functional equation, and then trying to see why it doesn’t work (or occasionally being surprised that it does work).
  • Thinking about why a certain hard technique you tried failed, or even better convincing yourself it cannot work (for example, this Diophantine equation has a solution modulo every prime, so stop trying to one-shot by mods).
  • Giving a heuristic argument that some claim should be true or false (“probably {2^n \bmod n} is odd infinitely often”), or even easy/hard to prove.

and so on. There is some grey area between these two, some of the examples above might be argued to be in the other category (especially in context of specific problems), but hopefully this gives you a sense of what I’m talking about.

If you look at things I wrote back when I was in high school, you’ll see this referred to as “attacking” and “scouting” instead. This is too silly for me now even by my standards, but back then it was because I played a lot of StarCraft: Brood War (I’ve since switched to StarCraft II). The analogy there is pretty self-explanatory: knowing what your opponent is doing is important because your army composition and gameplay decisions should change in reaction to more information.

2. Using soft techniques: an example

Now after all that blabber, here’s the action item for you all: you should try soft techniques when stuck.

When you first start doing a problem, you will often have some good ideas for what to try. (For example: a wild geometry appeared, let’s scout for cyclic quadrilaterals.) Sometimes if you are lucky enough (especially if the problem is easier) this will be enough to topple the problem, and you can move on. But more often what happens is that eventually you run out of steam, and the problem is still standing. When that happens, my advice is to try doing some soft techniques if you haven’t already done so.

Here’s an example that I like to give.

Example 1 (USA TST 2009)

Find all real numbers {x}, {y}, {z} which satisfy

\displaystyle  \begin{aligned} x^3 &= 3x - 12y + 50,\\ y^3 &= 12y + 3z - 2,\\ z^3 &= 27z + 27x. \end{aligned}

A common first thing that people will try to do is add the first two equations, since that will cause the {12y} terms to cancel. This gives a factor of {x+y} in the left and an {x+z} in the right, so then maybe you try to submit that into the {27(x+z)} in the last equation, so you get {z^3 = 9(x^3+y^3-48)}, cool, there’s no more linear terms. Then. . .

Usually this doesn’t end well. You add this and subtract that and in the end all you see is equation after equation, and after a while you realize you’re not getting anywhere.

So we’re stuck now. What to do? I’ll now bring in two of the soft techniques I mentioned earlier:

  1. Let’s imagine the problem had {\mathbb R} replaced with {\mathbb C}. In this new problem, you can imagine solving for {y} in terms of {x} using the first equation, then {z} in terms of {y}, and then finally putting everything into the last equation to find a degree {27} polynomial in {x}. I say “imagine” because wow would that be ugly.

    But here’s the kicker: it’s a polynomial. It should have exactly {27} complex roots, with multiplicity. That’s a lot. Really?

    So here’s a hint you might take: there’s a good reason this is over {\mathbb R} but not {\mathbb C}. Often these kind of things end up being because there’s an inequality going on somewhere, so there will only be a few real solutions even though there might be tons of complex ones.

  2. Okay, but there’s an even more blatant thing we don’t know yet: what is the answer, anyways?

    This was more than a little bit embarrassing. We’re half an hour in to the problem and thoroughly stuck, and we don’t even have a single {(x,y,z)} that works? Maybe it’d be a good idea to fix that, like, right now. In the simplest way possible: guess and check.

    It’s much easier than it sounds, since if you pick a value of {z}, say, then you get {x} from the third equation, {y} from the first, then check whether it fits the second. If we restrict our search to integer values of {z}, then there aren’t so many that are reasonable.

I won’t spoil what the answer {(x,y,z)} is, other than saying there is an integer triple and it’s not hard to find it as I described. Once you have these two meta-considerations, you suddenly have a much better foothold, and it’s not too hard to solve the problem from here (for a USA TST problem anyways).

I pick this example because it really illustrates how hopeless repeatedly using hard techniques can be if you miss the right foothold (and also because in this problem it’s unusually tempting to just think that more manipulation is enough). It’s not impossible to solve the problem without first realizing what the answer is, but it is certainly way more difficult.

3. Improving at soft techniques

What this also means is that, in the after-math of a problem (when you’ve solved/given up on a problem and are reading and reflecting on the solution), you should also add soft techniques into the list of possible answers to “how might I have thought of that?”. An example of this is at the end of my earlier post On Reading Solutions, in which I describe how you can come up with solutions to two Putnam problems by thinking carefully about what should be the equality case.

Doing this is harder than it sounds, because the soft techniques are the ones that by definition won’t appear in most written solutions, and many people don’t explicitly even recognize them. But soft techniques are the things that tell you which hard techniques to use, which is why they’re so valuable to learn well.

In writing this post, I’m hoping to make the math contest world more aware that these sorts of non-formalizable ideas are things that can (and should) be acknowledged and discussed, the same way that the hard techniques are. In particular, just as there are a plethora of handouts on every hard technique in the olympiad literature, it should also be possible to design handouts aimed at practicing one or more particular soft techniques.

At MOP every year, I’m starting to see more and more classes to this effect (alongside the usual mix of classes called “inversion” or “graph theory” or “induction” or whatnot). I would love to see more! End speech.

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:

:: 軟體庫 extra

1) mariadb

:: 軟體庫 community

2) 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.