Example of vector space In almost all the literature that I have seen, one of the examples of vector space is as follows:

Set of all real-valued functions $f(x)$ defined on the real line

what confuses me here is that the word "linear functions" should be used instead of just "functions" because I think we also have non-linear functions and they (non-linear functions)do not follow the rule of addition and multiplication as:
$ (f + g)(x)=f(x) + g(x) $ and $(kf)(x) = k f(x) $
thus, non-linear functions cannot make a vector space.
am I right or wrong?
 A: You're confusing adding the functions with adding their inputs.
A linear function would have the property $f(x+y) = f(x) + f(y)$. However, for a vector space, you add the functions. For example, let $f(x) = x^2$ and $g(x) = x^3$, then $(f + g)(x) = f(x) + g(x) = x^2 + x^3$.
A: The functions do not need to be linear. You are confusing the fact that $f(x+y)=f(x)+f(y)$ only holds for linear functions, but this is not required here. What is meant is that the sum of two functions (not the sum of the arguments!) $f$ and $g$ is the function $(f+g)(x)$, which is given by $f(x)+g(x)$.
A: You can have non-linear functions in the vector space. Why do you say that $(f+g)(x) = f(x) + g(x)$ and $(kf)(x) = kf(x)$ are not true for non-linear functions? This is how one defines addition of the vectors and multiplication with scalars. One can for instance have the vector space of continuous functions on some space.
Maybe you are confusing it with $f(kx) = kf(x)$ and $f(x+y) = f(x) + f(y) $?
A: I think you're confusing stuff: one thing is the vectors in the linear (vector) space, which in this case are real functions, and way another is the kind of function you can define on this vector space that will keep the vector space structure defined, and these are linear functions.
Thus, $\,f(x)=|x|\;,\;g(x)=-1.5\;,\;h(x):=x-\cos(x+1)+e^x\,\ldots\;$ are examples of vectors (real functions), and an example of linear functions (better known as linear transformations) on this vector space could be
$$T(f(x)):=f(0)\;,\;\;T:V\to\Bbb R$$
A: You are confusing the definition of vector spaces and that of of linear maps between vector spaces. A linear map is compatible with the vector space structures at it input and output, but in defining a vector space of real valued functions, it is irrelevant what kind of domain they are defined on; the vector space nature comes from the fact that the output are real values, which can be added and multiplied by real numbers. You might just as well (and maybe less confusingly) consider the real valued function on $[0,1]$, or on the positive integers, neither of which has a vector space structure so that such function being linear is not even meaningful. Indeed if you take real valued functions $f$ on the finite set $\{1,2,3\}$, then  such an $f$ is completely determined by the triple $(f(1),f(2),f(3))$, and for the sum $f+g$ and scalar multiple $\lambda*f$ the triples would be $(f(1)+g(1),f(2)+g(2),f(3)+g(3))$ respectively $(\lambda f(1),\lambda f(2),\lambda f(3))$, which should remind you of another example of a vector space you have no doubt seen.
A: A linear function is a function $f$ such that $f(ax+by)=af(x)+bf(y)$, the definition of addition and scalar multiplication in the vector space you describe doesn't say anything about this expression. We simply define addition of two real valued functions, and the scalar multiplication of a real valued function to be as you describe.
