Is it necessary that every function is a derivative of some function? I thought about this a lot and consulted a lot of people but everyone had contradicting answers. I am a high school student. please help.
 A: No, not at all. For instance, consider the function
$$f(x) = \begin{cases} 1 & \text{if $x$ is a rational}\\ 0 & \text{otherwise}\end{cases}$$
A: Good question. The answer is no.
Many functions are derivatives, though: For example, any continuous function. The fundamental theorem of calculus gives us that if $f$ is continuous, and $F$ is defined by $$ F(x)=\int_0^x f(t)\,dt, $$ then $f$ is the derivative of $F$. 
However, derivatives do not need to be continuous. But they are not arbitrary. For instance: None of their discontinuities are jump discontinuities. For example, if $h$ is defined by $h(x)=0$ if $x\ne0$ and $h(0)=1$, then $h$ is not a derivative. (The reason for this is a theorem of Darboux, showing that derivatives satisfy the intermediate value property.)
Perhaps more interestingly, if $f$ is given by $f(x)=\sin(1/x)$ if $x\ne0$ and $f(0)=0$, then $f$ is a derivative. However, if $g$ is given by $g(x)=\sin(1/x)$ if $x\ne0$ and $g(0)=1$, then $g$ is not. The function $f$ is discontinuous at $0$. Here you can see a graph and some additional information. The (wildly oscillating) behavior of $f$ near zero is typical of any discontinuity that is not a jump discontinuity.
This answer has additional examples and details (some of it is technical).
Derivatives are the (pointwise) limit of continuous functions: If $f$ is differentiable, and we define $f_n$ by $$ f_n(x)=\frac{f\bigl(x+\frac1n\bigr)-f(x)}{\frac{1}{n}}=n(f\left(x+\frac1n\right)-f(x)), $$ then each $f_n$ is continuous, and $\lim_{n\to\infty}f_n(x)=f'(x)$ for all $x$.
There are many functions that are not the limit of continuous functions, none of them are derivatives. Analysts have defined a hierarchy of functions: Baire class zero functions are continuous functions. Baire class one functions are limits of continuous functions. Baire class two functions are limits of Baire class one functions, etc. All derivatives are in Baire classes zero and one. Any function in Baire class two or beyond, but not in Baire class one, is not a derivative. Here are some examples.
This answer has some additional information (mostly technical). In particular, the answer mentions that in a sense, most functions are not derivatives: Given any set $X$, the size of the set $Y$ of all functions $f:X\to X$ is strictly larger than the size of $X$. Here I am using the set theoretic notion of size (cardinality) that makes sense even for infinite sets. It turns out that there are exactly as many continuous functions as there are real numbers and, again, there are as many pointwise limits of continuous functions as there are real numbers. This means that there are as many derivatives as there are reals. However, there are many more functions $f:\mathbb R\to\mathbb R$ than there are reals, so many functions are not derivatives, just based on this consideration.
The question of precisely what functions are derivatives is a difficult one, without a satisfactory answer. Mathematical analysts still do research on this topic. This article (Andrew M. Bruckner. Derivatives: Why they elude classification. Math. Mag., 49 (1), (1976), 5–11.) should be more or less accessible, and explains some of the difficulties in this area. 
A: The Fundamental Theorem of Calculus tells us that every continuous function is the derivative of something, but there are many functions which are not continuous, and not derivatives. There are also some functions which are not continuous, but they are still derivatives.
There is a theorem by Darboux, which says that any derivative has the intermediate value property. This allows us construct many functions which are not derivatives. 
For example $F(x)=1$ when $x$ is rational and $F(x)=0$ when $x$ is irrational, is not a derivative.
A: A simple example of a real function, which does not have an antiderivative, is the function
$$f(x)=
  \begin{cases}
    1 & x=0, \\
    0 & \text{otherwise}.
  \end{cases}
$$
It follows from Darboux's theorem that this function is not a derivative, but we can show this even without using Darboux's theorem:
Suppose that there exists a function $F(x)$ such that $F'(x)=f(x)$. Since $F'(x)=0$ for $x>0$ we get that $F(x)$ is constant on the interval $(0,\infty)$, i.e. there exists some $c_1$ such that $F(x)=c_1$ for each $x>0$. The same argument shows that $F(x)=c_2$ for $x<0$. Since every differentiable function is continuous, we get that $F(0)=c_1=c_2$. From this we get $F'(0)=0\ne f(0)$, a contradiction.
