Variables in a Function
You know the number of gallons that you're going to buy; you know an x variable. This is your independent variable. What you want to know is the amount of dollars that you're going to pay, the y variable. This is dependent, because it depends on the number of gallons that you buy. One way to put this mathematically is that the dollars you pay is a function of the gallons you buy, just like we said before. But let's write this out in math terms: The dollars you pay (y) is (that's math speak for 'equals') a function (f for function) of the gallons that you buy (x). So y= f(x). Generally, a function is written with input variables in these parentheses.
In the case of our gas station, we really know what the function is. We go to the gas station and pump some amount of gas. Because you've probably gone to the gas station before, you know that the number of dollars that you're going to pay is equal to the amount of gas that you pumped times the price per gallon. So if gas is $4 per gallon, then we write y is equal to 4 times our input, which is the number of gallons we pump: y=4x. If we pump 4 gallons of gas, we plug this into our function, 4 * 4, and that's 16. We would owe $16. So an important point here is that when we say y=f(x), that's good for any value of x. We're using x as a variable here. If we say y=f(5), we're evaluating this function using x=5.
Imagine going to the gas station, and instead of pumping 4 gallons of gas and owing $16, you try to give gas back to the gas station. Now I don't know about you, but when I've tried to do that, the gas station attendant usually just laughs at me, because he and I both know that the amount of gas that I can pump (the input to our function) has to be greater than zero. The minimum amount of gas I can pump is zero, and if I go to the gas station and pump zero gallons of gas, the gas station just gets annoyed. But there is no maximum amount, practically speaking. The output of our function will be between zero and infinity.
Domain and Range
All possible inputs to our function is known as the domain. The domain are those values that you can put as input (as the x variable) into the function.
The output - all possible values that you can get out of your function - are known as the range. In this case, the range is the amount of dollars that you could expect to spend at the gas station.
So if I go back to the black box, we're going to write our function a little more formally now as y=f(x). The inputs to our black box are now the x values that make up the domain, and the output - something within the range - are our y values. Mathematicians will sometimes write like this, where now you've got basically two sheets of paper, in a sense, facing one another. On one side you have a domain - you have a function - and the second sheet of paper is the range.
What about the function sine of x? The function sin(x), I will write as y is some function of x and that function is actually sin(x), so y=sin(x). What about the domain and range of this function? The domain are all possible values of x that you can put into this. If you go your calculator, you know that you can put anything into sin(x), so the domain is all values from minus infinity to infinity. What about the range? Well the range is all possible values of y. If we graph sin(x), you can pretty easily see that the maximum value is going to be 1 and the minimum value is going to be -1.
So writing y=sin(x), we know that y has to be between -1 and 1. That means that the range of sin(x) is going to be between -1 and 1. So the range corresponds to the y value, this vertical axis, and the domain corresponds to the x values, this horizontal axis. One last thing: What about the domain and range of this function?
First, let's take a look at what this function means. What this means is for values of x that are less than zero, our function, f(x), equals sin(x). If I graph this out, anything that's less than zero is going to be sin(x); it's going to continue on. For values of x that are greater than zero, f(x) is going to be equal to x, so it's going to look like this. An important point to note here is that there is no value assigned at x=0, so I'm going to put a circle there because it's undefined.