A magazine about programmers, code, and society. Written by humans since 2018.

In Praise Of Mathematics

How much math knowledge does a programmer need to know to fulfill their job? How deep should the mathematical knowledge of full-stack engineers, computer security experts, or large language model engineers be? The spectrum of possible answers to these questions is too large to be useful. Perhaps the eternal answer “it depends” is enough?

The original conundrum in the previous paragraph is related to the fact that the word “programmers” points, at the time of this writing, to quite an eclectic group of human beings. There are many different programmers in 2023, and spoiler alert, they do not all require the same levels of knowledge of mathematics. Fifty years ago, however, the word “programmers” used to refer to a much more coherent and uniform set of skills.

Precisely, let us travel back in time to 1973. By that time, the first volume of the defining work of our craft, “The Art of Computer Programming” had been available in bookstores since 1968, and its first chapter literally consisted (consists) of a 100-something page long introduction to various mathematical concepts. Induction, logarithms, series, matrices, elementary number theory, permutations and factorials, Fibonacci numbers, are some of the subjects exposed in those beautifully typeset pages. Not only are the concepts introduced, but they are also accompanied by their respective exercises. For Donald Knuth, the answer to the opening question of this article is a resounding “yes;” you do need to know about Stirling’s approximation to understand what will come after. Even though we are still waiting for the final volumes of Dr. Knuth’s work, we are certain that math will be a required skill to understand them.

Such a treatment was not new back then. The first volume of Richard Feynman’s legendary “Lectures on Physics,” dedicated to “mainly mechanics, radiation, and heat” is sparsely populated with chapters dedicated entirely to purely mathematical subjects: in particular probabilities, vectors, and algebra. The second volume, about “mainly electromagnetism and matter” has chapters about vector differentials, vector integral calculus, and tensors; fundamental concepts to, at least, understand the notation used to represent Maxwell’s four equations of electromagnetism. Maybe the inclusion of those chapters is one of the key reasons for the timeless success of Dr. Feynman’s work.

Some more recent authors share this point of view. Christopher Bishop‘s groundbreaking 2006 book “Pattern Recognition and Machine Learning,” arguably one of the triggers of the current popularity of machine learning, is quite literally a book about applied mathematics, diving into probabilities, linear algebra, inference, neural networks, sampling, Markov models, and combinatorics. And quite rightfully so; if your objective is to find a job as an engineer at OpenAI, knowing a thing or two about eigenvalues and eigenvectors is definitely going to be useful.

A different pattern appears in the outstanding “Structure and Interpretation of Computer Programs” by Abelson and Sussman, where the use of a functional language like Scheme ties the book to a closer relationship with mathematics. This is easily seen in the structure of this work: there are no chapters dedicated to the subject of mathematics per se, but mathematical subjects are used all over the place as a mechanism to teach computation: functions and lambda calculus of course, differential calculus, polynomials, Monte Carlo simulations, numerical methods, and various algebras.

Let us look at the problem from the other side: what do mathematicians say about Computer Science? A lot, as it turns out; take for example the massive “Princeton Companion to Mathematics” edited by Timothy Gowers, June Barrow-Green, and Imre Leader. On page 106 we can find a dissertation about algorithms by Jean-Luc Chabert; on page 575, another about computational complexity by Oded Goldreich and Avi Wigderson. Finally, an article about computational number theory by Carl Pomerance on page 348. Not to forget the insolubility of the halting problem on page 706, and the short biographies of Kurt Gödel on page 819 and Alan Turing on page 821.

Not all authors give the same importance to math in programming. Some pragmatic books about the subject, such as Steve McConnell‘s “Code Complete” or Tymann & Reynold’s “Schaum’s Outline of Principles of Computer Science” have no reference nor explanation of math subjects in them whatsoever. The same is true of many graduate-level textbooks used daily in universities worldwide.

What is, then, the proper level of math required to lead a decent career as a programmer these days? Setting aside for a moment the upcoming maelstrom of AI-powered tools such as GitHub Copilot X, this author thinks that a high-school level of arithmetic, plane geometry (useful for writing games), linear algebra (in particular vectors, and matrices), classic two-variable calculus (functions, duh!), set theory (useful for object-oriented programming), and floating-point arithmetic (always useful), are the bare minimum things one needs to know when writing code for a living. Depending on their specialization, of course, programmers will have to master various other skills, ranging from finance, to numerical recipes, to number theory, to type theory, to even maybe quantum physics; nothing that smart people cannot learn, if not at university, through self-study.

Weaponizing Math

But there is a more profound issue at hand, however. Mathematics is today the subject used by universities to “filter the chaff” out of the thousands of applicants to various degrees ranging from humanities to science. This author remembers the dramatically reduced number of students in his second year of economics studies in Buenos Aires, after the killer subjects of Analysis 1 and Algebra 1 had performed their sacrifice rituals. Using Mathematics in this way is a rather unfortunate fact of our world, and in the opinion of this author, one of the root causes of the impossible dialogue between management and engineering.

