# Why do mathematicians use single-letter variables?

I have much more experience programming than I do with advanced mathematics, so perhaps this is just a comfort thing with me, but I often get frustrated trying to follow mathematical notation. Specifically, I get frustrated trying to keep track of what each variable signifies.

As a programmer, this would be completely unacceptable no matter how many comments you added explaining it:

float A(float P, float r, float n, float t) {
return P * pow(1 + r / n, n * t);
}


Yet a mathematician would have no problem with this:

$A = P\ \left(1+\dfrac{r}{n}\right)^{nt}$

where
$A$ = final amount
$P$ = principal amount (initial investment)
$r$ = annual nominal interest rate (as a decimal)
$n$ = number of times the interest is compounded per year
$t$ = number of years

So why don't I ever see the following?

$\text{final_amount} = \text{principal}\; \left(1+\dfrac{\text{interest_rate}}{\text{periods_per_yr}}\right)^{\text{periods_per_yr}\cdot\text{years}}$

-
Would you imagine writing, say, a long exact cohomology sequence not using a super-concise notation?! –  Andrea Mori Feb 28 '11 at 15:45
Because it's long, it makes it hard to see patterns, and it makes you think about interpretation when you should be thinking about form. –  Alexei Averchenko Feb 28 '11 at 15:47
When I first took economics, it took me a bit of time to psychologically get over the fact that GDP, for example, stood for one quantity, not a product a three quantities. –  JavaMan Feb 28 '11 at 16:01
Also, it also depends on what kind of programmer you are. APL programmers would beg to differ. (I personally think APL code is grotesque and unreadable, but for some reason, APL is still very popular among some financial types). –  Gilead Feb 28 '11 at 16:09
Multi-char vars can be very useful in some situations: e.g. in physical/chemical process modeling, the number of distinct variables can run into the hundreds/thousands easily. Single char variables just don't cut it in such situations -- people just end up using all kinds of multi-char subscripts/superscripts on single-char variables for disambiguation, and it ends up being messier than if they had just used multi-char variables to begin with. When the function of variable names is purely descriptive (rather than for revealing patterns), I believe a case can be made for multi-char vars). –  Gilead Feb 28 '11 at 16:24

I think one reason is that often one does not want to remember what the variable names really represent.

As an example, when we choose to talk about the matrix $(a_{ij})$ instead of the matrix $(\mathrm{TransitionProbability}_{ij})$, this expresses the important fact that once we have formulated our problem in terms of matrices, it is perfectly safe to forget where the problem came from originally -- in fact, remembering what the matrix "really" describes might only be unnecessary psychological baggage that prevents us from applying all linear-algebraic tools at our disposal.

(As an aside, have you ever seen code written by a mathematician? It very often looks exactly like your first example.)

-
+1 for the first line. Sometimes variables are just variables. They might not "mean" anything. –  Jesse Madnick Mar 1 '11 at 12:07

NB1: The history is told in Florian Cajori's book on the history of notation. In very old times, there were no variables (and no formulas, really) and everything was incredibly verbose. Cajori's book beautifully shows the very long and tortuous way from that to modern day notation for variables; there are several sections regarding the notation of unknowns and of their powers.

NB2: Additionally, we usually deal with very complicated expressions, so using verbose names for variables you render things almost impossible. Writing down the formula for Gaussian curvature in terms of $E$, $F$, $G$ and the Christoffel symbols if we wrote $\mathsf{Christoffel}^i_{jk}$ instead of $\Gamma^{i}_{jk}$ would turn differential geometry into a dead subject very soon :P

