Roughly speaking, a *variable* is any letter you use to stand for an unknown object of a certain type. For example, if you write then and are variables. If you write, “Let be a subset of ” then is a variable (it is an unknown set of a certain kind) whereas isn’t (it’s the name we give to the set of all positive integers). I suppose the definition I’ve just given isn’t quite perfect, since if I asked you to solve the simultaneous equations and then one would normally call and variables even though their values are completely determined by the equations. Though even then one could say that they started out as “unknown”.

Just in case I’ve gone and confused the issue, let me try to clear it up instantly. It would be quite normal to say something like this: “Let and be two real numbers. Suppose that they satisfy the equations and Determine the values of and ” It is then reasonable to call them variables, because when I started discussing them I gave no information about them whatever. I then went on to specify some relationships between and and it so happened that from those relationships it was possible to deduce the exact values of and

**Free and bound variables.**

There is a simple, but incredibly important, distinction between two kinds of variables. It’s one that you will have come across if you are familiar with the notation for sums. Consider the expression That involves two variables, and But the role they play in the expression is very different indeed. To see the difference, ask yourself, for each variable, what difference it would make if you replaced it by a different variable. Let’s try it. I’ll start by replacing by I get So whereas before I was adding up the first squares, now I’m adding up the first squares, so if then I’ll be getting a different number. Now let’s instead replace by That gives us the expression How does that differ from ? It *doesn’t*. It’s just another way of writing the sum of the first squares. We call a *free* variable (roughly speaking because we are free to choose a value for it) and a *bound* variable, or *dummy* variable.

Here are two further ways of distinguishing between free and bound variables. The first is to ask yourself the question, “What value does this variable take?” If the question is sensible, then the variable is free, and if it’s a stupid question then the variable is bound. For instance, if I ask what the value of is in the expression that is a stupid question: it’s just standing for something that goes from 1 to n. (The same phenomenon occurs in computer programs with FOR loops. If I write “FOR m=1 TO n DO such and such”, then isn’t something you can substitute a value for, whereas is.) But if I ask what the value of is, that’s not ridiculous at all: we might decide to set or for some other variable that’s floating around, and so on.

The second way is to see whether you can rewrite the expression in a way that doesn’t mention the variable in question. For example, I can rewrite as This test doesn’t always work that well. For example, is a dummy variable in the expression but it’s difficult to rewrite the expression without mentioning some variable that plays the role of In fact, it was difficult even in the summation case — I had to use dots and trust that you would know what I was talking about. Even so, the test may occasionally be helpful.

So far, I’ve talked about free and bound variables in expressions that stand for mathematical objects (in both cases numbers). However, the main theme of this section of the post is really free and bound variables in *statements*. Let me give an example.

Here I’m imagining that and are sets of real numbers. The statement is telling me that every element of can be sandwiched between some element of and twice that element.

The statement above involved four variables, and I hope it is already obvious to you which ones are free and which are bound. In case it isn’t, just apply the test of seeing whether it makes a difference to what the statement is saying if you change a variable to something else. Then you will see that and are free variables and and are bound variables. Why? *Because the statement is about and and not about and * (I recommend reading it and making sure not only that you understand what it means but also that you agree that it is saying something about and .) If you change and to and then you are no longer saying that and are related in a certain way: you are saying that and are related in that way. But if you say,

then you are expressing exactly the same relationship between and as you were before.

An easy way to tell which variables are free and which are bound in certain types of sentences is just to look and see which ones appear in quantifiers and which don’t. For example, take the following, by now fairly familiar, statement.

Four of the variables that appear are and The status of is a little less easy to describe: I’ll come back to it in a moment. Now appears inside a quantifier, since the statement begins, “For every .” Similarly, and appear inside quantifiers. But doesn’t. Therefore, and are bound, but is free.

What about A good way to understand its role is to write it instead as That is, we treat the sequence as a function that takes integers and turns them into real numbers. With this new notation the sentence would be rewritten

