What is a Function: Basics and Key Terms
Mapping numbers sounds complex, but we do it when we buy gasoline. We pump gasoline, and the gas station charges us based on the amount of gas that we pump. Learn how this relates to functions while reviewing the basics and notations in this lesson.
Basics of a Function
Would it surprise you to know that one of the most important pillars of calculus is something that you use every day? Functions are fundamental to calculus, but you have been using them your entire life. Formally, functions map a set of numbers to another set of numbers. So what does this mean?
Say we have a black box, and we're going to call this our function. If you put in the number 4, you might get out the number 8. If you put in the number 5, you might get out the number 16. For each number that you put in, say x, you'll get out another number, say y. Now sometimes you can put in two different numbers - let's say 4 and 22 - and get out the same number, say 39. But at no point in time will you put in one number and get two different numbers out. This may sound complex, but it's really just saying stuff you already know.
Functions in our Daily Lives
For example, you use functions every time you go to the gas station. The amount of money that you pay a gas station depends on the amount of gas that you pump. Put another way, the amount of gas that you pump determines the number of dollars that you pay. Let's say gas is $3.80 a gallon. If you're going on a long road trip, you might need 10.2 gallons. If you pump 10.2 gallons and gas is $3.80 a gallon, the gas station is going to charge you $38.76. If you're just running across town and only need 2.3 gallons, the gas station is only going to charge you $8.74. Of course, depending on your car, you may need more or less gas, and the station is going charge you based on the amount of gas that you take.
How they determine the amount to charge is very simple. They use a function that maps the number of gallons that you pump to the number of dollars that you need to pay. Specifically, we say that number of dollars you pay is a function of the amount of gas you buy.
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.