A write-up of functions to try to teach my 11 year old cousin John more advanced math for his age.
read moreOne of the most commonly encountered object in mathematics is the function. A function is an operator; it’s a “do-er". If you give a function something, it’ll spit something else out. It can be related to a gum ball machine: you put in a quarter, and you get out a gum ball. That’s a relatively simple function, but a function nonetheless. An even more simple function is one that returns what you put in: let’s say that when you put a quarter into a metal contraption around the height of Celia, it spits a quarter back out at you. We can think of this metal contraption as a function: it takes in something, and spits something out. In mathematics, we say that the function takes in an input and returns an output. In the case of our metal contraption, it takes in a quarter and returns a quarter. So, its output and its input are the same. These are relatively boring functions, but it’s important to understand things in the simplest of cases first. Now, we denote (show using symbols) these functions as f(x)=y, where f is the function and it’s operating on whatever is in the parentheses, x, and it’s spitting out whatever is on the other side of the equal sign, y.
Now, in the case of our contraption, where f denotes (represents) our contraption, we would say f(quarter)=quarter, because we put a quarter into the contraption and we get out a quarter. Now, let’s say we modify our contraption to spit out two quarters when we put in one quarter. That means f(quarter)= 2 quarters. Let’s say we modify again to give us a dime when we put in a quarter. That means f(quarter)=dime. Another way of saying this (and there are many) is that a dime is what we get after we apply our function, f, to a quarter. Now, we can get a bit more complex: let’s say that when you put a quarter into this machine, you get a dime. But, when you put a dime in the machine, you get a quarter. We can write this as f(quarter)=dime and f(dime)=quarter, which means that f can be applied to either a dime or a quarter.
Now, let’s step away from money and metal contraptions and move on to numbers. Let’s say we want to make a function that adds 1 to whatever number we give it. This is new to us because we’re saying whatever I give this function (or number machine, metal contraption, however you want to think about it) I will get what I put in +1. Prior to this, we limited what we could be put in (also called domain) to dimes and quarters. Now, we’re saying it could be anything. Of course, it doesn’t make much sense to add 1 to a cat, so we’re going to limit what we can put in (limit our domain) to numbers. We need something new to do this, it’s called a variable. A variable can represent anything, but in this case, it represents a number. We can write our function as f(x)=x+1. In words (and it’s very important to understand math in words), this means that we give f a number, x, and it gives out our number +1. Another way of saying this is that, when we feed in x, we get out x+1. Or, when we apply f to x, we get x+1. Now, remember x is just a placeholder; it only represents something when we assign it a value. So, let’s do just that: let’s say x=1. Well, when we apply f to x, we get x+1, so when x is 1, we get 1+1 or 2. That means that f(1)=2. We commonly call this “plugging in 1 for x”, which just means that we’re replacing all of our x’s with 1s. We can do this with any number, f(3)=4, f(100)=101, f(0)=1.
Challenge Question: Can you write me a function that doubles the number you put in?