Now we can simply say that is a variable: it stands for an unknown function from the positive integers to the real numbers. Since we have not quantified over it is a free variable.

If that analysis is correct, then it should be the case that the sentence above is telling us about and while and are just placeholders. And indeed that is the case. When we say that a sequence converges to a limit, we are talking about the sequence and the limit, and not all the other variables that come in when we write out the definition in full.

Note that whether or not a variable is free depends very much on the statement that you regard it as being part of. For instance, suppose I write the following: “Let Then by the above calculation we see that ” If I regard as part of the second sentence only, then it is free. But if I regard it as part of both sentences, and if I regard those as a way of saying, “For every [the above calculation shows that] ” then we are quantifying over so it is bound. In a funny way, the word “Let” could be said to “liberate” (The phrase “with one bound he was free” comes to mind, but that really does confuse things.)

I said in the title that I was going to offer some tips for handling variables. So here’s one.

*Always be completely sure in your mind which variables are free and which are bound.*

But actually, the real message of this post is more basic.

*Always introduce your variables to the reader before going on to talk about them.*

In this small respect, you should treat your variables like people. Suppose that you had two friends, Anne and David, who had never met. You wouldn’t begin by saying to David, “Anne went to Amsterdam a few months ago.” Only once you’d said, “This is Anne,” or words to that effect, would imparting information about Anne be appropriate social behaviour. I have often read supervision work, not really understood what has been written, and felt moved to ask something like, “What is ?” in roughly the tone of voice that David might ask, “Who’s Anne?” if you launched in with information about her last holiday.

How do you introduce a variable? Let me illustrate by example. First, a definition: a function that takes real numbers to real numbers is called *strictly increasing* if …

I’ve got to that point in my sentence and realized that it is rather difficult to say what I mean unless I give the function a name. Here’s what might have happened if I had struggled on with the sentence I was in the middle of writing.

*strictly increasing*if whenever you apply it to two real numbers, one of which is greater than the other, then the value it takes at the greater number is greater than the value it takes at the smaller number.

Here’s a *much* clearer way of saying the same thing.

*strictly increasing*if for every pair of real numbers and , if then .

I could have written that in a slightly less formal way as follows.

*strictly increasing*if whenever .

That is less formal because I didn’t specify what and were (leaving it to the context to make it clear that they were real numbers) and I used the word “whenever” (leaving it to the reader to work out how to convert that into a statement involving a universal quantifier). However, I am much more concerned with the difference between these last two formulations of the definition and the first one. And that difference is that I followed another tip for dealing with variables:

*Give names to the things you are talking about.*

If you do that, then you nearly always convert clumsy, wordy sentences into much cleaner ones.

Incidentally, this piece of advice very much depends on our modern practice of using letters to stand for whatever we feel like making them stand for. Before this practice was invented, nobody knew of any way of expressing mathematical statements apart from what I have been calling the clumsy, wordy way. For example, this is how the sixth proposition from Book II of Euclid’s *Elements* was stated (in translation of course, but the point still stands).

If a straight line be bisected and a straight line be added to it in a straight line, the rectangle contained by the whole with the added straight line and the added straight line together with the square on the half is equal to the square on the straight line made up of the half and the added straight line.

If you have the faintest idea what that’s saying, then you’re doing better than me. Personally, I find a sentence like that more or less impossible to understand. And if I do want to understand it, I have to translate it. Fortunately, we know how to avoid that style now, so please avoid it.

Back to what I was really talking about, which was the principle that you should introduce your variables before you talk about them. As I’ve just been saying, a function from the reals to the reals is *strictly increasing* if whenever . Imagine now that you had a question on an examples sheet that asked you to prove that the function is strictly increasing. (By the way, a quick aside. You may notice that I wrote “examples sheet” and that almost all the sheets your lecturers hand out have at the top the words “example sheet”. In my day they had at the top the words “examples sheet”, for the simple reason that each sheet was a sheet of examples. I get irritated with the phrase “example sheet”, but as I write this I realize that if you replace the word “example” with “problem” or “question” then the plural seems utterly weird. In fact, I can’t think of a single example where “An X of Ys” would become “A Ys X” rather than “A Y X”. Somehow that’s even more irritating. And somehow “examples sheet” *still* feels right to me.)

