# Is this the cumulative distribution function?

A continuous random variable X takes positive values only and is such that $P(X>x)=k(2-x), 0\leq x\leq 2$. Find the expected value of $X$.

Is $P(0<X\leq 2)=k(2-x)$ the cdf, so I differentiate it to get the pdf and I can get $E(X)$ from there? I'm a bit confused because the definition of a cdf goes by $P(X\leq x)$ rather than $P(x_1<X\leq x_2)$.

• $P(X>0)=1$ since $X$ is a positive rv. What can you conclude about $k$ from this? – drhab Oct 10 '17 at 13:03
• $k=0.5$ I guess. – user373534 Oct 10 '17 at 13:07
• Correct. Are you familiar with $\mathbb EX=\int_0^{\infty}P(X>x)dx$ for positive random variable $X$? – drhab Oct 10 '17 at 13:08
• Isn't $E(X)=\int_0^∞ xf(x) dx$? Where $f(x)=F'(x)$. – user373534 Oct 10 '17 at 13:10
• Yes that also, but the formula I mentioned can be proved for positive random variables and in this case it is convenient. If you are not familiar with it yet, then just forget my hint. – drhab Oct 10 '17 at 13:15

Hint: $P(X\le x)=1-P(X>x)= 1-k(2-x) = \mathrm{the \, CDF}$
For every nonnegative random variable $X$ $$X=\int_0^X\mathrm dt=\int_0^{+\infty}\mathbf 1_{X\gt t}\,\mathrm dt=\int_0^{+\infty}\mathbf 1_{X\geqslant t}\,\mathrm dt,$$ hence
$$\mathrm E(X)=\int_0^{+\infty}\mathrm P(X\gt x)\,\mathrm dx$$