# What's a function?

Feb 13, 2017

#### Explanation:

A function is a rule which maps values of a variable into another variable. The first variable is the input, which when put in the rule, (in mathematics, this rule is defined by a mathematical formula ) results in another variable, which is the output.

These rules are generally described as say $\textcolor{b l u e}{y} = \textcolor{b r o w n}{f \left(\textcolor{red}{x}\right)}$,

where $\textcolor{red}{x}$ is input, $\textcolor{b l u e}{y}$ is output and $\textcolor{b r o w n}{f \left(\right)}$ is the rule or formula. What it literally means is that when we take an input value $\textcolor{red}{x}$ and put it in the rule $\textcolor{b r o w n}{f \left(\right)}$, we get the output $\textcolor{b l u e}{y}$.

For example let $\textcolor{b r o w n}{f \left(\textcolor{red}{x}\right)} = {x}^{2} - 3 x$,

if we have input $x = 0$ we get $y = {0}^{2} - 3 \times 0 = 0 - 0 = 0$ and

if $x = - 5$, we get $y = {\left(- 5\right)}^{2} - 3 \times \left(- 5\right) = 25 - \left(- 15\right) = 25 + 15 = 40$

and if $x = 5$, we get $y = {5}^{2} - 3 \times 5 = 25 - 15 = 10$

Hence, for different values of input, we get different values of output, which is decided by the rule or the matemaical formula.

The input variable is called independent variable and the output variable is called the dependent variable.

The values that input variable or independent variable can take is called domain and values that output variable or dependent variable can take is called range.

Generally names of variables are represented by alphabets such as $x , y , u , v , w$ etc. and rules or formulas are represented by $f , g , h$ etc.

The rules or formulas could be simple linear or quadratic functions, polynomials, algebraic functions (more like fractions with polynomials as numerators and denominators), trigonometric functions, exponential functions etc.

A function is a rule we apply to an input and which produces a single result.

#### Explanation:

A function is simply a rule that we apply to an input (could be a number, could be a variable, could even be another function).

Let's look at how functions are written: $f \left(x\right) = \text{the rule}$. The letter $x$ within the $f \left(x\right)$ tells us that this is the input, and $f \left(x\right)$ simply means "perform this operation for each value of $x$".

So let's say that the rule is $x + 2$. We'd write the function notation as $f \left(x\right) = x + 2$ - and all this means is that each time I input a value for $x$, the rule is going to increase that value by 2. And so, as an example, let's just input a few values into our function:

$\left(\begin{matrix}\underline{x} & \underline{f} \left(x\right) \\ 1 & 3 \\ 0 & 2 \\ - 1 & 1\end{matrix}\right)$

Functions can get more and more complicated, as can the values that are inputted. But the basic rule still applies - input a value, get a value out.

There is one thing to note about the value in/value out thing - we want a single value to come out from any value we put in. If we get more than one value, the rule suddenly isn't a rule - it's more of a list of possibilities. And so if we get more than one value, it isn't a function.

This is where the vertical line test comes in - if we graph our function (which we can do - the $x$ values correspond to the x-axis and the $f \left(x\right)$ values correspond to the y-axis), we can draw vertical lines on the graph. If we run into one line - good. More than one? Bad.

Here's our original example$f \left(x\right) = x + 2$ in graphical form:

graph{x+2 [-10.04, 9.96, -3.16, 6.84]}

I can draw vertical lines and encounter only one value:

graph{(y-(x+2))(y-1000x+1000)=0 [-10.04, 9.96, -3.16, 6.84]}

But if I have a graph that looks like this:

graph{(y-sqrtx)(y+sqrtx)=0 [-5, 9.96, -5, 6.84]}

The vertical line test will fail - and therefore the graph isn't a function:

graph{(y-sqrtx)(y+sqrtx)(y-1000x+1000)=0 [-5, 9.96, -5, 6.84]}