# Show that the function is a dense function of random variable $X$

Hi maths people I have another question for test I write this week.

$f(x)=\left\{\begin{matrix} \frac{1}{2} \cdot \sin(x), \text{ if } x \in \left[ 0, \pi \right ]\\ \text{else }0 \end{matrix}\right.$

Show that $f(x)$ is a dense function of a random variable $X$.

I check in reading script they say for show this you need show two things:

1. $\forall x \in \mathbb{R} : f(x) \geq 0$

2. $\int_{\mathbb{R}}{f(x) dx = 1}$

For 1. we have only numbers in interval available because is set by task. And sinus curve don't go down in curve and always positive in this interval. 1. is good.

1. Not sure I understand notation. They say when you integrate the function you need to get $1$ for result?

$$\int_{0}^{\pi}\frac{1}{2} \cdot \sin(x) dx= \left[-\frac{1}{2} \cdot \cos(x)+c\right]_{0}^{\pi}= \frac{1}{2}+c-\left(-\frac{1}{2}+c\right)= 1$$

Is good like this? Not sure because in reading there is under integral symbol real number symbol. Like I write here also. Instead real number symbol I put intervals from task in. Is allowed?

• Perhaps a bit pedantic but by "$f(x)$ is a dense function of a random variable $X$", i think you mean to say "$f(x)$ is a (probability) density function of $X$". – Nap D. Lover Oct 11 '17 at 11:27

Yes, for 1. you have that $\sin(x)$ is positive in the interval $[0,\pi]$ and outside of this interval your function is identically $0$. Just because the function is $0$ outside of the interval $[0,\pi]$ does not mean we do not have to consider those values for $x$. Thus, for any real number you consider, you get either $0$ or a number greater than $0$, which we can write $\forall x\in \mathbb{R}: f(x)\geq 0$.
For 2. you actually need to show that $\int\limits_{-\infty}^\infty f(x)dx=1$. You are very close, but you are missing the step in the beginning which looks like,
$\int\limits_{-\infty}^\infty f(x)dx = \int\limits_{-\infty}^0 0dx + \int\limits_{0}^\pi \frac{1}{2}\sin(x)dx + \int\limits_{\pi}^\infty 0dx$
$=\left[-\frac{1}{2} \cdot \cos(x)+c\right]_{0}^{\pi}= \frac{1}{2}+c-\left(-\frac{1}{2}+c\right)= 1$.
• Your answer is very close to correct, I cannot determine how you teacher will grade it. The integrals which have $\infty$ in the bounds will be $0$ because the function you are integrating is identically $0$ on this interval. – TSF Oct 11 '17 at 11:25