A function like the one here is a type of equation that shows us the relationship between an input and an output value. In other words, a function applies one set of calculations to any input to produce an output. There is one output value for every possible input (this is called the "one-to-one" rule).
A function is often named 'f', and is represented by
f(x)
which is pronounced "f of x". This tells us that x represents the input value. If we are talking about the value of the function when a specific input value is used, such as an input value of 1, we will write that number inside the parentheses instead of x, like this:
f(1)
This is pronounced "f of 1". When this happens, we replace every x in the function with that number and calculate it. Here is a very simple function:
f(x) = x + 1
Let's see what happens if we input 0 for x, and try to find f(0):
f(x) = x + 1
f(0) = (0) + 1 = 1
How about f(1)?
f(x) = x + 1
f(1) = (1) + 1 = 2
f(100)?
f(100) = (100) + 1 = 101
It should be clear that this function serves to simply increase the input by 1.
Let's try a slightly more interesting function:
h(x) = 2 + 3x
I called this one 'h' (h(x) is "h of x"), but it works the same way. Let's find h(3):
h(x) = 2 + 3x
h(3) = 2 + 3(3) = 2 + 9 = 11
Now let's try h(10):
h(x) = 2 + 3x
h(10) = 2 + 3(10) = 2 + 30 = 32
So, this function is tripling the input and then adding 2 to obtain the output.
Now we know how to solve this problem. Here is our function again:
g(x) = x2 + 5x
We want to find g(-3). It may seem different, but we can do the same thing we did before even with negative inputs:
g(x) = x2 + 5x
g(-3) = (-3)2 + 5(-3) = 9 - 15 = -6
Notice that there were two x's in this function, so we replaced both of them with the input value -3.
What are these "functions"? Without some extra context, they are nothing but rules for changing an input to an output... not very interesting on its own. But in real applications, we make functions because they are useful when calculating things.
Here's an example: The area of a rectangular shed that we are building is needed so that we can figure out how much wood to buy to cover the floor. We know we want the shed to be twice as long as it is wide, but we haven't decided how wide we want it to be yet.
We can say the width is x. That means the length will be 2x.
W: x
L: 2x
The area of a rectangle is
A = WL
so we can now make a function called A(x), where x is the width and also the input for the function:
A(x) = WL = (x)(2x)
A(x) = 2x2
Now we can input different widths to see what the area of the floor will be. If we make the width 5 ft, we just need to see what A(5) comes out as.
A(x) = 2x2
A(5) = 2(5)2 ft2 = 2(25) ft2 = 50 ft2
That's not very high, so it won't be expensive... let's try 10 ft:
A(x) = 2x2
A(10) = 2(10)2 ft2 = 2(100) ft2 = 200 ft2
That's much higher, so it will be much more difficult to afford.
Since we made a function for the area, we don't have to calculate the length every time we pick a new width, we can just skip right to what the area will be by plugging any length into our function. I hope this gives you an idea why we use functions-- they aren't just pointless math rules that serve no purpose. As you learn more in math, you will discover a ton of useful things you can do with functions that can all be applied to real life situations.