-
There must be some historical reason. Descartes in La Geometrie already uses this convention, although he uses (say) $xxx$ for $x^3$. –  Yuval Filmus Feb 28 '11 at 15:18
@Yuval: For Descartes in La Geometrie, I doubt there are any names that are significantly more apt for an abstract variable than $x$. (There's also the apocryphal story that $x$ was chosen because in French that letter is not used too much so the printer has enough for setting the page.) –  Willie Wong Feb 28 '11 at 15:28
+1 for the first line. Made me laugh. –  Eric Naslund Feb 28 '11 at 16:46
+1 for the first line, programmers are lazy too, but we're very used to cut/paste or abbreviation expansion/completion systems, and we tend to think that a long variable name carries no overhead. We also use abstraction a lot and ignore the fact that many functions we use conceal complex expressions. –  Slomojo Jun 16 '11 at 15:21
+1 for the Differential Geometry joke. –  Erno Nemecsek Jan 13 '12 at 10:37
show 1 more comment

Perhaps the most compelling reason for using single character variables is that it enables the usual convention of omitting the multiplication sign in products. This enables great conciseness in notating polynomials - which is important since polynomials are ubiquitous in mathematics, so any convention that simplifies their notation, comprehension, etc is surely worthwhile. Thus we can write $\rm\ xyz\$ to mean $\rm\ x\cdot y\cdot z\$ without any worry that it will be mistaken for a variable name.

While having to insert the multiplication signs doesn't reduce conciseness much for a monomial, it can greatly increase complexity for a polynomial of many terms. For it may cause equations to overflow the line/page length, etc, greatly hindering comprehension. Moreover, as many cognitive studies show, humans read read words by their shape (e.g. cover up the top/bottom half of a line of text and note how you can still easily read it), so any convention that alters shapes (or increases their visual complexity) may inhibit visual parsing, pattern-matching, and global inference of key structural characteristics.

-
I agree, although using the cdot notation (as you have done) for multi-char variable names does not appreciable reduce conciseness. I've had to write programs to generate LaTeX code for multi-char equations written by process modeling folks, and cdot was a very good compromise. –  Gilead Feb 28 '11 at 16:17
@Gil: I expanded my answer to address this. –  Bill Dubuque Feb 28 '11 at 16:38
thanks. I agree with what you said. –  Gilead Feb 28 '11 at 16:48
Indeed. And on top of this, most polynomials use the same variable multiple times, and repeating a name of more than a few characters would be seen as clutter. –  Stewart Mar 1 '11 at 11:07
@Marc I presumed that would be obvious, since it holds true for any language (vs. only mathematics). But perhaps it does deserve explicit mention. –  Bill Dubuque Nov 30 '11 at 15:02

My linear algebra professor (J. Komlos) said something that has always stuck with me: we should always use the same letters to denote certain variables, and different letters for different (math) subjects. In this way, our brains are able to build mental pathways so that when we see certain letters we can remember lots of other things we know about that subject because we associate those letters with certain facts, theorems, etc.

I actually think it's mostly a cultural phenomenon, comp-sci people like to use acronyms in part because it's more clear to program with an acronym than a single letter. But similarly, chemists like to use Latin words, physicists make up descriptive names for things, and mathematicians make up new words no one has ever heard of before.

-
+1 for "mathematicians make up new words no one has ever heard before." –  Grumpy Parsnip Feb 28 '11 at 15:35
Really? In my experience, mathematicians typically appropriate existing words and give them strange new meanings. –  Qiaochu Yuan Feb 28 '11 at 15:38
It's fun to ask people to differentiate $e^x$ with respect to $e$, just because we're so used to viewing $e$ as a certain constant and not as a variable. :) –  Hans Lundmark Feb 28 '11 at 15:39
@Hans, I confess, that exercise managed to confuse me. I had to rewrite it as $z^{x}$ because whenever I see "$\log{e}$", I am programmed to interpret it as "1". –  Gilead Feb 28 '11 at 16:03
@muntoo: Well, I suspected you were joking, but it's hard to tell sometimes. I've seen even stupider questions on this site. ;) –  Hans Lundmark Mar 1 '11 at 20:20

A few thoughts:

• It is not true that one does not see formulae as you wrote in the very last line, something like $$\mathrm{velocity} = \frac{\mathrm{displacement}}{\mathrm{time}}$$ In fact, I was taught algebra that way: start with word problems and write down mathematical expressions with words and labels, instead of numbers. I believe this kind of notation is also often used in textbooks.
• Like Mariano and Templar said in their answers, one of the main advantage of the short single letter notation is ease of copying. For computations it is much easier to write (by hand) single letters than whole strings.
• Another issue similar to the above is that it is easier to visually recognize identical terms when you use single letters. Take the expression for the "final amount" you wrote down. I happen to think that using the string "periods_per_yr" makes it harder to notice that the same term appear both in the denominator inside the brackets and in the exponent outside. Algebraically it is perhaps easier to keep track of structures using single letters.
• Also, what about when performing abstract arguments where the variables do not refer to anything specific and concrete? Is the phrase "take three points in the plane, point_one, point_two, and point_three..." more easily to understand than "take three points $P,Q,R$ in the plane..."?
• Lastly, in my PhD dissertation I have several computations involving expressions that span close to half a page when printed. I shudder to think what would happen if I use verbose names for all the terms: is it worth it to make individual variables more "legible" at the expense of making each equation span 3 pages? Does that actually improve overall legibility?
-
+1 for the first one. Now that I think about it it's very good actually to use word notations for shorter formulas. And Letter notations for more larger complicated formulas. –  ColacX Jan 26 '13 at 15:59

I can't imagine writing full words when solving equation and rewriting it 10 times, when programming you usually don't write it so much, you can use functions, classes, copy/paste, programs which automatically insert variables etc.

-
+1, you forgot to mention autocomplete in most modern IDEs/editors. –  MAK Mar 1 '11 at 10:31
@Mak, Abstraction to function names was in use long before we had autocomplete (well, maybe not that long, see Vim / Emacs abbreviation expansion systems etc.) –  Slomojo Jun 16 '11 at 15:24

A number of excellent explanations have been given, ranging from laziness of mathematicians to convention. I'd like to add one more that may be slightly more debatable than others.

I dare to say I experience some sort of freedom when assigning variable names. This freedom is very typical to math: ideas are not bound by physical reality, the only constraints are your own imagination and the consistency of your thoughts. This freedom suffers if you're thinking about your math too concretely.

Here are a few remarks to explain my point of view:

1. Somewhere in the 15th century ($\pm$ a few centuries) people realised they didn't have to discribe their equations in words, they could just assign letters to their quantities and let the formulae speak for themselves. Suddenly people realised it was not necessary for algebraic equations to have a direct geometric meaning. If people had kept writing $\rm area = length\cdot width$ until the end of days, this might never have happened.
2. Let's say we were thinking about distance. We might write $$\rm distance = \sqrt{horizontal\ displacement^2 + vertical\ displacement^2}.$$ However, would you ever dare to write $\rm distance = |horizontal\ displacement| + |vertical\ displacement|$? Maybe you would, but write this on the blackboard of an average high-school physics teacher (no offence meant) and they might try to hit you with something. This is because they're thinking about the physical reality, not about the abstract properties of such a formula or it's consequences in a more abstract setting. Therefore if you ever want to define the concept of a metric space and study it's properties in full generality, it's probably safer to denote distance simply by "d". (Choosing 'd' as a small mnemonic to where it all started.)
3. Let's say we're thinking about a curve this time. At some point you may come to realise there's actually an interesting group structure on your curve. If you're refering to your curve simply as "curve" everywhere, it's probably a giant leap to suddenly rebaptize your curve into "curve that is actually a group as well". You'll probably still call your curve "curve" all the time and you may unconsciously make it harder for yourself to realise the importance and usefullness of it's group structure.

In conclusion: math is an abstract science, assigning the name all to concrete names to objects will constrain your imagination, which is always a bad thing in math.

-

You're sort of comparing apples and oranges.

Mathematical papers are written in verbose, descriptive language (e.g. English); equations and such are introduced to introduce precision and brevity when needed.

A computer program, however, is written in a very precise language. The role of some coding style guidelines (e.g. long identifier names) are to introduce the verbose, descriptive language where needed.

Also, mathematics is "executed" -- humans have to manipulate them.

Computer programs, however are almost never executed. Even in an interpreted language, your program will get tokenized and parsed, and the interpreter will operate on the result.