OK, how do we show that the function is strictly increasing? Here’s how *not* to begin your argument.

If you write that and I ever see what you’ve written, it will be a pure reflex for me to ask, “WHAT ARE AND ?” If you think that that’s ridiculously pedantic and that the context makes it obvious that you have chosen two real numbers and with , I would respond as follows.

(i) It is true that I can tell that that is the context that you have set up in your brain before writing what you wrote.

(ii) It is also true that that is the only context I can think of that makes sense of what you wrote.

(iii) Nevertheless, you have not explained the context.

(iv) If you get into the habit of not explaining the context, then you will run into difficulties when the proofs get a little bit more complicated.

Point (iv) is the most important. As soon as you start needing to write proofs that involve definitions that have strings of two or three quantifiers, if you don’t say what your variables are doing then you’ll get into a mess.

Back to this proof. What should one write instead? Something more like this.

It may seem so obvious to you that the function is increasing that you’re not quite sure how to prove it. What I want to do is deduce this simple fact from very basic principles to do with how inequalities interact with addition and multiplication. The main two are these, which hold for any three real numbers and .

Let me indicate two arguments. The first is a bit crude but it gets the job done.

If and are both positive, then

.

There I made repeated use of the second principle above. I also used the fact that , and are all positive, which can be deduced from the second principle too.

If and are negative, we can use the fact that and are positive and the fact that and to deduce that from what we have just proved. And if one of and is zero, then we can use the fact that the other is positive (if ) or negative (if ). If one is positive and the other negative, we can use the zero case to prove what we want in two steps.

I won’t give the full details of that argument, because there is a cleaner argument that does it all in one go. Note first that . Now is positive, by assumption. As for the second bracket, it equals , which is positive because the square of any number is non-negative and and are not both equal to 0. (Why is the square of any number non-negative? I leave that to you as an exercise.)

Perhaps by this point you are getting cross with me because you think I should have just differentiated. There are all sorts of answers to that, but the main one is that I simply don’t like using calculus when there’s an elementary calculus-free argument around. Another is that the argument via differentiation is slightly more complicated than you might think. In any case, the point of this whole discussion was not the proof itself but the fact that I began it with, “Let and be real numbers with .” The word “let” is incredibly useful for the purpose of introducing variables. It is typically used in two situations.

*Situation 1.* You want to prove a statement about every element of some set . You begin your argument with, “Let .”

That’s the situation we’ve just met. There I wanted to prove something about every pair of real numbers with the first less than the second. So I started the proof, “Let and be real numbers with .”

*Situation 2.* You have just established that some object exists with a property . You follow that up with, “Let be a [insert name for type of object that is] such that .”

Let me give an example of situation 2. Recall the result I mentioned in an earlier post, that if and are two positive integers that fail to generate the whole of then they must have a common factor greater than 1. Let’s suppose that I’m in the middle of a proof and I find that the only way that my argument can fail is if there is some integer that cannot be written in the form . My proof might continue as follows.

*Let be such a factor.*[Proceed to talk about .]

Sometimes — in fact, extremely often — in this situation, mathematicians do something a bit sneaky. Instead of writing the careful introduction of that I’ve given above, they write something more like this.

Strictly speaking, this second way of writing is badly incorrect because in the first sentence is a bound variable (because the sentence is effectively saying, “There exists such that is a factor of both and .”) but when one goes on to talk about it has magically become a free variable. But when a linguistic practice becomes sufficiently widespread, it makes no sense to call it incorrect. It is better to regard the above as a convenient shorthand: if we pass from existentially quantifying over a variable in one sentence to talking about in the next sentence, it should be understood that what we really mean is that we existentially quantify over a *different* variable, then say, “Let be [an example of what we’ve just shown to exist]”, and then proceed to talk about . As long as you know exactly what you are doing, then this is OK.

