abstractmath.org
help with abstract math
Produced by Charles Wells. Home Website TOC Website Index Blog
Back to Languages Head
Last edited 13 July
2009
|
Contents |
VARIABLES AND
SUBSTITUTION
A variable
is a symbol (usually a Roman or Greek letter)
that denotes a mathematical object of a certain
type, but which object of that type is not specified. The type (real number, set, group, etc) may
be specified explicitly or by the context
or by convention.
You already know about substituting values for variables in an expression and evaluating the result. This chapter is intended to make your implicit knowledge more explicit.
Variables in high-school algebra and in calculus are usually of some number type. But in abstract math, variables can vary over any type of mathematical object or structure.
¨
In the expression “ ” the symbol x may denote an unspecified number.
Assuming that you know x is real,
you don’t know whether x is positive or negative, but you do know that
is nonnegative. If x might
be complex, you don’t know whether
is positive or negative either.
¨
The statement “Let S be a finite set” establishes that in
this part of the text, “S” is a
variable denoting a set. The only thing
you know about the set is that it is finite.
Although one possible value for S is
the set {1, 2, 4}, the number 2 is not a
possible value of S because 2 is not a set (see literalism). Neither is the set of real numbers. Note: Some mathematicians would not refer to
“S” as a variable in this context. The usage comes from logic.
The type of a variable determines what can be legally substituted for it. Abstractmath.org uses the word “type” in this way, but this use is not common in math writing.
In some limited ways, the type may be used as an adjective before the name of the variable. Thus a real variable is a variable of type real: in other words, a real variable x may have any real number as its value, subject to any constraints that have been put on it. Similarly complex variable, integer variable, set variable.
All these are different ways of saying the same thing:
a) Let x be of type real.
b) Let x be a real variable.
c) Let x be a real number.
d) Let .
¨ The usage in a) is not common and if I see it in print I tend to suspect the writer of being connected to computer science.
¨ Note that a) and b) refer to the variable “x” and c) and d) refer to x as a number. If you are really really hung up on accuracy you might write: Let “x” be a real variable. As far as I know, only logicians ever do that.
Authors may use certain letters of the alphabet to indicate certain types of variable without saying so.
¨ i, j, k, m, n may be integer variables.
¨ x, y, z are usually real variables, although z is also customary for complex numbers.
¨ Letters at the beginning of the alphabet may denote constants or parameters.
¨ If an upper case letter denotes a structure, the same letter in lower case may denote an element of the structure. For example an article might refer to the element a of the set A.
These conventions are not observed universally.
In effect, the word “type”, for those mathematicians who use it, is a reference to one of the natural kinds of things used in math. I might say “Let x be of type real and suppose x > 3”. I would not say “Let x be of type ‘real greater than 3’”.
This concept of “natural kind” has psychological reality for many of us but does not have a mathematical definition. There is more about this in the Handbook (page 257) and in this article.
To substitute an expression e for a variable x that occurs in an expression t is to replace every occurrence of x by e (in a sophisticated way - see below). The expression resulting from the substitution has a generally different meaning and the meaning can be determined just knowing the old expression and what was substituted.
ExampleLet the expression t = 3 + 5x.
¨
The result of substituting 4 for x in t
is ,
which is 23.
¨ The result of substituting x + y for x in t is 3 + 5(x +y).
Instead of “substitute e for x” people may say “replace x by e” or “plug e into t for x”. There are mathematicians who find the “plug in” terminology offensive.
The act of substituting may require insertion of parentheses and other adjustments to the expression containing the variable.
Substituting
is not a mechanical act.
It requires understanding the form and meaning of the expression.
¨ Substituting
¨ Let e be x+y
and t be
¨ Substituting gives
.
Note the changes that have to be made
from a straight textual substitution. You
could write
instead of
but you can’t write it as 22u. Of course, the expression
simplifies to
.
¨
Suppose . Then
and
.
All
uses of a particular identifier must refer to the same object.
When I substituted 2u
for x in above, I had to
substitute it for both
occurrences of x. “Replace the first x by 2u and the second x by W “ (see case) gives
,
but that
action is not an example of substitution in the mathematical sense.
This observation is an implicit rule in pattern
recognition. The statement “x + x = 2x” is true whatever real number is substituted for x. So
and
. But of course the statement does not mean
.
A fundamental fact about the syntax and semantics of all mathematical expressions (as far as I know) is that substitution commutes with evaluation. This means:
If you replace a subexpression by its value
the value of the containing expression remains the same.
ExampleThe expression has two subexpressions, 3x and
.
a) If
you substitute 4 for x and 5 for y in the
expression ,
you get the expression
which equals 37.
b) If
you substitute 4 for x in the
expression 3x, you get 12. If you substitute 5 for y in the expression ,
you get 25. If you substitute 12 for 3x and 25 for
in
,
you get
,
which is also 37.
This is an obvious but basic property of
mathematical expressions. Teachers and students of math almost never see
an explicit statement of it. I believe I have observed students being confused because they
didn’t fully grasp this fact. Whether
that happens often is something the math ed people have not investigated,
as far as I know.
|
|
¨ Computer scientists refer to process (a) as top-down evaluation and process (b) as bottom-up
evaluation.
¨ The principle that substitution commutes with evaluation is
behind the definition of algebras for a monad (see ttt, where
monads are called triples.)
You can describe how to calculate for x =
4 and y = 5 by saying
Substitute 4 for x and 5 for y in .
Doing this requires being familiar with the process of substitution that I described above. You can spell it out more transparently by describing the process:
a) Multiply x by 3.
b) Square y.
c) Add the results of a) and b).
This illustrates
the fact that an
expression may be associated with a computational process: The expression encapsulates
the process.
See other
examples here.
A variable in an expression is either free or bound. It is approximately correct to say:
¨ A variable is free if you can substitute a value for it and the resulting expressions is meaningful.
¨ A variable is bound if the
expression is a statement about all the possible values of the variable all at
once. A bound variable is bound by an
operator such as the integral sign, a quantifier, or a summation
sign.
Those
statements are a guide to what “free” and “bound” mean but are not totally
precise they are not mathematical definitions. Precise mathematical definitions of “free” and “bound”
involve technicalities (see Wikipedia).
¨
In the expression “ ”, the x
is a free variable.. You can substitute
¨ In “ ”, the variable x is bound
by the integral
sign. The value of the integral, which is
,
depends on all the
values of x between
.
¨
You
can substitute for the variables a and b in the
integral .
In this expression, a and b are free. They
are parameters. You
can substitute a = 3 and b = 5 and get the integral we had in the previous example.
is actually a function of two variables
a and b.
¨ In the symbolic assertion “ ”, x is
free. You can substitute
”. You can also substitute
”, which is a false assertion but is
nevertheless a
correctly formed assertion with a specific meaning.
¨
In the assertion “For all real x, ”, x is bound
by the universal quantifier. The statement is a (false) claim about all possible values of x.
Suppose we define a function: Let . Then the x
in that expression (it occurs twice) is bound.
There is an implicit “for all x”
in such a definition. The statement “Let
” is perfectly legitimate, but it defines a
different function that has only one element in its domain.
Assuming x has been specified as a real variable, you can think of x in several related ways. All the remarks in this section assume that x is free.
If the author says “x is
a real variable” then it plays
the role of a real number in whatever expression it occurs in. It is like an actor in a play. If the producer says Dwayne
will play Polonius you know
that Dwayne will hide behind a curtain at a certain point in the play. When x occurs in the expression you know that if a number is substituted for x
in the expression, the expression will then denote the result of cubing
the number and subtracting 1 from it.
The variable x is a slot into which you can put any
real number. If you plug you will get 26.
This is like a blank
cell in a spreadsheet. If you define another cell with the formula “ ” and put 3 in
the cell representing x, the other cell will contain 26.
What’s wrong
with this metaphor: In Excel, a blank cell is automatically set to
”
should say “undefined!”. (I am not
saying this would make Excel a better spreadsheet. Excel was not invented so that I could make a
point about free variables.)
The variable x denotes a variable real number. This means x is a genuine mathematical object and you can make assertions about it, but some of the assertions might have no truth value. Alternatively, you can think of it as a genuine particular math object but you don’t know everything about it. This sort of thinking works for both the symbolic language and mathematical English and is discussed in more detail here in the section on math objects.