Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When I say functions, I don't mean the trigonometric functions like $\sin$, $\cos$, and $\tan$, I mean defined functions like $f(x) = 2x + 4$. Why is $f(x)$ used and why isn't a single variable defined as to be equal to $2x + 4$? For instance, $n = 2x + 4$ where $x$ is defined elsewhere, say as $5$, in the same way as you'd define $x$ in the function as 5: $f(5)$. I mean to say what is the difference between these two methods that functions are used at all?

share|cite|improve this question
"Why is $f(x)$ used?" - because we like being able to indicate the dummy variable that we can always replace with a number or something else. As for sidestepping the need to indicate the dummy variable, you might be interested in the $\lambda$-calculus. – J. M. Feb 11 '12 at 14:25
Lol J.M.. Really? I don't think OP thought of something like lambda calculus while asking this question... – Patrick Da Silva Feb 11 '12 at 14:29
@Pat: sure, I just mentioned that people think about these things seriously. – J. M. Feb 11 '12 at 15:03
up vote 8 down vote accepted

The most basic benefit of having a concept of function is that it allows us to use the same function more than once in an expression with different parameter values.

For example, we could be working with two variables: $x$ is the number of days since new year's, and $y$ is the number of questions on Math.SE. Suppose we want to figure out the average number of new questions per day in February. We don't know the actual values yet (February isn't over), but we can aim to write down a formula that tells us what to do once we have the numbers. Then we need to subtract the number of questions on February 1 from the number of questions on March 1 and divide it how many days came in between. However, those two numbers of questions are both values of $y$, so if all we have is the naked variables we end up with something $\frac{y-y}{29}$ which is nonsense (or more precisely doesn't make the sense we'd like it to).

However, if we define a function $f$ by "$f(x)$ means the $y$ corresponding to day $x$", we can now write the average as $\frac{f(60)-f(31)}{29}$ which then tells us unambiguously what to do.

Alternatively, we could invent some sort of notation for using different "instances" of the same variable in a formula, something like $\frac{y_{x=60}-y_{x=31}}{29}$ -- but once we're done making that precise enough to satisfy the demands of being exact and useful in proofs, we would find that we had essentially reinvented the function concept.

More benefits. Now that we have a concept of function, we can use it to recognize similarities. If we have four variables $x$, $y$, $z$, $w$, and it turns out somehow that there is a function $f$ such that $y=f(x)$ and $z=f(w)$ for all corresponding values of the four variables, this tells us an interesting thing about the variables, namely that the relation between $x$ and $y$ is the same as the relation between $w$ and $z$. Such observations can sometimes allow us to make much quicker conclusions than if we didn't have a way to speak/think about the commonality.

Also, once we're used to thinking of functions as things in themselves, it turns out to be enormously beneficial for expressing mathematical thoughts that we can name functions, and define adjectives for properties that a function may have or not have. Since mathematics can get very complex, every trick that allows us to speak about it shorter and clearer is worth grabbing at.

share|cite|improve this answer

Functions are one of the most basic tools in mathematics. There are important properties of functions which are EXTENSIVELY studied, such as injectivity/surjectivity, continuity, differentiability, integrability, convexity, analyticity, and I'm skipping a thousand more...

When doing relatively useful mathematics above the level of the common human being, functions become an essential tool.

Another reason why one would define a function is because there is a difference between defining $y = |x|$ and $f : [0,1] \to \mathbb R$ with $f(x) = |x|$. In the first case, I know nothing of where does $x$ comes from ; in the second case, I can say that $f$ is differentiable, even though in general we don't say that $|x|$ is differentiable everywhere. My point is that defining the function tells us more about its properties, where defining a variable equal to what "we want the function to be valued" does not tells us such information.

EDIT : One of the comments made me want to introduce you to how we define a function ; suppose we want $f(x) = 2x+4$. It is not enough in mathematics to write one such formula ; $x$ could come from any ring for all I care, the only thing we need here is a multiplication and addition operation for this function to make sense from some set $A$ to another set $B$ : a priori, any set $A$ and $B$ such that $f : A \to B$ with $f(x) = 2x+4$ where $2, 4 \in B$ makes sense is a well-defined function.

That is why that mathematicians need to specify where does $x$ come from and where does it go to. This is exactly what we do when we say $f : A \to B$, i.e. $x$ is in $A$ and $f(x)$ is in $B$ ; we also say that $f$ maps $x$ to $f(x)$. Here the domain of $f$ would be the set $A$ and the image of $f$ would be the set $B$. My example above says that $x$ comes from the interval $[0,1]$ and gets mapped into the real numbers. The domain is not the only important part : the image is also important. For instance, $f(x) = x$ is injective if I say $f : [0,1] \to \mathbb R$, but it is also bijective if I say $g : [0,1] \to [0,1]$ with $g(x) = x$. In both cases I said $f(x) = x$ and $g(x) = x$, but $f$ and $g$ are different functions since they don't have the same image ; furthermore, one is surjective, the other one is not.

Hope that helps,

share|cite|improve this answer
Sure does help. I'm in 11th grade and I was just introduced to this. – David Feb 11 '12 at 14:31
Do you understand what I mean by "differentiable" then? Perhaps my example would not have been pertinent if you didn't. – Patrick Da Silva Feb 11 '12 at 14:32
Yes, I know what you mean by that. But I don't get what $f : [0,1] \to \mathbb R$ what the semi-colon, arrow and $\mathbb R$ is... – David Feb 11 '12 at 14:34
That's exactly how you define a function! You speficify its domain, its image and then say where does $x$ gets mapped to. – Patrick Da Silva Feb 11 '12 at 14:37
@David: it's just a conventional syntax to denote functions. You write: "function_name" ":" "domain" "arrow" "image". This convention looks odd at the beginning but has its advantages. – Andrea Mori Feb 11 '12 at 15:18

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.