Math has been weaponized into a discrimination tool, and the resentment caused into hordes of unsuspecting victims is felt by technicians in many different fields, including programming. This is, simply put, a tragedy.

We have reached a tipping point as a species, where the teaching of mathematics must change dramatically to provide humans with the tools required to survive and protect our planet at the same time. We cannot afford to continue laughing at scientists just because we hated math back in high school. Such a behavior constitutes in itself an extinction-level mechanism.

But how can we teach math differently? According to Bill Gates, fond of throwing technology at problems, we should use artificial intelligence for that.

In the United States, the best opportunity for reducing inequity is to improve education, particularly making sure that students succeed at math. The evidence shows that having basic math skills sets students up for success, no matter what career they choose. But achievement in math is going down across the country, especially for Black, Latino, and low-income students. AI can help turn that trend around.

The thing is, right now, ChatGPT happily asserts that π == 4 with a straight face, so this whole “AI solution” does not sound like the best idea at this point in time, Mr. Gates.

Think Different

Let us evaluate two different options to solve the issue of teaching math: one based on philosophy, and the other based on history. Regular readers of this magazine should not be surprised in learning that this magazine is fond of throwing humanities and science at problems, instead of mere technology.

The first approach has been described in a short but influential volume published at Flammarion in 2015, called “Éloge des Mathématiques” by French philosopher and mathematician Alain Badiou, whose title inspired this article. In this book, Badiou, also author of “L’Être et l’Événement,” proposes a return to the roots, and to a pedagogy linking mathematics and philosophy more closely.

On a ainsi d’un côté une mathématique inventive et créatrice, confinée dans un monde intellectuel extrêmement dense et international mais fortement aristocratique, et de l’autre côté une sorte de diffusion scolaire et universitaire des mathématiques, dont à mon avis l’usage est de plus en plus obscur ou incertain. (…) Les mathématiques devraient absolument être considérées, non pas simplement comme une discipline scolaire chargée de sélectionner ceux qui vont être ingénieur ou ministre, mais comme quelque chose qui possède un intérêt extraordinaire en soi-même.

For those not speaking French and too lazy to use Deepl to translate the text above, the idea consists of bringing back a sense of wonder around mathematics. Maybe by having more mathemagicians in classrooms. Maybe by taking a few storytelling cues from Kurzgesagt. And yes, philosophy has a massive place in that equation (pun intended.)

Mathematicians and philosophers often came together, as shown by the examples of Russell, Poincaré, Dedekind, Descartes, Leibniz, Spinoza, Πυθαγόρας, Penrose, Gödel, Cantor, and countless others. Mathematicians can also be excellent writers of fiction or popularization works, like the following South American figures: Júlio César de Mello e Souza (also known as Malba Tahan), Adrián Paenza, and Guillermo Martínez.

The second approach consists of a historical perspective on mathematics, one that this author has already described previously in this magazine. Instead of teaching mathematics as a dull sequence of subjects, one after the other, why not tell the story of those who created it?

Regarding the latter, I still have the book written by my Analysis teachers, Ernst Hairer and Gerhard Wanner. They taught us analysis following history, from the Renaissance to the 19th century. A fantastic idea, even though I had to pass the exams three times until I passed. It was hard (oh yes) but very, very enjoyable.

Beyond Math

Bertrand Russell, co-author of the Principia Mathematica that would ultimately trigger Gödel to formulate his incompleteness theorems, has a lot to teach to future generations beyond formulas:

In this world, which is getting more and more closely interconnected, we have to learn to tolerate each other. We have to learn to put up with the fact, that some people say things that we don’t like. We can only live together in that way. And if we are to live together and not to die together, we must learn a kind of charity and a kind of tolerance, which is absolutely vital to the continuation of human life on this planet.

Mathematics is the primary tool we use, not only to build software, but to build every single thing that constitutes our modern world. Raising it to a level where it coexists with history, art, or ethics, will undoubtedly horrify the insufferable pragmatists populating our capitalist world, continuously conflating usefulness or applicability with importance.

So be it. Education should be far more than preparing employees to be crunched by a machine. It should raise our perspectives and make us dream of a better place for all; not just for a small minority of vocal billionaires. Or at least, a better kind of mathematical education should avoid future generations the dreadful feeling of yet another mandatory, dull, dry, early Monday-morning math class.

Cover picture by Bing Image Creator; prompt: “In Praise Of Mathematics Style Klimt”

Continue reading "Nemean" or go back to Issue 055: Mathematics. Did you like this article? Consider subscribing to our newsletter or contributing to the sustainability of this magazine. Thanks!
Back to top