One further remark. If you establish the existence of such that and then go off and discuss something else for a while, then it will be quite confusing if later on in the argument you treat as a free variable. So the shorthand above is probably best kept for situations where you prove that something exists and then immediately go on to talk about it (where by “it” I really mean one of the many possible examples).

Let me end with an exercise. Out of all the variables in the following sentence, which are free and which are bound? (The variables are , and .)

October 7, 2011 at 1:09 pm |

In the third line of your fifth paragraph, shouldn’t the “m^2” read “n^2” instead?

Thanks very much — corrected now.October 7, 2011 at 2:15 pm |

You’ve got x listed twice in the second to last sentence (“The variables are…”).

And thanks for this too … also corrected now.October 7, 2011 at 4:52 pm |

First a typo: you’ve written “If a<b then a+c<a+c", but the last "a" should be "b".

Also: in your "crude" argument proving that f(x)=x^3 is strictly increasing, you address the cases: one of x,y equal to zero; both positive; both negative. Unless I'm missing it, you didn't mention the (easy) argument in the case that x,y have different signs.

Further thanks. Also now corrected.October 7, 2011 at 5:45 pm |

There is an interesting asymmetry in mathematical exposition, in that we have standard phrases for introducing variables (“Let be an arbitrary element of the set “, etc.) but we don’t have a standard phrase for removing variables (other than, perhaps, the end-of-proof symbol). This can occasionally lead to confusion: for instance, one may have two consecutive homework problems, both involving an unknown variable , but in the first homework problem ends up equal to 17, while in the second homework problem ends up equal to 23. Of course, it is implicitly understood that the which was introduced in the first homework problem has been “de-introduced” by the end of that problem, so that the letter becomes available again for an unrelated usage, so that it is not legitimate to use some fact about from the first problem to be used in the second problem (unless this is explicitly circumvented with a phrase such as “Let be the quantity from the previous problem”).

This is one reason why it is good, when writing a lengthy argument, to encapsulate parts of the argument into lemmas and sublemmas, so that variables that are created for the sole purpose of proving one of these lemmas are automatically removed from the scene by the end-of-proof symbol, thus reducing clutter in the ambient “namespace”. (This is also why it is bad form to “reach into” the proof of such a lemma and use statements that involve variables whose scope is limited to that proof, to assist an argument outside of that proof.)

There is an apocryphal story about a mathematics text which went to such extreme lengths to avoid namespace collision that once a symbol (e.g. x) was used anywhere in the book, it was not used again for any other purpose. Apparently, as the book progressed, the author quickly ran out of Roman letters (in both lower case and upper case), then the Greek, then Fraktur, and eventually was using Japanese katakana in the last few chapters!

October 7, 2011 at 6:10 pm |

You can get spectacularly difficult bugs when programming if you don’t properly declare your variables correctly, get the brackets round your conditionals correct (as in a previous post), fail to reset your variables (as per Professor Tao) and so on…

It is a very practical form of misunderstanding.

October 7, 2011 at 7:39 pm |

The expression “cos(1)-cos(x)” doesn’t mention t, and although it doesn’t express exactly the same idea as the definite integral, it does, for any value of x, represent the same quantity. Of course, there are plenty of easily-written functions without closed-form integrals (depending on what you mean by closed-form, since the useful ones like Li(x) have been given names of their own).

October 7, 2011 at 7:51 pm |

When proving that x^2+xy+y^2>=0, you could instead have observed that it equals (x/2+y)^2 + 3/4 x^2. That would have had absolutely no advantages in terms of mathematical exposition, but it would have made use of the proposition of Euclid that you mentioned earlier!

(Actually, I’m curious. Is it by any chance the case that you originally had just that in mind, then decided it would be more vivid to profess total incomprehension of the Euclid proposition, and then had to avoid using it as a lemma?🙂 )

