# What is the cdf for a partially non-continuous pdf?

Suppose there is a pdf/pmf (?!) which places an atom of size 0.5 on x = 0 and randomizes uniformly with probability 0.5 over the interval [0.5,1].

Such that...

$$f(x)= \begin{cases} 0.5, & \text{if}\ x=0 \\ {1\over (1-0.5)}, & \text{if}\ 0.5 ≤ x ≤ 1 \\ 0, & \text{otherwise} \end{cases}$$

Does the corresponding cdf then look like the following?

$$F(x)= \begin{cases} 0.5, & \text{if}\ x < 0.5 \\ 0.5+0.5\cdot{(x-0.5)\over (1-0.5)}, & \text{if}\ 0.5 ≤ x ≤ 1 \\ 1, & \text{if}\ x > 1 \end{cases}$$

And how to calculate the expected value of this cdf formally? I suppose that $$E(x)={3\over 8}$$ ...but I dont know exactly how to formally deal with the intervalls as f(x) is not continuous.

You can describe the probability density of this using the Dirac delta, viz. $\int_\mathbb{R}\delta(x)g(x)dx=g(0)$. In your case, $f(x)=\frac{1}{2}\delta(x)+1_{[\frac{1}{2},\,1]}(x)$. The second term is an indicator function, and integrates to the half of the probability the delta term doesn't cover; your $\frac{1}{1-0.5}$ factor is unnecessary. Notice I said probability density, not probability density function, because no function has the defining properties of $\delta$. (If you want some terminology, it's a measure. The popular name "Dirac delta function", used in the above link, is misleading.)

Integrating gives the CDF $\frac{1}{2}\Theta(x)+(x-\frac{1}{2})(\Theta(x-\frac{1}{2})-\Theta(x-1))$, where $\Theta(y):=\int_{-\infty}^y\delta(z)dz$ is called the Heaviside step function, which really is a function. (Wikipedia denotes it $H$, but I've often seen people use $\Theta$ or $\theta$.) Equivalently, $\Theta\left(z\right):=\left\{ \begin{array}{cc} 0 & z<0\\ 1 & z\ge0 \end{array}\right.$. The CDF is $$\left\{ \begin{array}{cc} 0 & x<0\\ \tfrac{1}{2} & x\in\left[0,\,\tfrac{1}{2}\right)\\ x & x\in\left[\tfrac{1}{2},\,1\right)\\ 1 & x\ge1 \end{array}\right..$$

• How does your answer change (especially the resulting cdf) if the probability density randomizes uniformly over the interval [(1/3),1] with probability 0.5, ceteris paribus? – Moritz Sch Aug 11 '18 at 18:42
• @MoritzSch The PDF (CDF) would be $\frac{1}{2}\delta(x)+\frac{3}{4}1_{[\frac{1}{3},\,1]}(x)$ ($\frac{1}{2}\Theta(x)+\frac{3x-1}{4}(\Theta(x-\frac{1}{3})-\Theta(x-1))$). – J.G. Aug 11 '18 at 18:45
• Thank you! I see, I have to read up about Dirac delta, to understand this. – Moritz Sch Aug 11 '18 at 19:14
• Also I've realised these CDF formulae of mine simply won't work after $x=1$. – J.G. Aug 11 '18 at 19:29

In what sense this is a density function will bear examination. Normally one says $f$ is a probability density function for the distribution of a random variable $X$ if $$\Pr(a<X<b) = \int_a^b f(x) \, dx$$ for all values of $a,b.$ But $\displaystyle \int_a^b \cdots\cdots\,dx$ means an integral with respect to Lebesgue measure, which is the measure that assigns to every interval $(c,d),$ for $c<d,$ its length $d-c.$ That measure assigns $0$ to an interval that is only a point, so the integral of any function over that point is $0.$

However, suppose one integrates with respect to a measure that assigns measure $1$ to the one-point set $\{0\}$ and assigns the length of every interval to that interval if $0$ is not a member of the interval. Then what you've got is a density.

But there's no need to go into that in order to answer your question about the expected value. The c.d.f. is $$F(x) = \Pr(X\le x) = \begin{cases} 0 & \text{if } x<0, \\ 1/2 & \text{if } 0\le x \le 1/2, \\ x & \text{if } 1/2<x\le 1, \\ 1 & \text{if } x\ge1. \end{cases}$$ The expected value is $$\operatorname E(X) = 0 \cdot\Pr(X=0) + \int_{1/2}^1 x\cdot\left(\frac 1 2 \, dx\right) = \frac 3 8.$$

Suppose $m$ is the measure described above, assigning measure $1/2$ to $\{0\}$ and the length of each interval to the interval if it does not contain $0.$ Then one can write $$\operatorname E(X) = \int_{-\infty}^\infty xf(x)\,dm(x)$$ and its value will be $3/8.$

• How does your answer change (especially the resulting cdf) if the probability density randomizes uniformly over the interval [0.25,1] with probability 0.5, c.p.? Does it then look like: $$F(x)= \begin{cases} 0.5, & \text{if}\ x < 0.25/ \\ 0.5+0.5\cdot{(x-0.25)\over (1-0.25)}, & \text{if}\ 0.25 ≤ x ≤ 1 \\ 1, & \text{if}\ x > 1 \end{cases}$$ And how does calculation of the expected value change? Is it: $$E(x)= 0*\text{Pr}(X=0)+\int_{1\over 4}^1\ (...)={3\over 16}$$ What is the (...) – Moritz Sch Aug 11 '18 at 19:00
• E(x)=(...)=5/16 Sorry for the mistake, my bad... But still the (...) and the actual form of the cdf in my original reply to your answer is not clear. Thank you in advance! – Moritz Sch Aug 11 '18 at 19:13
• ....And F(x) = 0 if x<0 is also missing in my reply (cdf) to your comment. But I understand this part. I also messed up the inequality signs, but no further explanation needed on that... Things to clarify would be: actual form of E(x) and the form of F(x) if 0.25 < x </= 1 – Moritz Sch Aug 11 '18 at 19:19
• @MoritzSch : In the expression $\displaystyle \int_a^b \cdots\cdots \, dx,$ the dots just mean that what is said is true regardless of which function goes where those dots are. – Michael Hardy Aug 12 '18 at 15:14