-
What do you mean by mathematics is executed but programs are not? When you run a program, isn't the computer executing it? –  timur Nov 30 '11 at 16:14
I'm digging one step into the abstraction layer. In most cases, the first thing that happens is the text document that contains your source code is analyzed and converted into some other sorts of objects. This process includes things like the spiritual equivalent of converting all of your long identifiers into single-letter names. –  Hurkyl Dec 1 '11 at 1:59
This is a great answer to the question. –  Sam Lisi Jun 26 '12 at 9:47

Actually, I think the reason why single letter identifiers are popular in math, and not so popular in programming is Intelisense. Today, every profesional developer would flinch if shown something like return P * pow(1 + r / n, n * t), but we have been spoiled by the ease of use of automatic filling of long names.

As I remember, 10-15 years ago it was more common to use single or double letter names for any local variable, because the developer would have to write each character himself, by hand. Right now, I just press a few keys, and the IDE does the rest.

BTW, the name of the function used in the example (pow for Power) fits nicely with the explanation.

-
The reason cannot be Intellisense: Mathematicians have been using single letters variables since the begining of time, and (good) programmers have been using descriptive names since before the guys that wrote Intellisense heard about computers... –  Mariano Suárez-Alvarez Mar 1 '11 at 15:21
pow, len, strcpy, sqrt. If those libraries were designed today, they would be Power, Length, StringCopy, SquareRoot. It's natural to shorten the notation when you are doing it by hand, but since I no longed do it by hand, I don't mind if a method is called ThrowStackOverflowException instead of thrSOExc, in fact I prefer the longer name. –  SWeko Mar 2 '11 at 7:55
StringCopy(TheOutputCharacter, NumberToString(SquareRoot(42 + TheCharacterInputtedByTheUser)); vs strcpy(out, flatten(sqrt(42 + in))); –  muntoo Apr 14 '11 at 2:55
@muntoo, Ok, TheOutputCharactes is na overkill, but other than that, the first expressuion is clearer, and it would take the same time to write both of this. What odes flatten do? Is it clear from its name? –  SWeko Apr 14 '11 at 6:59

It's a convention like any other; never underestimate the power of historical inertia! Different disciplines have different conventions.

I would also guess (and I have no evidence to support this) that a big reason it is currently still around is that typesetting equations was expensive and time-consuming before the rise of modern typesetting (e.g. TeX) and writers of textbooks were probably encouraged to keep their notation as concise as possible. This would explain the disparity between mathematicians and programmers since the latter, after all, have the benefit of a history of using computers.

-
Even with TeX the software still "expects" single-letter variables. One can write $pressure$ but only with \mathrm{ ... } tags does it look like you would want a whole word to: $\mathrm{pressure}$. –  isomorphismes Jun 23 '11 at 15:57

Because a variable is just a number and they all behave equally, different variables dont have any different meaning or interpretation in math, you dont gain any additional information by writing "final_amount" instead of x. Its only confusing and unproffesional. Even if you try to follow this path, there can be intermediate steps in solving an equation in which these words can not be interpreted in any sensible physical or informal way. For instance it can be convenient to introduce imaginary numbers even when solving equations with real solutions.

-
We use single letters for things other than variables (operators and functions, for example). –  isomorphismes Jun 23 '11 at 15:58

Because the intellisense & autocompletion on my piece of paper is turned off. :)

(So is the context sensitive color highlighting.)

Holy cow, imagine a sheaf cohomology commutative diagram chase with camel casing and vaguely Java like method syntax for all operations. Or even just the chain rule:

derivative(firstSmoothFunction.composedWith(secondSmoothFunction)) = derivative(firstSmoothFunction).composedWith(secondSmoothFunction) * derivative(secondSmoothFunction)

In many cases the more concise notation may make it harder to remember what stands for what, but well chosen notation makes the relations between things much more apparent.

-
There is an important overlap between what you say and what has been said in earlier answers. :) –  Mariano Suárez-Alvarez Feb 28 '12 at 7:19
however, this fantastic formulation of the chain rule is hilarious. –  Sam Lisi Jun 26 '12 at 9:48