October 8, 2011 at 12:36 am

That’s wonderful — I had absolutely no idea that I could have used Euclid’s proposition. It did occur to me to use the observation you mentioned, since that is what I would have got from the usual procedure for diagonalizing a quadratic form. But I decided that I preferred the more symmetric expression.

October 7, 2011 at 11:18 pm |

I understand your concern about “examples sheet”, “example sheet” and other expressions that follow the same pattern. German makes this thing (I nearly wrote “everything”, but that would be untrue) so much simpler. It is a Lego language, so you just clip words together, generally in the singular: Beispielblatt, Problemblatt, Frageblatt.

From Littlewood’s Miscellany, page 59 of the edition edited by Bela Bollobas (at least according to what Google Books shows me – I don’t have the book to hand), we have this story about variables:

Schoolmaster: ‘Suppose x is the number of sheep in the problem.’ Pupil: ‘But Sir, suppose x is not the number of sheep.’ (I asked Prof. Wittgenstein was this not a profound philosophical joke, and he said it was.)

October 8, 2011 at 12:34 am

I think I’m with the pupil there: the schoolmaster should have said, “Let be the number of sheep in the problem.” I would use the word “suppose” if I wanted to consider what happens when some fact holds. For example, I might go on to say, “Suppose that is a multiple of 7.” That is, I use “let” for declaring the variable, and “suppose” for insisting that the already declared variable should satisfy some condition. I’m not certain that everyone would make the same decision, however.

October 8, 2011 at 10:29 am

I’m not sure that German is really much simpler in that regard. Just think of the word “Übungszettel”, which many people use instead of “Problemblatt”. (The word “Übung” refers to the official discussion sessions in which the examples sheets are discussed, “Zettel” means “Blatt”, and where the additional “s” comes from is not clear to me right now.)

October 8, 2011 at 4:23 pm

I am equally unsure as to the reason for the “s” on the end of “Übung”. It is not to form any case, since all cases of “Übung” have the same form as the nominative, the only difference being between the singular and the plural (-en). Perhaps it is there to make pronunciation easier. Or perhaps the declension used to be different, with an -s for the genitive.

The extra “s” is standard when you clip another word onto the end of “Übung”. So while this peculiarity may lack justification, at least it is a regular peculiarity. There is no scope to debate what the correct form might be.

October 8, 2011 at 3:37 am |

Two more typos: in the fifth paragraph the sum is missing a summand, and in the seventh (i.e. the one starting “The statement above…”) the ‘B.’ has the full stop inside the LaTeX, so displays incorrectly

Thanks — I’ve changed those two now.October 9, 2011 at 7:00 am |

I am working on something called social mathematics, if you have time to chat please let me know. marcuscox@socialmathandyou.com

October 11, 2011 at 11:36 am |

[…] recalled the definition, the second step is very easy indeed, and is something that I covered in the post about handling variables. If you have to prove a statement of the […]

February 8, 2012 at 6:43 am |

‘ … I wrote “examples sheet” … for the simple reason that each sheet was a sheet of examples.’

So do you say “fruits basket” or “fruit basket”?😀

Just rhetorical–not seriously expecting a reply.

Also, thank you for making great blog entries!

February 8, 2012 at 10:30 am

I say “fruit basket”. But then again, I also say “basket of fruit” …

August 21, 2012 at 4:33 pm |

Suppose we want to write a direct proof that , and start it with the standard “Let ”. I suppose this is not

Situation 2>, for you have not proved that such exists, and you know nothing about its type. In your examples ofSituation 1, however, you seem to have carefully picked up cases in which you know beforehand that was not empty. So, my question is: Is this still the kind of situation in which is being “introduced” as an element of ? And how do you feel about the sentence “Fix ” (introducing a so-called eigenvariable, or parameter), often used by languages (such as Isar) intended to formalize the mathematical vernacular?