# Finding a CDF of a random variable

I am working on a problem and am a bit stuck. It is finding a CDF from a continuous distribution.

The problem:

$$f(x) = \cases{.005(20-x) & for 0\ltx\lt20\cr 0 & otherwise\cr}$$

Find the CDF for the random variable.

What I have done so far:

$$F_x(x) = P(X\le x)$$ or $$F_x(a) = P(X\le a)$$

(The integral of the pdf)

if x is continuous then $$F_x(a)$$ = $$\int_{-\infty}^ap(y)d(y)$$ where p is the density

I am unsure how to find this and what $$a$$ should we use?

Your density function $$f$$ has finite support, so you should take appropriate care for your integral's limits. Specifically, for $$x \leq 0$$, your CDF will be

$$F_{X}(x) = \int_{-\infty}^0 f(s) \text{d}s = 0$$

In the same spirit, since integrating a PDF over its support sums to $$1$$, you will get that for $$x \geq 20$$, your CDF will satisfy

$$F_X(x) = \int_{-\infty}^{x} f(s) \text{d} s = \int_{0}^{20} f(s) \text{d}s = 1$$

Note that the integral's lower limit starts from $$0$$, since $$f(s)$$ is $$0$$ for $$s \leq 0$$. Now, for any $$x \in (0, 20)$$ you must calculate the integral explicitly. You obtain

$$F_X(x) = \int_{-\infty}^x f(s) \text{d}s = \int_0^x 0.005 (20 - s) \text{d} s = 0.005 \left(20 x - \int_0^x s \text{d} s\right) \\ = 0.005 \left(20x - \frac{x^2}{2} \right), \; 0 < x < 20.$$

As a sanity check, you can plot it on Wolfram Alpha to make sure it looks like a CDF.

• So just as clarification, we do not get a finite number at the end of our calculation for the CDF, just the function itself. – Ethan Nov 5 '18 at 19:05
• @Ethan: Yes, that is correct. – VHarisop Nov 5 '18 at 19:07
• Thank you so much – Ethan Nov 5 '18 at 19:09