When doing algebra by hand with pencil and paper, it's a lot easier - and a lot faster - to work with something like

PV=nRT

(pressure)(volume) = (number of moles of gas) (gas constant) (temperature).

And this matters a lot when you're doing a timed exam.

-
Right. Part of what makes mathematics what it is is its ECONOMY of expression. –  Mike Jones Oct 20 '11 at 4:31
+1 for the last sentence. –  timur Nov 30 '11 at 16:12

Its quite self explanatory if you read of how Cardan wrote polynomials:

$$x^4+6x^2+36 = 60x$$

He'd write

$$1\overline{q}d\overline{q}d. p: 6\overline{q}d. p:36 \text{ aequalia. } 60 pos.$$

or to write

$$x^4+(2y+12)x^2 +y^2+12y+36 = (2y+6)x^3+60x+y^2+12y$$

He'd put

$$1\overline{q}d\overline{q}d. p:2 pos.p:12 \overline{q}d \text{ R }p:1\overline{q}d.p:1 pos. \text{ additi numeri } p:36 \text{ aequalia. }$$ $$2 pos.6\overline{q}drator\overline{u},p:60 pos.p:1 \overline{q}d. p:12 pos. \text{ numeri additi }$$

-

I don't think that substituting single-letter variables with more letters would do much positive in most mathematics, because most theorems (and such) are short enough so that remembering a few variables isn't a problem. And if you forget, it is just to look at the start of the theorem. Also, there is conventions for what variable-letters to use in different circumstances. And last, it is a way to make it easier to separate words from variables.

In programming, the ability to have more letters for one variable, is a huge advantage because a program often consists of thousands of lines, and hundreds of variables.

-
Indeed, the usage that routinely confounds me is when I'm reading a paper and there's an intro paragraph that describes how 10 or more separate Roman/Greek/Hebrew symbols will be used, symbols that often have wildly differing value domains (sets, clauses, integers, formulas, edges, etc.), followed by a long series of increasingly complex lemmas that use those symbols. I can keep referring back to the intro paragraph, but jumping back and forth between contexts hinders understanding. –  Kyle Jones Dec 21 '11 at 0:16

I think mathematicians continue to use such terse notation because they don't have to maintain their creations under time pressure. Mathematics is essentially a write-once language and it only runs inside another mathematician's very forgiving brain. You can spend an hour rereading the same paragraph in a math paper until you understand it, taking time to absorb and reabsorb the sundry meanings of the Greek and Roman characters arrayed before you, and nothing bad will happen in the meantime. In an IT operating environment, we don't have that luxury. If I were ever rolled out of bed at 0300 to deal with a computer system problem and I had to deal with scripts/logs written anything like a typical math theorem, the person/idiot responsible for those scripts/logs would be strangled/fired before sunup.

