Calculus question about the existence of antiderivative Let $f(x)$ be the function equal $0$ on $\mathbb R_{<0}$ and equal $1$ otherwise. Is clear to me that $f$ has derivative undefined at $x=0$. Is intuitive because the derivative would be $\infty$ as $f$ increases by $1$ in an infinitely small space. 
Now I was wondering whether antiderivative exists at $0$. My thoughts: antiderivative corresponds to area under the function. Before zero the are is always zero and after zero the area is $1$ so that like in derivative case the area increases by $1$ in an infinitely small space. But I don't know if intuition can be used in this case. 
When does antiderivatives of functions exists in general and when not?
 A: For such function does not exist any antiderivative; that is because even if $F$ is derivable with derivative discontinuous $F'$ always respect the intermediate value property, so assuming $0$ and $1$ and never $\frac{1}{2}$, $f$ is not a derivative of any function.
What exists is its definite integral, in any derivable point of this integral the derivative is the value of $f$ but such integral is not derivable in $0$ only continuous.
A: To be sure, the assertion that for any differentiable function $f: I \rightarrow \mathbb{R}$, the derivative $f': I \rightarrow \mathbb{R}$ has the intermediate value property (whether it is continuous or not!) is a theorem of J.G. Darboux.  For a careful statement and proof, see e.g. Theorem 5.30 of these notes, or consult wikipedia.
The basic idea is simple: one can reduce to the case in which $a< b \in I$, $f'(a) < 0$, $f'(b) > 0$, and one wants to show that there is a $c$ with $a < c < b$ such that $f'(c) = 0$.  In fact the conditions $f'(a) < 0$ and $f'(b) > 0$ imply that the function $f$ cannot have a minimum value at either $a$ or $b$.  Since $f$ is differentiable, $f$ is continuous and takes a minimum somewhere on $[a,b]$, hence necesssarily at an interior point $c$, and then we must have $f'(c) = 0$.
A: The two correct answers so far invoke the intermediate value property of derivatives, so I thought it might be useful to give an alternative argument avoiding that fact. Notice first that your function $f$ is (Riemann) integrable over any finite interval.  In particular, its integral from $-1$ to $x$ is $0$ for $x\leq0$ and $x$ for $x\geq0$.  If $f$ had an antiderivative $F$, then, by the fundamental theorem of calculus, $F$ would have to agree with this integral, up to an additive constant of integration.  That is, there would be a constant $C$ such that $F(x)$ equals $C$ for $x\leq0$ and equals $x+C$ for $x\geq0$.  But then the derivative of $F$ at zero doesn't exist, so $F$ can't be the antiderivative of anything. 
A: The function F(x) = 0 for x < 0, F(x) = x for x ≥ 0 is an antiderivative for the function f that you describe.  Or if you prefer F(x) = c for x < 0 and F(x) = x + c for x ≥ 0, where c is any real number. Notice that F(x) is continuous on the entire real line, but not differentiable at x = 0 (which is as it should be).
Any piecewise continuous function on the interval (a,b) will have an antiderivative there, and most of the functions you are likely to run into will be at least piecewise continuous.  To avoid having an antiderivative, the function has to avoid being piecewise continuous, which is very discontinuous indeed, but can happen.  For example, the function g(x) = 0 where x is rational and 1 where x is irrational does not have an antiderivative on the interval (a,b). 
In general integration is much more forgiving than differentiation.  That is because addition is additive, in fact is really an average, which tends to smooth things out. (That's why people use 4 week running averages to analyze trends-- they are smoother than the underlying daily data.) 
Whereas, the existence of a f'(c)  (c any number) implies that f is locally linear in the neighborhood of c.  That is, f and the tangent line to f at c are very similar in a small enough interval of c.  Obviously a function with a discontinuity cannot be locally linear at that point, nor can a function like |x| (at zero).    
A: Due to the extensive and off point discussion that followed my original answer, I want to clarify what I meant and why I see things that way.  I hope you will find this helpful and to the point.
First, if you are student, and your book defines an antiderivative of f on [a,b] as a function F for which F'(x) = f(x) on [a,b] (this is a little wrong re the endpoints, but we could fuss our way around that); and if your teacher agrees with your book; then you should do it their way until you get your A in the course.
However, this is not the only way to do things.  The main reason for defining the antiderivative in this way is so that the Fundamental Theorem of Calculus can be stated as:
$\int_a^bf(x)$ dx = F(b) - F(a) where F is the antiderivative of f on [a,b]. 
Given the above definition of antiderivative this is true and correct.  But is is unnecessary.  We can state the Fundamental Theorem as
If F(x) is a function such that F'(x) = f(x) for all x $\in$ (a,b) and F is continuous at a and b then
(1)...  $\int_a^bf(x)$ dx = F(b) - F(a) 
(which is how I learned it). Note the word "antiderivative" does not appear.  Many mathematicians use this way of stating the theorem, and you can find it in Apostol's Real Analysis.  In over 500 pages, this truly excellent book does not anywhere use the term "antiderivative".
Having severed the term "antiderivative" from the Fundamental Theorem of Calculus, we are free to define it less restrictively, and in a way that may be more useful. 
Under the restrictive definition a piecewise continuous function on (a,b), say g, such as in the original question, cannot have an antiderivative on the entire (a,b).  This can give the mistaken impression that g may not be integrable on [a,b], when nothing could be farther from the truth. It also gives rise to the kind of confusion the original question raises, as to a simple, well-behaved function not having an antiderivative. 
With the restriction removed, however, we can let F(x) be a continuous function on all of [a,b] whose derivative matches f where it exists.  Integration would proceed piecewise as implied by (1). Or we could use the term any other way that is useful.  Or not use it at all as per Apostol.
Because I never was subject to the more restrictive definition, I have always used the term "antiderivative" rather vaguely to mean something you can differentiate to get f.  I use it this way as a shortcut in my thinking, so I can proceed in a problem without getting bogged down in details. The details must, of course, be handled eventually, but that would be in the final write up of the problem.
Finally a word about definitions.  Some are so embedded in mathematics that they cannot be easily changed, and so useful we wouldn't want to.  And we don't want too much flexibility because then no one would understand what anyone else was talking about.  So a Riemann integral, a group, n! etc. all have definitions everyone agrees about.
However, there are definitions which are not in universal use.  The mathematics doesn't change, but the way people talk about it does.  It also often happens that an original definition which is in widespread use turns out to be too restrictive.  An example would be the original definition of "eigenvalue".  After awhile there was a new definition: generalized eigenvalue -- because it was needed.   
All this is a way of saying that just because something is written down in a book doesn't mean it is the best way to do things, or even that it is true. If you are taking a course you have to get your grade.  If you are trying to do mathematics you have to think for yourself.
