# Function Basics

Functions are mathematical ideas that take one or more variables and produce a variable. You can think of a function as a cook that takes one or more ingredients and cooks them up to make a dish. depending on what you put in, you can get very different things out. Moreover, not all functions are the same. If you give one cook peanut butter, jelly, and bread, he may make a sandwich, whereas another cook may start to sculpt a volcano with the peanut butter, and use the jelly for lava after discarding the bread.

In an abstract Mathematical sense, a function is a mapping of some domain onto some range. For each item in the domain, there is a corresponding item in the range of the function. Thus the domain is all of the possible inputs to the function and the range is all of the possible outputs. Each item in the domain corresponds to a specific item in the range. However, an item in the range may correspond to multiple items in the domain.

For example, let's describe a function for album titles. Our function will take as its domain, album titles. Our function, let's call it FL(album_title) will output the first letter of the first word in the title of the album. Thus the range of our function will be all of the letters in the alphabet. (I'm pretty sure that you can find an album for each letter of the alphabet, right?) Here are some examples of our function at work.

Album TitleFL(Album Title)
What's The Story, Morning Glory?W
Achtung Baby A
The Piano Rollls3 T
Piano Man P
August and Everything After A
Collective Soul C
1812 Overture ???

For each album title (left) there is a corresponding FL(our album title) from the range of FL(album_title). As you can see, the function can get the same value in the range for two different inputs. But what about the good old 1812 Overture? Because the first word - "1812" - does not start with a letter, our function cannot handle it. Thus it is out of the domain of our function. Hence, the domain of FL(album title) is all album titles that begin with a letter.

Onto the math!
 Higher Math Note! For most of Algebra, functions are described as things that take a number and put out a number. In higher mathematics, this is described as R1 R1. This means that the real number line (R1) is being mapped to the real number line. If however, we have two inputs and one output, we have a function that is described as R2 R1, or the real plane(R2) is being mapped to the real number line. Generally, we can have a function described by any R N R M. We can even have functions in the complex plane, which is where much of Chaos comes from!

Let's start with an old favorite - the line.
f(x) = 2*x
Here, f is a function that is defined to take one variable - x. It takes that one variable and doubles it. We can plot this graph on a cartesian grid by taking x along one axis and f(x) along the other. Because f(x) is simply a constant, that is the number 2, multiplied by x, we know that f(x) is a line. Assuming that we are totally ignorant, let us proceed as though we know nothing at all. To draw a function that is new to us, here is what we normally will do (at least to begin with): We will construct a table. In one column, we will list various values for x that we would like to try to see what comes out. In the other column, we will list the values of f that we get when we stuff our values into the function. Next, on a piece of grid paper, we will plot the points, going over on the x-axis to the number we chose for x, and on the y-axis to what we got out for f(x). Finally, we will connect the dots for a rough view of what our function looks like. (More complex functions need lots of dots!) For f(x)=2*x, here's what we get:

x f(x)
-2 -4
-1 -2
0 0
1 2
2 4
3 6
4 8

Let's move on to the parabola. A basic parabola formula is: f(x) = x2. Let us try several values to plop into the function to see what comes out:

x f(x)
-4 16
-3 9
-2 4
-1 1
0 0
1 1
2 4
3 9
4 16

Most of the time, functions come out with nice looking smooth curves. So, if instead of using straight lines to connect out dots, we use a smooth curve, we can get a better approximation of what the function looks like. Hence, the proper parabola looks like the following:

-David