What is the connection between density and distribution function? X is a r.v. with distribution function_
$$F_X(x)=\begin{cases} 0 & x< 0\\ \frac{x}{2} & 0\leq x<1 \\\frac{1}{2} & 1\leq 
 x<2 \\ \frac{3}{4} & 2\leq x <3 \\ 1 & x\geq 3 \end{cases}$$
It has density 
$$f(x)=\begin{cases} \frac{1}{2} & 0\leq x <1 \\ \frac{1}{4} & x=2,3 \end{cases}$$
Im just wondering how they got the result of the density.
Im kinda confused on the relation between density and distribution function. There is a definition stating that if:
$$F_X(x)=\int_{-\infty}^x f_x(u) d\mu(u) $$ Then $f_x$ is the density of X. Did they use this definition to get the density functions in those two cases, or is it something trivial that im missing?
 A: Here is a graph of your two functions plus a third graph, the "pseudo" inverse of $F$.

Take a look at the top graph, the graph of the density function $f$.
Since the second graph, $F$ purports to be the integral of of $f$, imagine a vertical line moving to the right along the graph of $f$ begining at the $y$-axis.
The area under the graph of $f$ and to the left of the moving vertical line will increase at a constant rate from a value of 0 to a value of $\frac{1}{2}$ which is what we see happening in the graph of $F$ on the interval $[0,1]$.
When the moving vertical lines crosses the gap between $1$ and $2$ there is no increase in the area accumulated so far, so it remains fixed at a value of $\frac{1}{2}$ which, again, is what we see in the graph of $F$.
But when the moving line gets to $2$ the probability has an instantaneous increase of $\frac{1}{4}$. This can be a bit perplexing because we are using the idea of "area" but how can this increase the "area"? This is a perfectly legitimate question. But remember we are using the graph as a model of probability, and the probability does suddenly increase by an amount of $\frac{1}{4}$ so this fact must be represented in the graph of $F$: the graph of $F$ has a discontinuity at $x=2$ and instantaneously increases by $\frac{1}{4}$.
As the moving vertical line crosses the gap in $f$ on the interval from $2$ to $3$ there is no further increase, so the graph of $F$ remains constant at a value of $\frac{3}{4}$ on that interval.
When the moving vertical line on $f$ gets to $3$ there is a final increase in probability of $\frac{1}{4}$ and the graph of $F$ has another discontinuous increase of $\frac{1}{4}$ to a value of $1$, and there it remains.
I have added a third graph labeled $F^{-1}$ as a bonus.
Suppose one picks a uniform random variable $X\in[0,1]$ on this third graph. Then the random variable $Y=F^{-1}(X)$ will equal $2$ with a probability of $\frac{1}{4}$ and will equal $3$ with a probability $\frac{1}{4}$, otherwise it will be uniformly distributed on the interval $[0,1]$ with a probability of $\frac{1}{2}$.
So the random variable $Y$ has probability density function $f$.
A: This is an extended comment, I think John has posted what the OP actually wants. There is a usual way to make sense of $f$ as a density.
If you want to be pedantic, $f$ is the "density" (Radon-Nikodym derivative) of the distribution with respect to the measure $\mu=\nu_{[0,1]}+\delta_2+\delta_3$, where:


*

*$\nu_{[0,1]}$ is the Lebesgue measure on $[0,1]$

*$\delta_a$ is a discrete measure concentrated at $a$ where for some Borel set $S$, then $\delta_a(S)=1$ if $a\in S$ and $\delta_a(S)=0$ otherwise.


For this $\mu$ the integral characterization $P(S)=\int_Sf(u)d\mu(u)$ works again. 
I would not unconditionally call the $f$ they got a 'density' without also specifying that it is against the above $\mu$.
A: Densities are linked with underlying measures.
Is the function $f$ mentioned in your question a density of the distribution function mentioned in your question?
Yes, but this only if the underlying measure is a very peculiar one.
An example (there are more) is the measure $$\mu:=\lambda+\delta_2+\delta_3\tag1$$ where $\lambda$ denotes the Lebesgue measure and for constant $c\in\mathbb R$ measure $\delta_c$ is prescribed by $A\mapsto1_A(c)$.
Then $$\begin{aligned}\int_{-\infty}^{x}f(u)\mu(du) & =\int_{-\infty}^{x}f(u)(\lambda+\delta_{2}+\delta_{3})(du)\\
 & =\int_{-\infty}^{x}f(u)\lambda(du)+\int_{-\infty}^{x}f(u)\delta_{2}(du)+\int_{-\infty}^{x}f(u)\delta_{3}(du)\\
 & =\int_{-\infty}^{x}f(u)\lambda(du)+f(2)1_{(-\infty,x]}(2)+f(3)1_{(-\infty,x]}(3)\\
 & =\int_{-\infty}^{x}f(u)\lambda(du)+\frac{1}{4}1_{(-\infty,x]}(2)+\frac{1}{4}1_{(-\infty,x]}(3)\\
 & =\int_{-\infty}^{x}1_{\left[0.1\right)}\left(u\right)+1_{\left\{ 2,3\right\} }\left(u\right)\lambda(du)+\frac{1}{4}1_{(-\infty,x]}(2)+\frac{1}{4}1_{(-\infty,x]}(3)\\
 & =\int_{-\infty}^{x}1_{\left[0.1\right)}\left(u\right)\lambda(du)+\frac{1}{4}1_{(-\infty,x]}(2)+\frac{1}{4}1_{(-\infty,x]}(3)\\
 & =F_{X}\left(x\right)
\end{aligned}
$$
If some function gets the predicate of density of distribution then - unless stated otherwise - it will be a density with respect to the Lebesgue measure. 
Using peculiar measures like $(1)$ in most cases makes no sense and causes confusion. You are the living proof of that.
