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.
But actually, the real message of this post is more basic.
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.
Here’s a much clearer way of saying the same thing.
I could have written that in a slightly less formal way as follows.
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:
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.
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 .)