Comfort Math
I struggled to find the right framing for this piece, but it came at last after I reflected on the conflation of two kinds of good: Intrinsic good and instrumental good. Some things are just good to do. No worse to repeat. A special fulfillment is found in practicing such things to fluency and there needn’t be anything more to it.
I want to convey that stepping through beloved mathematical proofs and performing one’s favorite algorithms or calculations are just such things. I also want to advocate for repeating and practicing familiar mathematics as a comfort activity. If you’re already with me, then I instead offer the catharsis of seeing the case made in full and an exposition of two of my personal favorite algorithms to perform, along with a discussion of what makes an algorithm fun to do.
If you’d like to skip right to the math then feel free to scroll past the section immediately below.
Comforts and Orthopraxy
There are more comforts in heaven and earth than are dreamt of in my philosophy. That is my way of telling you that I failed to create some exhaustive classification of comforts for this article. But I want at least this dyad: Comfort activities we do and comfort media we are audience to. In the former: Playing an instrument, knitting, gardening—hobbies. In the latter: Books, movies, video games—media. I think there is a little math in both. The former: Proofs, algorithms, calculations. The latter: Textbooks, edutainment, visualizations and integration bees. I will, over and over, fall short of exhaustive and so invite your contributions to any partial lists in this article.
I have long yearned for a word that means “right-doing” or “well-doing” or the satisfaction obtained from right-doing or witnessing another well-do. Such semantic hankerings gnaw like hunger-pangs. Some words come close: Mastery, virtue and orthopraxy (correct practice) occur to me immediately. After googling, I found a Greek word: Aretē (ἀρετή), which means something like the excellence of performing a purpose properly. The google chatbot gave me “autotelic” (itself as it’s own end); which is a little like first encountering the term “authentic” on instagram reels. Taken together, these paint vivid enough picture, but I can do one better in recalling a memory.
A few years ago I dropped by my favorite philosophy lecturer’s office. I was, at the time, thinking about what theories of normative ethics would not permit mistreating a philosophical zombie. I was then, as I am now, to my great shame, quite utilitarian-brained. He told me that there was a case to be made from Confucian ethics that, because ethical practice is autotelic, treating the philosophical zombie rightly was good to do; it is fulfilling to practice good behavior even when no harm would arise from not doing so. If I recall correctly, this was grounded by Yi/义/義. I do not truly understand Yi, but it seems to be sufficiently multi-faceted to capture anything that the previous paragraph missed; ensouling entire my long-suffered semantic hollow at last. I load it all into an overwritten sentence to take with us as we go on.
The satisfaction of performing a comfort activity or of enjoying comfort media comes as an easy room-temperature ripple of Yi and Aretē.
There is an intrinsic, self-evident satisfaction to engaging in these comforts whose description is barely captured by the words I have marshaled above. That said, I do believe some facets of the satisfaction in question admit explanation on the why-side. For one, when we engage in these comforts our expectations are met. We know how this thing goes; there are no nasty surprises. Consequently, we can safely enjoy the anticipation of our “favorite bits” and the assurance that we will meet them if we continue long enough. And if we don’t, or we can’t, this too is ok. There is no rush. There is nothing time-sensitive and nothing to miss out on. The piece of media remains there in full waiting for our return. If we do not complete the task, this is fine. Recall that we have done it many times, so the ego can walk away unwounded. We can take it slow. It is fine, perhaps even better—we enjoy it for longer. And if we do complete it, we get the added closure of completion, the simple pleasure of seeing it done.
To speak more of the ego, comfort activities are ego-healing. We are experiencing our own right-doing, our fluent doing of something correctly. This is chained to all such past experiences of our having done this well; positive and corrective in whole. Perhaps, though, the good practice of a comfort activity sometimes nears solipsistic, and thus can’t give us every good feeling. Such comforts can, of course, be done socially, which also yields the voyeuristic contentment of watching another do it well. But when alone, we can step out of ourselves and appreciate our own right-doing from above. All good nourishment for the healthy ego. This amounts to a safety taken and held: You have control here and now, nothing will go wrong, no harm could befall you.
Now the math.
Some Tangible Comfort Math
Below are presented two algorithms that I have at some time or another enjoyed performing. My original framing of this article was to be the lens of daily games like connections, minute cryptic or globle. The idea was to give you some fun, easy, repeatable activities for winding down or warming up at either end of the day. Now, I instead only hope that you find fulfillment in whatever you practice to fluency, be it my suggestions or anything else. After the expositions I will discuss what I think makes an algorithm fun to do, and apt for comfort math.
First up is polynomial long division over finite fields, and after that we have computing the chromatic polynomial of a graph. If you really must skip the math then scroll on until you reach the “Discussion” section.
A lot more on the way.
Polynomial Long Division over Finite Fields
This section assumes familiarity with long division and some mathematical maturity
In accordance with the daily-game naming convention of affixing thematic words with “-dle” I have dubbed this first game Longdle. I think of this algorithm as long division with decorations, I will be rug-sweeping the underlying elementary field theory.
In words, long division of polynomials follows this pattern:
- Determine which term, when multiplied by the leading term of the divisor, yields the leading term of the dividend. Write this term on top.
- Multiply this term by the divisor and subtract the result from the dividend.
- Set the new dividend as the result of this subtraction.
- Repeat 1-3 until out new dividend is 0 or a number which the divisor does not factor into.
Assuming the latex compiles for you, here is a worked example:
1.
2.
3.
4.
Nice and simple. Although, it might be too simple. Yes, it’s so simple that it will soon become boring. Do three of these and you’ll be cleaving through untold legions in seconds. You can make the numbers bigger or the polynomials higher degree, but then I say you’re just scaling the arithmetic of the exercise, and who wants to do arithmetic? So my suggestion is to add one more thing to track (just one little number), this should make it a stimulating but not overly onerous exercise.
For our purposes, we only really care about finite fields for their modular arithmetic. Here is a primer on modular arithmetic if you are unfamiliar. Functionally, to do the algorithm, you only need to remember that if we are, for example, in ℤ3[x], then 3 is 0. Every time we get to 3 we “reset the counter”, so to speak. 1+1=2 as usual, but 2+1=0, 2+2=1, etc.
Assuming that our chosen polynomial is reducible over a given field, we aim to reduce it by factoring. The algorithm for factoring polynomials over fields of finite characteristic is the same as we are already familiar with but with a few extra considerations.
This doesn’t always work so nicely because not every polynomial in a polynomial ring F[x] is reducible over the underlying field F. If I remember my intro to algebra course in undergrad correctly, the theorems to check for irreducibility were the “mod p test” and Eisenstein’s Irreducibility Criterion. So if you want to generate your own examples, you can use these to avoid irreducible polynomials. Conversely, your polynomial is reducible over F (in the case where it is degree 2 or 3) if and only if it has a root over F.
If you want to generate your own examples, I see that sagemath has the is_irreducible() method and it also allows you to pick out polynomials from a polynomial ring. I believe you can do P. = PolynomialRing(F) to set up a polynomial ring in variable x and then can use P.random_element() to pick out polynomials. If you pick out two, multiply them, and then have a script return the result (along with one of the multiplicands), your result will be reducible, so you can safely run the algorithm. I leave the script (or a better way of doing it) as an exercise in sagemath for you.
I find this one fun and easy. It has the potential to become boring and I’m not sure how to scale it to avoid this (comments and suggestions welcome). On to the second algorithm!
Calculating the Chromatic Polynomial of Small Graphs
This section assumes the reader is comfortable with basic set theoretic and function notation and perhaps a dash of mathematical maturity.
Our task is more visual than the last; polynomials only really enter at the end. This one I call Chromdle. To switch things up (and to save time latexing up my graphs) I have done pen-and-paper.
You probably have a sense of what a graph is. It looks like a network, large graphs at scale can look like webs or hairballs. Visually, a graph is something like this:
Formally, it’s a set of vertices and edge relations. For our purposes, I will use this definition: A graph consists of a nonempty vertex set V(G) an edge set E(G) and an incidence function fG which associates to each edge an unordered set of vertices; for instance fG(e1)={A, B }. Behold, a rather ugly block of notation summarizing the combinatorial data of the above graph.
A k-vertex coloring is an assignment of a set of colors to the set of vertices of a graph. Formally, it can be described by a function c, from V(G) to X where X is a set of k colors. Again, visually it is exactly as it sounds. Like this:
Important: What we will actually count are the proper k-colorings, which means that if two vertices are joined by an edge they must have distinct colors. For example, in the above graph, A could not be assigned the same color as D or B but could be assigned the same color as C. We denote by πk(G) the number of distinct (proper) k-colorings of a graph G. Two such colorings are distinct if we can find a vertex which they color differently, like so:
Note that swapping around the same number of colors occurring in the same number of instances but at different vertices makes for distinct colorings. Now to introduce two visual operations we can do to graphs: Edge deletion and edge contraction.
With these and the corresponding notation, we can understand a recursive formula:
It is easy to find proofs of this fact. Another fact is that πk(G) always takes the form of a polynomial in k. The algorithm I extol is just the repeated application of this formula. Below is an example of repeatedly deleting and contracting edges to find the chromatic polynomial of the triangle graph, aka the complete graph on three vertices, K3.
I like this algorithm because of the aesthetics of its pen-and-paper execution. It looks like you are performing some kind of spell. Like with Reidemeister moves, the steps can be done in a way that is (visually) radically different to solving algebraic equations (as in the previous algorithm), which, after going through the school system for years, are sapped of any wizardly quality they may have otherwise retained.
Because the algorithm is recursive and requires a growing case-tree, it can be tedious on larger graphs. Here is a math question: What graph-theoretic qualities should a graph have to ensure running this algorithm on it is interesting. Here is a related programming challenge: Write a script which finds graphs that are interesting with respect to running this algorithm.
Discussion: What makes an algorithm fun to do?
You may not find these algorithms fun to run. Even I have found examples to occasionally lean tedious. If I’m to be completely honest, I believe that personal taste and aesthetics have the most potent influence over one’s enjoyment of a particular algorithm. All the algorithms you enjoy most will probably present to you as conspicuously pretty.
While drafting this article, I messaged my good friend Ari. His aesthetics differ from mine, and I think he may have been a little disgusted by my choices. He describes himself as a “p-adic guy”. In this exchange, he also raised the critique that daily games like those I was originally framing this article around are fun because they are novel each day. Their enjoyment, like with math puzzles, is located exactly in the non-algorithmic approaches they demand. Fair enough. Just as well I reframed this article!
So, modulo aesthetics, what can we still say? I’ll throw my opinion out to start the discussion. If you’d rather contribute relatively unspoiled by my perspective then feel free to speak now.
Here I go, forgive me, I will play this out as a list:
What makes an algorithm fun to do:
- Not too novel or too challenging. Also not completely trivial. Tricky enough that you can farm aura in front of the knowers?
- Not error-prone. That is, there should be little opportunity for common irritants like sign errors, copy errors and arithmetic errors. This is why I dislike Gaussian elimination.
- Scales well “vertically” (we can increase the parameters, size, etc. without the task becoming too immediately tedious) or, even better, scales well “horizontally” (we can vary permutations, orderings, etc. while keeping the support fixed). I think the former is very rare and I would usually say that good algorithms have the latter so we needn’t scale them—a heuristic for this could be: Are there many small examples?
- Pocket-sized: Not too many steps and/or each step doesn’t take that long to complete.
- Has a pleasing “shape”. This one is harder to describe, and is admittedly aesthetics again. All the most pleasing algorithms in my summon seem to take one of these shapes: Combining small objects into a larger amalgam, unfurling a large object out, tidying something up (closely related: transmuting one object into another) or siphoning some data from an object. All of these are done to completion. In all cases the process is a kind of alchemy.
Before concluding, here are some other honorable mentions that could serve as comfort math to bookend a workday
- Elementary point-set topology exercises.
- Computing the homology groups of “small” and “nice” low-dimensional spaces.
- Truth tables.
I like the second entry because it is quite visual and also has some easy algebra. Although I chose to omit a full treatment in this article because I found it required either too much background or too much rug-sweeping than I was comfortable with—a job for ? Perhaps when I find a nice balance I will revisit this. The first entry is fun because the exercises are often straightforward deductions involving applying the definitions (and maybe one “trick”), making them easy and pleasing to prove and reprove. One day I’d like to write an article about revisiting the elementary content of theories one is familiar with and how this feels similar to watching a comfort show or replaying some level in a video game one knows well.
A final word about locating comfort in mathematics. Math is a sure and placid place. Nothing in the news will threaten the truth of your most beloved theorem. Every time you run your favorite algorithm, it still works. You can even open up the algorithm and see exactly why it always works. Naturally, not everything about the way math is thought of or expressed or done by humans is unchanging, but math still offers relatively stable refuge to ground oneself through the repetition of the intrinsically good.
My inclinations are to materialism, utilitarianism, reductionism, atheism, nihilism, pessimism and I choose to battle these demons every day.
I lack the expertise to appraise online resources purporting to explain Yi. I have also not yet read a paper or book on it, but would like to! Any recommendations? For now, here are four superficial links I leave in the hopes that at least one is good: One, two, three, four.
As I have said elsewhere, I don’t think there is a problem with just having an ego. And anyway, I believe the status games of society force our egos into existence. So we don’t really have a choice.
Some good feelings that are perhaps absent from my chosen class of comfort activities: The feeling of reassurance from another. Absent as I am mainly talking self-soothing. The contentment of “checking in” on something, like your virtual family in the sims or your garden out the back. Finally, the pleasure of recognition that comes from some domain-mastery. Identifying plants or paintings or styles of architecture. Experiencing subtleties excitedly in an unexpected encounter. A general profit of mastery not really talked about here.
If you are unfamiliar: A weird term that I take to mean that someone is comfortable with mathematical notation and arguments. Just a result of spending time with math.
The pattern seems to be that these are usually metonyms right? So we generally have “metonym”-dle.
I learned from course notes so I can’t vouch for any textbook, that said, the results mentioned in this article are ultimately covered in Chapter 17 of Gallian’s Contemporary Abstract Algebra and Chapter 9 of that that hefty tome Dummit and Foote’s Abstract Algebra. However, one also of course requires all of the dependent chapters from each of those books; such as the chapters on Ring Theory and of course even the chapters on “Preliminaries”. It is up to you to decide what you want to skip if you are keen to check out the more advanced chapters.
Scary notation perhaps if you are entirely unfamiliar! If that is you, just pay attention to the “3” and take the rest to be baroque decoration.
There are quite a few category theoretic ways of making this precise.
If you are unfamiliar: By “combinatorial data” I just mean the underlying sets and functions associated to the picture of our graph.
These do not have to be minimal. The smallest number of colors we can use for a proper coloring of a graph is called the chromatic number. Note also that often when someone writes k-colorings or even just colorings they actually mean proper k-colorings.
For instance Theorem 8.6 in Bondy and Murty. Proof sketch: Consider all possible ways to properly color two neighboring vertices. If we remove the edge between these two vertices we may now additionally assign them the same color. The total number of colorings where the neighbors have the same color is exactly the number of colorings where they are fused into one vertex of the same color.
Specifically a polynomial in variable k of degree |V(G)| with sign-alternating integer coefficients. See Corollary 8.6 of Bondy and Murty.
If you find my exposition and example lacking, Section 8.4 of Bondy and Murty is the place to go. However, please also let me know! I can easily fill in gaps, repair errors and otherwise fix the article immediately if brought to my attention.
This is how the word support is usually used in math. However, I was using it more metaphorically to mean the stuff that a mathematical object is made out of.
In my opinion: Truth tables are an unfurling and a data extraction, chromdle is too. Longdle is constructing an amalgam, computing homology groups can involve cutting up spaces and then siphoning each piece, Reidemeister moves are an unfurling.
A tragedy, a casualty of scope: I was going to call it Homdle.