A function is a set of directions that tells you how to find a value from one group when given a value from a first group. An important part of a function is that every value from the first group, or "question," can only have one matched value from the second group, or "answer."
For example, if the first group is "my friends" and the second group is "birthdays," each friend in the first group can only have one birthday, so you could call this relationship a function.
Functions are most commonly used in math by writing a formula for how to find the answer:
for example, f(x) = 2x. It can also be written y = 2x. In this function, for every number "x", there is only one answer "y" or "f(x)" - which is two times the "x."
Another example of a function is
f(x) = x^2 + 2. If you try a few different numbers for x, you will see that there is only one possible f(x) for every x.
Functions don't have to have a specific equation that can describe them, as long as there is still only one matched "answer" for every given value of x.
For example, (1, 3), (2, 6), (3, 9) is a function (namely f(x) = 3x, for x = 1, 2, and 3). This is also a function, because there is only one matched value for every given x: (4, 15), (7, 21), (13, 12).
If there is an x that has more than one matched value, it is not a function.
For example: (1, 4), (2, 5), (1, 6) - this cannot be a function because when given x = 1, you can match it to either 4 or 6.
If looking at a graph, you can perform the vertical line test as a visual way to check whether every x has only one f(x). If you draw a vertical line at every point on the graph, and there is only ever one place where the graph crosses that line, it is a function. If the vertical line crosses the graph in more than one place, it is not a function.
Many students have issues with understanding what teachers or professors mean when they say a "function". The best explanation I can provide is to think of a graph with a crazy insane line that travels all over the place. A function is exactly what its name implies, if you think of that graph you at any given point on it, you're provided with both an x value and a y value. That line can be expressed using variables which can range anything from negative infinity to infinity and based on your x value, the y value will also change. I like to think of it as you're inputting one number to obtain another. If you input an x value, then you will be provided with a y value and vice versa. A line is simply a representation of someone providing an x value or even a y value and being given the opposite.
Let’s take an example,
Now, if you were given a y value you could easily solve for an x value, so let’s do just that and say you were given y is equal to 2.
Now see? You input the y value provided and were able to solve for the x value. This is the essential definition of a function in mathematics.
Formulas act the same as functions to a certain regard. Formulas are functions in which you are typically provided with all the necessary information to solve it for a value.