Example1.A.1Good Examples of Variable Definitions
Let \(p\) be the number of people in a classroom.
Let \(A\) be John's age, measured in years.
Let \(h\) be the number of hours that Susan has been working.
Understand variable and function concepts.
Represent and use functions.
Determine the domain and range of a function.
Identify functions from non-functions.
This unit on functions is important, because it provides a crucial transition point. Roughly speaking:
In elementary school, math is about numbers.
Then starting in middle school or high school, math is about variables.
And continuing into Calculus, math is about functions.
Each step builds on the previous step. Each step expands the ability of mathematics to model behavior and solve problems. And, perhaps most crucially, each step can be frightening to a student. It can be very intimidating to see an entire page of mathematics that is covered with letters, with almost no numbers to be found!
Unfortunately, many students end up with a very vague idea of what variables are (“That's when you use letters in math”) and an even more vague understanding of functions (“Those things that look like \(f(x)\) or something”). If you leave yourself with this kind of vague understanding of the core concepts, the lessons will make less and less sense as you go on: you will be left with the feeling that “I just can't do this stuff” without realizing that the problem was all the way back in the idea of a variable or function.
The good news is, variables and functions both have very specific meanings that are not difficult to understand.
A variable is a letter that stands for a number you don't know, or a number that can change (i.e it can “vary”.) A few examples:
Let \(p\) be the number of people in a classroom.
Let \(A\) be John's age, measured in years.
Let \(h\) be the number of hours that Susan has been working.
In each case, the letter stands for a very specific number. However, we use a letter instead of a number because we don't know the specific number. In the first example above, different classrooms will have different numbers of people (so \(p\) can be different numbers in different classes); in the second example, John's age is a specific and well-defined number, but we don't know what it is (at least not yet); and in the third example, \(h\) will actually change its value every hour. In all three cases, we have a good reason for using a letter: it represents a number, but we cannot use a specific number such as “\(-3\)” or “\(4 \frac{1}{2}\)”.
Let \(n\) be the nickels.
Let \(M\) be the number of minutes in an hour.
The first error is by far the most common. Remember that a variable always stands for a number. “The nickels” are not a number. Better definitions would be: “Let \(n\) be the number of nickels” or “Let \(n\) be the total value of the nickels, measured in cents” or “Let \(n\) be the total mass of the nickels, measured in grams.”
The second example is better, because “number of minutes in an hour” is a number. But there is no reason to call it “The Mysterious Mr. M” because we already know what it is. Why use a letter when you just mean “\(60\)”?
Bad variable definitions are one of the most common reasons that students get stuck on word problems-or get the wrong answer. The first type of error illustrated above leads to variable confusion: \(n\) will end up being used for “number of nickels” in one equation and “total value of the nickels” in another, and you end up with the wrong answer. The second type of error is more harmless-it won't lead to wrong answers-but it won't help either. It usually indicates that the student is asking the wrong question (“What can I assign a variable to?”) instead of the right question (“What numbers do I need to know?”)
Variables aren't all called \(x\text{.}\) Get used to it.
Many students expect all variables to be named \(x\text{,}\) with possibly an occasional guest appearance by \(y\text{.}\) In fact, variables can be named with practically any letter. Uppercase letters, lowercase letters, and even Greek letters are commonly used for variable names. Hence, a problem might start with “Let \(H\) be the home team's score and \(V\) be the visiting team's score.”
If you attempt to call both of these variables \(x\text{,}\) it just won't work. You could in principle call one of them \(x\) and the other \(y\text{,}\) but that would make it more difficult to remember which variable goes with which team. It is important to become comfortable using a wide range of letters. (We do, however, recommend avoiding the letter \(o\) or \(O\) whenever possible, since it looks like the number \(0\text{.}\))
A function is neither a number nor a variable: it is a process for turning one number into another. For instance, “Double and then add \(4\)” is a function. If you put a \(5\) into that function, it comes out with a \(14\text{.}\) If you put a \(1/2\) into that function, it comes out with a \(5\text{.}\)
The traditional image of a function is a machine, with a slot on one side where numbers go in and a slot on the other side where numbers come out.
A number goes in. A number comes out. The function is the “process” that turns \(5\) into \(14\text{.}\)
The point of this image is that the function is not the numbers, but the machine itself-the process, not results of the process. You may think of a function as an algorithm or a rule, or a recipe-for turning numbers into other numbers. That is what a function is.
A function may describe simple or complicated steps to assign values: “Respond with -3 no matter what number you are given,” or “Give back the lowest prime number that is greater than or equal to the number you were given.” Students often ask, “Can a function do that?” The answer is always yes (with one caveat mentioned below). Expand your idea of what a function can do. Any process that consistently turns numbers into other numbers, is a function.
By the way—having defined the word “function” I just want to say something about the word “equation.” An equation is when you “equate” two things-that is to say, set them equal. So \(x^2 - 3\) is a function, but it is not an equation. \(x^2 - 3 = 6\) is an equation. An “equation” is not about a process, it is a statement. In this case, the equation is stating that some number squared minus 3 is equal to a particular number, \(6\text{.}\) The equation is not telling you how to find values for numbers in general.
There is only one limitation on what a function can do: a function must be consistent.
For instance, the function in the above drawing is given a \(5\text{,}\) and gives back a \(14\text{.}\) That means this particular function turns \(5\) into \(14\)-always. That particular function can never take in a \(5\) and give back a \(16\text{.}\) This “rule of consistency” is a very important constraint on the nature of functions.
NOTE: This rule does not treat the inputs and outputs the same!
For instance, consider the function \(y = x^2\text{.}\) This function takes both \(3\) and \(-3\) and turns them into \(9\) (two different inputs, same output). That is allowed. However, it is not reversible! If you take a \(9\) and turn it into both a \(3\) and a \(-3\) (two different outputs, same input), then what you have is not a function. The issue here is that a function does not allow any ambiguity about what the output should be for a given input. In this case, which output should go with the \(9\text{?}\) \(3\) or \(-3\text{?}\)
This asymmetry has the potential to cause a great deal of confusion, but it is a very important aspect of functions.
Modern Calculus texts emphasize that a function can be expressed in four different ways:
Verbal - This is the way functions were described as far back as 1800 BCE in Babylonian clay tablets: "Double and add four."
Algebraic - This is the most common, most concise, and most powerful representation: \(y = 2x + 4\text{.}\) Note that in an algebraic representation, the input and output numbers are represented as variables, in this case, an \(x\) and \(y\text{,}\) respectively. We see the number \(y\) is calculated from the number \(x\) by doubling \(x\) and adding \(4\text{.}\)
Numerical - This can be done as a list of value pairs, as \((5, 14)\) - meaning that if a \(5\) goes in, a \(14\) comes out. Note that the second number in the pair is four greater than twice the first number. You may recognize this as \((x, y)\) points used in graphing.
Graphical - This is discussed in detail in the section on graphing.
These are not four different types of functions: they are four different views of the same function. One of the most important skills in Algebra is converting a function between these different forms, and this theme will recur in different forms throughout the text.
Sometimes a function may be represented by tables of values showing the input values with their assigned output values. For example,
\(x\) | \(y\) |
\(1\) | \(1\) |
\(2\) | \(4\) |
\(5\) | \(-2\) |
\(8\) | \(4\) |
We see each \(x\) value has one \(y\) assigned. This table of values represents a function.
Now consider the following table:
\(x\) | \(y\) |
\(1\) | \(2\) |
\(2\) | \(3\) |
\(3\) | \(9\) |
\(2\) | \(-1\) |
The \(x\) value \(2\) has the \(y\) values \(3\) and \(-1\) assigned to it. This table of values does not represent a function.
Consider the function \(y = \sqrt{x}\text{.}\) Its output, \(y\text{,}\) is the positive real number that multiplies itself to get \(x\text{.}\) If this function is given a \(9\) it hands back a \(3\text{.}\) If this function is given a \(2\) it hands back. . .well, it hands back \(\sqrt{2}\text{,}\) which is approximately \(1.4\text{.}\) The answer cannot be specified exactly as a fraction or decimal, but it is a perfectly good answer nonetheless.
On the other hand, what if this function is handed \(-4\text{?}\) There is no real number which can multiply itself to get \(-4\text{,}\) so the function has no number to hand back. If our function is a computer or calculator, it responds with an error message. So we see that this function is able to respond to the numbers \(9\) and \(2,\) but it is not able to respond in any way to the number \(-4\text{.}\) Mathematically, we express this by saying that \(9\) and \(2\) are in the "domain" of the square root function, and \(-4\) is not in the domain of this function.
Domain The domain of a function is all the numbers that it can successfully act on. Put another way, it is all the numbers that can go into the function and have outputs assigned.
A square root cannot successfully act on a negative number. We say that "The domain of \(\sqrt{x}\) is all numbers \(\Box\) such that \(\Box^2=x\)" meaning that if you give this function zero or a positive number, it can act on it; if you give this function a negative number, it cannot. The domain is the set of all numbers \(x \geq 0\text{.}\)
A subtler example is the function \(y =\sqrt{x + 7}\text{.}\) Does this function have the same domain as the previous function? No, it does not. If you hand this function a \(-4\) it successfully hands back \(\sqrt{3}\) (about \(1.7\)). So, \(-4\) is in the domain of this function. On the other hand, if you hand this function a \(-8\) it attempts to take \(\sqrt{-1}\) and fails; \(-8\) is not in the domain of this function. If you play with a few more numbers, you should be able to convince yourself that the domain of this function is all numbers \(x\) such that \(x \geq -7\text{.}\)
You are probably familiar with two mathematical operations that are not allowed. The first is, you are not allowed to take the square root of a negative number. As we have seen, this leads to restrictions on the domain of any function that includes square roots.
The second restriction is, you are not allowed to divide by zero. This can also restrict the domain of functions. For instance, the function \(y = \dfrac{1}{x^2-4}\) has as its domain all numbers except \(x = 2\) and \(x = -2\text{.}\) These two numbers both cause the function to attempt to divide by \(0\text{,}\) and hence fail. If you ask a calculator to plug \(x = 2\) into this function, you will get an error message.
So: if you are given a function, how can you find its domain? Look for any number that puts a negative number under the square root; these numbers are not in the domain. Look for any number that causes the function to divide by zero; these numbers are not in the domain. All other numbers are in the domain. Consider the following function examples.
Function | Domain | Comments |
\(\sqrt{x}\) | \(x \geq 0\) | You can take the square root of \(0\text{,}\) or of any positive number, but you cannot take the square root of a negative number. |
\(\sqrt{x + 7}\) | \(x \geq -7\) | If you plug in any number greater than or equal to \(-7\text{,}\) you will be taking a legal square root. If you plug in a number less than \(-7\text{,}\) you will be trying to take the square root of a negative number which is not possible for real numbers. |
\(\dfrac{1}{x}\) | \(x \neq 0\) | In other words, the domain is “all numbers except \(0\text{.}\)” You are not allowed to divide by \(0\text{.}\) You are allowed to divide by anything else. |
\(\dfrac{1}{x-3}\) | \(x \neq 3\) | If \(x = 3\) then you are dividing by \(0\text{,}\) which is not allowed. If \(x = 0\) you are dividing by \(-3\text{,}\) which is allowed. So be careful! The rule is not “when you are dividing, \(x\) cannot be \(0\text{.}\)” The rule is “\(x\) can never be any value that would put a \(0\) in the denominator.” |
\(\dfrac{1}{x^2-4}\) | \(x \neq 2, -2\) | \(x\) can be any number except \(2\) or \(-2\text{.}\) Either of these \(x\) values will put a \(0\) in the denominator, so neither one is allowed. |
\(2^x + x^2 - 3x + 4\) | All numbers | You can plug any \(x\) value into this function and it will come back with a number. |
\(\dfrac{\sqrt{x-3}}{x-5}\) | \(x \geq 3\text{,}\) \(x \neq 5\) | In words, the domain is all numbers greater than or equal to \(3\text{,}\) except the number \(5\text{.}\) Numbers less than \(3\) put negative numbers under the square root; \(5\) causes a division by \(0\text{.}\) |
You can confirm all these results with your calculator; try plugging numbers into these functions, and see when you get errors!
A related concept is the range of a function.
Range The range of a function is all numbers that it may possibley produce. Put another way, it is all the numbers that can come out of the function.
To illustrate, let us return to the function \(y = \sqrt{x + 7}\text{.}\) Recall that the domain of this function is all numbers \(x \geq -7\text{;}\) in other words, you are allowed to put any number greater than or equal to \(-7\) into this function.
What numbers might come out of this function? If you put in \(-7\) you get out \(0.\) (\(\sqrt{0} = 0\)) If you put in \(-6\) you get out \(\sqrt{1} = 1\text{.}\) As you increase the \(x\) value, the output vaues also increase. However, if you put in \(x = -8\) nothing comes out at all. Hence, the range of this function is all numbers \(y\) such that \(y \geq 0\text{.}\) That is, this function is capable of handing back \(0\) or any positive number, but it will never hand back a negative number.
Domains and ranges above are sometimes expressed as intervals, using the following rules:
Parentheses \((\) \()\) mean “an interval starting or ending here, but not including this number”
Square brackets \([\) \(]\) mean “an interval starting or ending here, including this number”
This is easiest to explain with examples.
This notation... | ...means this... |
...or in other words |
\((-3, 5)\) | All numbers between \(-3\) and \(5\text{,}\) not including \(-3\) and \(5\text{.}\) |
\(-3 < x < 5\) |
\([-3, 5]\) | All numbers between \(-3\) and \(5\text{,}\) including \(-3\) and \(5\text{.}\) |
\(-3 \leq x \leq 5\) |
\([-3, 5)\) | All numbers between \(-3\) and \(5\text{,}\) including \(-3\) but not \(5\text{.}\) |
\(-3 \leq x < 5\) |
\((-\infty, 10]\) | All numbers less than or equal to 10. |
\(x \leq 10\) |
\((23,\infty)\) | All numbers greater than \(23\text{.}\) |
\(x > 23\) |
\((-\infty, 4) \cup (4,\infty)\) | All numbers less than \(4\text{,}\) and all numbers greater than \(4.\) In other words, all numbers except \(4.\) |
\(x \neq 4\) |
\([3, 5) \cup (5,\infty)\) | All numbers greater than or equal to \(3\text{,}\) and not equal to \(5.\) In other words, all numbers bigger or equal to \(3\) except \(5.\) |
\(x\geq 3\) and \(x \neq 5\) |
Why are functions so important?
Functions are used whenever the values of one variable are determined by another variable. It is a way of saying “If you tell me what \(x\) is, I can tell you what \(y\) is.” We say that \(y\) “is a function of” \(x\text{.}\)
A few examples:
In each case, there are two variables. Given enough information about the scenario, you could assert that if you tell me a value for one variable, I can tell you the value for the other. For instance, suppose you know that Alice makes \(\$100\) per day. Then we could make a chart like this.
If Alice works this many days... | ...she makes this many dollars |
\(0\) | \(0\) |
\(1\) | \(100\) |
\(1 \frac{1}{2}\) | \(150\) |
\(8\) | \(800\) |
If you tell me how long she has worked, I can tell you how much money she has made. Her earnings “depend on” how long she works.
The two variables in a function are referred to as the dependent variable and the independent variable. The dependent variable is said to “depend on” or “be a function of” the independent variable. For example, the amount of time Alice works is the independent variable and the amount she earns is the dependent variable. For the other two functions above: