abstractmath.org 2.0
help with abstract math



Produced by Charles Wells     Revised 2017-01-27

Introduction to this website    website TOC

website index   blog

VARIABLES AND SUBSTITUTION

Contents

Variables

Substitution

Free and bound

How to think about variables

Variable mathematical objects (separate file)

A variable is a symbol (usually a Roman or Greek letter) that denotes a mathematical object of a certain type. 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

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.

The main point about variables is that a variable denotes a math object of a certain type, that a text may given you some facts about the variable, but you do not necessarily know the precise math object that it names.

Example

Suppose a math text says, "Let $x$ be a real number, and let $y=x^2$".

Example

A statement in a text that says "Let $S$ be a finite set" establishes that in this part of the text, "$S$" is a variable denoting a finite set.

Some mathematicians would not refer to "$S$" as a variable in this context.

The type of a variable

The type (or data type) of a variable determines what can be legally substituted for it. For example, to say that $x$ is a variable of type real means that $x$ denotes a real number. The fact that it is a variable means that you don't necessarily know what that real number is.

This terminology follows the use of the word "type" in many programming languages. Not all mathematicians use the word in this way.

Usage

The name of 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

Examples

All these are different ways of saying the same thing:

  1. Let $x$ be of type real.
  2. Let $x$ be a real variable.
  3. Let $x$ be a real number.
  4. Let $x\in\mathbb{R}$.

Note that 1) and 2) refer to the variable "$x$" and 3) and 4) refer to $x$ as a number. If you are really really hung up on accuracy you might write:  Let "$x$" be a real variable. Mathe­maticians rarely use quotes in this way, but logicians usually make the distinction.

Conventions for types of variables

Authors may use certain letters of the alphabet to indicate certain types of variable without saying so. 

Natural kinds

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\gt3$". A mathematician would not say "Let $X$ be of type real-greater-than-$3$" because "real-greater-than-$3$" is thought of as a constraint.

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 Wikipedia article on natural kind, in the Handbook (jump to type) and in the article Communication of Mathematical Reasoning

Substitution

Definition of "substitute"

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.

Example

Let the expression $E$ be "$3+5x$".

Terminology

Instead of "substitute $4$ for $x$", people may say "replace $x$ by $4$" or "plug $4$ into $E$ for $x$". 

There are mathematicians who find the "plug in" terminology offensive. From my early experience, I don't think any sexual connotation was intended. I worked on an IBM "computer" in the 1950’s that you programmed by connecting sockets to each other. There was sockets for inputs and other sockets for multiplication, addition, negative sign, and so on. By hooking the sockets up correctly you could cause a socket to output the value of $3+5x$ whenever a value was literally plugged into the socket representing $x$.

That "computer" did not deserve to be called a computer, since it did not operate on stored programs.

Syntax of substitution

The act of substituting may require insertion of parentheses and other adjustments to the expression containing the variable.

Examples

Substituting is not a mechanical act.
It requires understanding
the form and meaning of the expression.

Uniform substitution

All uses of a particular identifier must refer to the same object.

Example

When I substituted $2u$ for $x$ in ${{x}^{2}}+2x+y$ above, I had to substitute it for both occurrences of $x$.  "Replace the first $x$ by $2u$ and the second $x$ by $w$" gives ${{(2u)}^{2}}+2w+y$, 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 $3+3=2\cdot 3$ and $5+5=2\cdot 5$.  But of course the statement does not mean $3+4=2\cdot 5$.

One of the few examples in math that I know of where the uniform substitution rule is not used is in the theory of context free grammars, where you normally replace just one instance in an expression with another expression, leaving other instances alone. And, as I did in the previous sentence, they usually say "replace" rather the "substitute".

Semantics of substitution

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.


Example

The expression $3x+{{y}^{2}}$ has "$3x$" and "${{y}^{2}}$" as subexpressions.

The principle that substitution commutes with evaluation is explained with pretty diagrams in my blog post The only axiom of algebra.

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.

The phrase "substitution commutes with evaluation" has nothing to do with commuta­tivity of addition or multiplication. It means you can evaluate first, then substitute, or substitute first, then evaluate, and get the same result, as the example illustrates.

Expression and process

You can describe how to calculate $3x+{{y}^{2}}$ for $x=4$ and $y=5$ by saying:

"Substitute $4$ for $x$ and $5$ for $y$ in $3x+{{y}^{2}}$."

You can spell it out in a more transparent way by describing it as a process:

This illustrates the fact that an expression may be associated with a computational process: The expression encapsulates the process.

There are more examples in the article Functions: Images and Metaphors.

Free and bound

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. You cannot substitute a value for a bound value.

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).

Examples

Subtle example

Suppose we define a function by saying, "Let $f(x)={{x}^{2}}+1$".  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 $f(4)={{4}^{2}}+1$" is perfectly legitimate, but it defines a different function that has only one element in its domain. 

How to think about variables

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.

Role playing

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 I were going to be cubed, I would hide behind a curtain too.

Slot or cell

The variable $x$ is a slot into which you can put any real number.

Example

If you plug $3$ into $x$ in the expression ${{x}^{3}}-1$ you will get $26$.

This is like a blank cell in a spreadsheet. If you define another cell with the formula "$={{x}^{3}}-1$" and put $3$ in the cell representing $x$, the other cell will show $26$.

In some school workbooks, a variable is denoted by an empty box. That is essentially the same metaphor. The trouble with blank boxes is that they don't allow you to have more than one variable.

Variable mathematical objects

This section is in a separate file.


Creative Commons License

This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.