I have been wondering over this basic question (seems rather trivial at first sight) for a long time:
What is the difference between a polynomial and function?
My confusion arises form the following thoughts:
- We use same notions to represent both – $f(x)$ is a polynomial or function
- The operations are quite similar. When we write $f(a)$ in a polynomial or function $f(x)$ we replace all the $x$s with $a$ and find value.
So, polynomials and functions are quite similar. So, can they be used interchangeably?
The simple answer, in the spirit of the comments, is that all polynomials are functions but not all functions are polynomials. A function is simply a rule that assigns a value in the codomain to every value in the domain. A couple simple examples of functions that are not polynomials are $\sin x$ and $|x|$. A less simple one is the Dirichlet function which is $$f(x)=\begin {cases} 1&x \text { rational}\\0&x \text { irrational} \end {cases}$$ Sometimes we view a polynomial as an expression, not as a function. Even if we do not specify the values $x$ can take, we can say $x^2-3x+2=(x-2)(x-1)$