The p.d.f as a derivative of the c.d.f. The cumulative distribution function is defined as:
$$F(x)=P(X\le x)=\int_{-\infty}^x f(t)\,dt,$$
where $f(t)$ is the probability density function. By the fundamental theorem of calculus:
$$f(x)=F'(x)$$
I am having some difficulty with this topic. For example, suppose that I define:
$$F(x)=\begin{cases}
0,\quad x<0\\
x,\quad 0\le x<\frac12\\
\frac12x+\frac12,\quad \frac12\le x\le 1\\
1,\quad x>2
\end{cases}$$
Now, the graph appears to satisfy all of the requirements of a c.d.f.

$F$ is nondecreasing, right continuous, $\lim_{x\to-\infty}F(x)=0$, and $\lim_{x\to\infty}F(x)=1$. However, if I differentiate to try and obtain the p.d.f, I get:
$$f(x)=F'(x)=\begin{cases}
0,\quad x<0\\
1,\quad 0<x<\frac12\\
\frac12,\quad \frac12<x<1\\
0,\quad x>1
\end{cases}$$
Note that the derivative does not exist at $x=0$, 1/2, and 1.

Now, the difficulty is this:
$$\int_{-\infty}^{\infty}f(x)\,dx=\frac34$$
It does not equal one as it should. So clearly I am making some sort of mistake and some sort of misunderstanding. Either I have not created a proper c.d.f, or I am not handling the "jump" in continuity of $F$. I'm stuck.
Any thoughts?
 A: The reason why the PDF you obtained does not integrate to $1$ is because the jump discontinuity in the CDF represents a discrete probability mass at the point of discontinuity.  Therefore, it is proper to specify that $\Pr[X = 1/2] = 1/4$ for this distribution, which is partly continuous, and partly discrete.  This sort of distribution is common when we take censored or truncated continuous distributions.
In summary, the CDF and PDF are legitimate and correct.  If you want to specify the distribution of $X$ completely, then you can use the CDF as it is written; but if you specify the density, you must also include the discrete probability mass at $X = 1/2$ as a separate statement; e.g., $f_X(x) = \ldots$, and then you also should say $\Pr[X = 1/2] = 1/4$.
For example, suppose an insurer models the severity of losses $X$ due to automobile accidents among a segment of its policyholders as following an exponential distribution with mean $\mu = 500$.  These policyholders have a deductible of $250$, so if their ground-up loss $X$ is $250$ or less, they do not file a claim.  However, if the event generates losses in excess of $250$, a claim is assumed to be filed and the insurer pays the excess; i.e., $X - 250$.  Therefore, the insurer's liability is modeled by the random variable $Y = \max\{X - 250, 0\} = (X - 250)_+$.  How would we characterize the probability distribution of $Y$?  This distribution has a discrete probability mass at $Y = 0$, because $$\Pr[Y = 0] = \Pr[X \le 250] = F_X(250) = 1 - e^{-250/500} = 1 - e^{-1/2}.$$  But if a claim is generated, we want $\Pr[Y = y > 0] = \Pr[X - 250 = y \mid X > 250]$.  I leave it to you to determine what this distribution looks like.
A: The c.d.f. is indeed defined by the equality $F_X(x) = \Pr(X\le x)$.
On the other hand, your second equality, equating that with $\displaystyle\int_{-\infty}^x f_X(t)\,dt$, is true only when the the probability distribution involved always assigns probability $0$ to every set of real numbers whose measure is $0$.  Those are called absolutely continuous distributions.  In particular, it must assign zero probability to every set containing only one point, so no part of the distribution is discrete.
Defining the measure of a set is somewhat involved, but in the case of sets whose measure is $0$ it's not so involved.  The measure of a set $A$ is $0$ precisely if for every positive number $\varepsilon$, the set $A$ is a subset of some union of disjoint open intervals whose lengths add up to a number $\le\varepsilon$.