-
This isn't unique to mathematics, though. The same was true for pretty much all disciplines before there were computers. Papers meant to be read by humans don't have to be "maintained" in the same way that software does. (Because, as you said, the papers are only "run" in another human's brain.) Instead of maintaining "legacy papers", each generation can simply rewrite in its own language, letting the (human) readers' brains take care of any "backward compatibility" issues. –  Ted Jan 13 '12 at 6:18
As support for this view (that variable names in mathematics can be short because they are "throwaway" and the expressions don't have to be looked at again) — note that even in programming, certain variables that are very temporary and local in scope often take single-letter names. Loops are often written with "i" for the index, and this is not (usually) considered bad style if the body of the loop is short and its structure is nothing unconventional. –  ShreevatsaR Mar 17 '13 at 11:19

I am a retired software engineer and a math person. I am going to answer your question based on my own personal experience and observation.

The coding style in your first example is unacceptable today but was common in old days. The FORTRAN programs written in 60's and 70's are like that.

The programmers deal with real life problems. The reasons programmers use long variable names are mostly for readability and easy to debug. Programmers are asked to use long names because they were having difficulty understanding code written by others and debugging code written in short names. I was once shown a piece of code written by myself and could not figure out what I was doing.

On the other hand, mathematicians mostly deal with abstractions. The formula in your example generally will be present with the explanation you provided. Later on in the literature, the author can use t, which is the number of years, wherever it is needed without repeated explanations. Most mathematicians follow certain conventions, say they usually use x for an unknown, c for a constant without explanation. This sometimes will give the readers some trouble understanding the text if unusual conventions were used. Also, the reader will have to get used to the notation the author adopts. Sometimes it's a pain.

In either case, there is a compiler there. In the programming case, you have a compiler to help generating machine code for the computer to understand. In the math case, your brain is the compiler to generate the knowledge.

-

I'm a programmer as well. Note that your initial phrasing would be better as "As an imperative programmer, ..."

If you look at functional programming languages like F# or Lisp, the single letter variable paradigm is quite common for many of the reasons mentioned in the other answers. Take the functions:

let square x = x * x;;
let power x y = x ^ y;;


These are common and accepted ways to write your functional functions. This is mostly due to stateless/immutability differences in variables, but if we can skip the why explanations I'll just assert that the functional programming style parallels mathematical thinking far better than imperative.

Now imperative programming (by far the majority of programming) is more like a list of instructions, what I would compare in mathematics to a proof. If you remember back to 'doing proofs,' you state your reason for making each step along the way; in some cases rather verbosely.

-

I write: Solutions of quadratic equation $ax^2 + bx + c=0$ are $(-b\pm\sqrt{b^2-4ac})/(2a)$. I would not want to write this with time in place of $x$ and acceleration_of_gravity in place of $a$ and so on!

-

If we saw something like the above, then the alphabet implicitly used in mathematics would consist of words. So, then the individual letters of that alphabet basically require another language to get understood in the first place. In other words if you have something like "velocity=distance/time" then you have "velocity", "distance", and "time" at least as implied as existing in some language as part of its alphabet. But, of course, you're wanting those symbols also to represent English words which have meaning also. Thus, you need two alphabets working together at once, as well as two languages working together at once, and it's not at all clear that you'll avoid ambiguity in principle when you do this. You will have character strings which consist of a word in one language and a letter of the alphabet in the other language at the same time.

On the other hand the more common way just requires one alphabet and one language. In principle, one doesn't need any understanding of any natural languages to have v=(d/t) mathematically speaking. You just need "v", "d" and "t" as variables in your alphabet... and to perhaps make this clearer you could write the same formula mathematically as 6=(7/8) given 6, 7, and 8 as variables in your alphabet for some language. But, then we wouldn't seek to use "6", "7", and "8" to denote numbers, because then we would have two languages working simultaneously.

Basically, it comes as simpler to have v=(d/t) than to have velocity=(distance/time).

-

The point is that we usually want to be as concise as possible, in other words, we want to be capable of being understood and on the same time do not need to write lots of things. In truth, you'll never see in the middle of a serious text of math some equations with letters appearing from nowhere without explanations: we always have the definitions first. The point is that there are some conventions that we follow: things that always have the same name, and that our audience is supposed to know about. But if we do not assume even those basic things from our audience, we define them as well.

Now, I'll give you an example that you'll agree that writting everything like you say will make us even unable to proceed with the theory (only a masochist would proceed with something like that). This is an equation from differential geometry:

$$\sum_{r=1}^ng_{lr}(\gamma(t)) \frac{d^2\gamma^r}{dt^2}+\sum_{i,j=1}^n[ij,l](\gamma(t))\frac{d\gamma^i}{dt}\frac{d\gamma^j}{dt}=0$$

Now, that $[ij,l]$ expands also into another kind of big expression. Now imagine if for each of the letters we write the word it means. An equation like this one, that after making the definitions is at same time compact and understandable, would become a real mess and people would get lazzy to write down equations like that writing every word. So, we do use letters because we gain compactness, we gain simplicity and we do not waste too much time writing, but the benefits of that are only achievable if we combine with clear definitions and organized line of thought. If so, when someone reaches an equation like that will look at it and say: "well, that's easy to read, the author defined all those terms properly!" and although in the paper will appear only letters, for one who knows the definitions the entire words will "be there" but without making a real mess with the text.

-