Variables are placeholders for mathematical objects. In this chapter variables will be placeholders for integers. We use the characters \(a\text{,}\)\(b\text{,}\)\(c\text{,}\) …, \(z\) and \(A\text{,}\)\(B\text{,}\)\(C\text{,}\) …, \(Z\) as variables. Note that when we use a letter as a variable, it is written in italics.
We use variables in several ways, which we describe below. Sometimes we simply want to give a value a name. If we do not assign a concrete value, for example a number, to a variable, we specify what values the variable can have, for example, a natural number. Sometimes, we use a variable that does not have a concrete value in a mathematical statement, such as an equation or an inequality. Finding a solution to such an equation or inequality means finding values for the variables that make the equation or inequality true.
In the video in Figure 1.22 we give an overview of the topics covered below.
SubsectionAssigning a Value to a Variable
The most concrete use of variables is to assign a value to a variable. To assign a value to the variable \(a\) we say or write “let \(a\) be ” or “let \(a:=\).”
The symbol \(:=\) is used for assignment, which indicates that an action is taking place. The symbol \(=\text{,}\) which indicates equality, is used in statements. The assignment “let \(a:=\)” changes the value of the variable \(a\text{.}\)
Example1.23.Assigning values to variables.
We write “let \(a\) be \(65536\)” or “let \(a:=65536\)” to assign the value \(65536\) to \(a\text{.}\) Both notations mean exactly the same thing.
After assigning this value to \(a\text{,}\) the statement \(a=65536\) is true.
However we can change the value of \(a\text{.}\) Let \(a:=32\text{.}\) Now \(a=65536\) is false and \(a=32\) is true.
SubsectionEquality and Substitution
When we have a true equality statement, such as \(a = 32\) at the end of Example 1.23, we can replace \(32\) with \(a\) (or \(a\) with \(32\)) in other statements and expressions. This replacement is called substitution, and it is a fundamental principle in mathematics that we will use, often without explicitly mentioning that we have substituted one expression by another expression that is equal to the first. For example, we have already used substitution when evaluating the expressions in Example 1.9. We replaced \(2+3\) with \(5\) because \(2+3 = 5\) is a true equality.
Example1.24.Substitution.
We give an example of using substitution. Let \(a := 32\text{.}\) Since \(32 + 7 = 39\) is a true equality statement, \(a + 7 = 39\) is also a true equality statement.
In Checkpoint 1.25 decide whether the expressions are statements for the given value of the variable.
Checkpoint1.25.Statements with variables.
Let \(i:=1\text{.}\)
Decide which of the following are statements, true statements, or false statements.
\(\displaystyle 8\ne i\)
\(\displaystyle i\cdot 8\)
\(\displaystyle 8\cdot i\)
\(\displaystyle i=1\)
SubsectionVariables in Definitions
In definitions we introduce new terminology for objects, properties, and operations.
First we state what kind of object we are talking about. To be able to refer to the object in the definition, we give it a variable name. Then we state the definition of the property using the variable name.
Example1.26.A definition.
We give an example of a definition of a property for a real-world object, a cup, using the language of mathematics.
Let \(c\) be a cup. When we say \(c\) is full, we mean that you cannot put anything else in \(c\) without spilling over.
The variable \(c\) is defined to be a cup (any cup). We are defining the property full, so full is in italics. We define full to mean that you cannot put anything else in the cup. If you had a cup, you could test to see if you could put anything else in it or not.
We now define the property non-negative for an integer. With the first sentence, “Let \(a\) be an integer,” we indicate for what kind of object we want to define a property. In the second sentence we refer to the integer \(a\) and give the condition under which it is called non-negative.
Definition1.27.
Let \(a\) be an integer. When we say \(a\) is non-negative, we mean that \(a\ge 0\text{.}\)
Now instead of saying “\(a\) is an integer and \(a\ge 0\text{,}\)” we can say “\(a\) is a non-negative integer.” In this example the statement that uses the definition is not much shorter than the explicit version that we were able to give before. As concepts become more complicated, it will become more convenient to use new vocabulary and notation that we introduce with definitions. We start with well-known terminology.
Definition1.28.
Let \(a\) and \(b\) be integers.
We call \(a+b\) the sum of \(a\) and \(b\text{.}\)
We call \(a-b\) the difference of \(a\) and \(b\text{.}\)
Now we define a new notation in the form of a new operation, namely the square of an integer.
Definition1.29.
Let \(a\) be an integer. We let \(a^2:=a\cdot a\text{.}\) We call \(a^2\) the square of \(a\) and read \(a^2\) as “\(a\) squared.”
Example1.30.Squares.
We give examples for squares.
\(\displaystyle 5^2=5\cdot 5=25\)
\((-11)^2=(-11)\cdot(-11)=121\) (remember a negative integer times a negative integer is a positive integer)
\(-(11^2)=-(11\cdot 11)=-121\) (here the parentheses force us to square first and then negate)
\(\displaystyle (2^2)^2=4^2=16\)
With variables we can define the product of a natural number and an integer using repeated addition as in Example 1.7. We introduce the objects under consideration, namely a natural number and an integer, and assign variable names. Then we use the variable names in the statement of the definition.
Definition1.31.
Let \(n\) be a natural number, and let \(a\) be an integer. We define the product of \(n\) and \(a\) as the sum of \(n\) copies of \(a\text{.}\)
We can also write the statement of Definition 1.31 as a formula. For a natural number \(n\) and an integer \(a\) we define
\begin{equation*}
n\cdot a :=\underbrace{a+a+\ldots+a}_{n\text{ copies of }a}\text{.}
\end{equation*}
We illustrate this definition with an example.
Example1.32.Multiplication as repeated addition.
We have \(5\cdot 7=7+7+7+7+7=35\text{.}\)
Subsection“For all” Statements
Statements are often applied to all possible mathematical objects of a specified type.
When we use a variable without assigning it a concrete value, as in Definition 1.31, we specify what kind of object we want the variable to be. “Let \(a\) be an integer” means that the variable \(a\) is an integer, and can be any integer.
We also use the more direct “for all” to formulate statements about all objects with given properties.
In Example 1.33, Example 1.34, and Example 1.33 we present statements that are true for all integers. In each example we give two formulations of the same statement.
Example1.33.Adding \(0\) is special.
The statement
Let \(a\) be an integer then \(a+0=a\text{.}\)
can also be formulated as
For all integers \(a\) we have \(a+0=a\text{.}\)
Example1.34.Multiplying by \(0\) yields \(0\).
The statement
Let \(a\) be an integer then \(a\cdot 0=0\text{.}\)
can also be formulated as
For all integers \(a\) we have \(a\cdot 0=0\text{.}\)
Example1.35.Multiplying by \(1\) is special.
The statement
Let \(a\) be an integer then \(a\cdot 1=a\text{.}\)
can also be formulated as
For all integers \(a\) we have \(a\cdot 1=a\text{.}\)
We now formulate a property of the natural numbers using “for all”.
Problem1.36.Decide whether the statement with “for all” is true or false.
Decide whether the following statement is true or false. Say why.
For all natural numbers \(n\text{,}\) we have \(n\gt 0\text{.}\)
Solution.
The statement is true as the natural numbers are \(1,2,3,4,\ldots\text{,}\) which are all greater than \(0\text{.}\)
It is not always this easy to decide whether a “for all” statement is true or false, as the statement often is claimed to be true for infinitely many numbers. We know that a “for all” statement is false when we have found one value for which the statement is wrong. This makes it easier to prove that a statement is false. Values for which a “for all” statement is false are called a counterexample.
Problem1.37.Decide whether the statement with “for all” is true or false.
Decide whether the following statement is true or false. Say why.
For all integers \(a\text{,}\) we have \(a>0\text{.}\)
Solution.
The statement is false, since \(-2\) is an integer and \(-2>0\) is false.
We only need to give one counterexample to show the statement is false even though a false “for all” statement may have many possible counterexamples.
We can also use the “for all” formulation for several variables. We formulate the commutative property of addition of integers with “for all.”
Example1.38.Commutative property of addition formulated with “for all”.
For all integers \(a\) and all integers \(b\) we have \(a+b = b+a\text{.}\) This is called the commutative property of addition.
We formulate the distributive property for integers with “for all.” The statement is true for any choice of integer for the three variables.
Example1.39.Distributive property formulated with “for all”.
For all integers \(a\text{,}\)\(b\text{,}\) and \(c\) we have \(a\cdot(b+c)=(a\cdot b) + (a\cdot c)\text{.}\) This statement is called the distributive property for the addition and multiplication of integers.
Finally we combine the two previous examples and other properties of addition and multiplication.
Example1.40.Properties of addition and multiplication formulated with “for all”.
For all integers \(a\text{,}\)\(b\text{,}\) and \(c\text{,}\) we have
This is called the associative property of addition.
For all integers \(a\) and \(b\text{,}\) we have
\begin{equation*}
a+b=b+a.
\end{equation*}
This is called the commutative property of addition.
For all integers \(a\text{,}\)\(b\text{,}\) and \(c\text{,}\) we have
\begin{equation*}
a\cdot(b\cdot c)=(a\cdot b)\cdot c.
\end{equation*}
This is called the associative property of multiplication.
For all integers \(a\) and \(b\text{,}\) we have
\begin{equation*}
a\cdot b=b\cdot a.
\end{equation*}
This is called the commutative property of multiplication.
For all integers \(a\text{,}\)\(b\text{,}\) and \(c\text{,}\) we have
\begin{equation*}
a\cdot(b+c)=(a\cdot b) + (a\cdot c)
\end{equation*}
This is called the distributive property.
SubsectionAlternative formulations for “For all”
Instead of using “for all \(a\) ” we sometimes choose a different approach for formulating statements. We write “given any \(a\)” or more commonly “let \(a\) be ” followed by what type of object \(a\) is and some other statement or property. The statement that follows applies to any objects of the specified type.
Example1.41.Different formulations of statements.
The following four statements all say the the same things. The first statement is the statement from Problem 1.36.
For all natural numbers \(a\) we have \(a>0\text{.}\)
Given any natural number \(a\) we have \(a>0\text{.}\)
Let \(a\) be a natural number, then \(a>0\text{.}\)
If \(a\) is a natural number, then \(a>0\text{.}\)
We give another common formulation for the property of integer addition and multiplication, compare Example 1.38 and Example 1.39 respectively. Instead of using the formulation “for all” we introduce the variables and what kind of numbers they represent with “let” and then state the property in terms of these variables.
Example1.42.Another formulation of the commutative property of addition.
Let \(a\) be an integer and let \(b\) be an integer. Then \(a+b = b+a\text{.}\) We call this the commutative property of addition.
Example1.43.Another formulation of the distributive property.
Let \(a\) be an integer, let \(b\) be an integer, and let \(c\) be an integer. Then \(a\cdot(b+c)=(a\cdot b) + (a\cdot c)\text{.}\) We call this the distributive property.
In Checkpoint 1.44 decide whether the statements are true or false. If a statement is false, proof that it is false by giving a counterexample. That is, give a value of the variable for which the statement is false.
Checkpoint1.44.For all statements.
Decide whether the following statements are true or false.
If the statement is false give a counterexample by finding value for the variable for which the statement is false.
if statement is true leave the box empty.
(1) For all integers \(a\) and \(b\) we have \(a\cdot b=b\cdot a\text{.}\)
select
The statement is true.
The statement is false.
If the statement is false, give a counterexample: \(a=3\text{,}\)\(b=\)
(2) For all integers \(a\text{,}\)\(b\) and \(c\) we have \(a\cdot(b\cdot c)=(a\cdot b)\cdot c\text{.}\)
select
The statement is true.
The statement is false.
If the statement is false, give a counterexample: \(a=3\text{,}\)\(b=12\text{,}\)\(c=\).
(3) For all integers \(a\text{,}\)\(b\text{,}\) and \(c\) we have \(a\cdot (b+c)=(a\cdot b)+c\text{.}\)
select
The statement is true.
The statement is false.
If the statement is false, give a counterexample: \(a=\), \(b=3\text{,}\)\(c=12\)
SubsectionThere exists
Many statements assert that there exists a number with a certain property. In this case we use the formulation there exists.
The existence of a number with certain properties can be proven by presenting a number that has these properties. Such a number is called a witness to the validity of the statement. of
Example1.45.A true statement with “there exists”.
Consider the statement:
There exists an integer \(b\) such that \(b+2=0\text{.}\)
The statement is true, because if \(b=-2\) we have \((-2)+2=0\text{,}\) and \(-2\) is an integer.
We call \(b=-2\) a witness to the statement “There exists an integer \(b\) such that \(b+2=0\)”.
Example1.46.A false statement with “there exists”.
Consider the statement:
There exists a natural number \(b\) such that \(b+2=0\text{.}\)
The statement is false, because \(-2\) is the only number with this property, and \(-2\) is not a natural number.
We can also use “there exists” in definitions:
Definition1.47.
Let \(a\) be an integer. If there exists an integer \(b\) such that \(a+b=0\) then \(b\) is called the additive inverse of \(a\text{.}\)
SubsectionCombining “For all” and “There exists”
Combining the formulations “for all” and “there exists” allows us to formulate more complicated statements.
Since for all integers \(a\) we have \(a+(-a)=0\text{,}\) the number \(-a\) is the additive inverse of \(a\text{.}\) We formulate this as a theorem.
In our formulation of this result as a theorem, we combine the formulations “for all” and “there exists.”
Theorem1.48.
For all integers there exists an additive inverse.
Now we formulate a statement where the “there exists” comes before the “for all.”
Theorem1.49.
There exists an integer \(a\) such that for all natural numbers \(n\) we have \(a\lt n\text{.}\)
This theorem is easy to prove. When we set \(a:=-2\) the statement \(a\lt n\) is clearly true for all natural numbers.
In Checkpoint 1.50 decide whether the statements are true or false. If a statement is true, give a value of the value for which it is true.
Checkpoint1.50.Existence.
Decide whether the following statements are true or false.
If the statement is true provide a witness, that is, a value for the variable \(a\) for which the statement is true.
If the statement is false leave the field for the variable empty.
(1) There exists an integer \(a\) such that \(a \cdot 5=0\text{.}\)
select
The statement is true
The Statement is false
If the statement is true, give an integer for which it is true: \(a=\)
(2) There exists a natural number \(a\) such that \(18+a=0\text{.}\)
select
The statement is true
The Statement is false
If the statement is true, give a natural number for which it is true: \(a=\)
(3) There exists a natural number a such that \(a\lt 0\text{.}\)
select
The statement is true
The Statement is false
If the statement is true, give a natural number for which it is true: \(a=\)
(4) There exists an integer \(a\) such that \(a\lt 6\text{.}\)
select
The statement is true
The Statement is false
If the statement is true, give an integer for which it is true: a=
SubsectionEvaluation
So far our use of variables has been in the formulation of statements. We now give a more hands-on use of them. When evaluating an expression we replace the variables by the values given for them and then compute.
Problem1.51.Evaluate for a given value of a variable.
Evaluate \(2\cdot (b+3)\) for \(b:=7\text{.}\)
Solution.
Replacing \(b\) by \(7\) we get \(2\cdot (7+3)=2\cdot 10=20\text{.}\) Thus \(2\cdot (b+3)\) for \(b:=7\) is \(20\text{.}\)
Problem1.52.Decide whether a statement is true for a given value of a variable.
Decide whether \(a\cdot(-2)>4\) is true for \(a:=7\)
Solution.
Replacing \(a\) by \(7\) the left hand side of the inequality becomes \(7\cdot(-2)=-14\text{,}\) As \(-14>4\) is false, the statement \(a\cdot(-2)>4\) is false for \(a:=7\text{.}\)
In Checkpoint 1.53 evaluate the expressions for the given values of the variables.
Checkpoint1.53.Evaluate expressions.
Let \(c:=16\) and \(u:=15\) and \(j:=17\text{.}\) Evaluate the following:
\(c+u=\)
\(u+c=\)
\(c-u=\)
\(u-c=\)
\(u+(c+j) =\)
\((u+c)+j =\)
\((c\cdot j) -(u\cdot j) =\)
\((c-u)\cdot j =\)
\((u\cdot c)+ j =\)
\(u\cdot(c+ j) =\)
Hint.
Knowing the properties of addition and multiplication can save some work.