# Finding the distribution of a piecewise defined variable

Let $$X$$ be a Bernoulli random variable with parameter $$p$$, $$X_t$$ be defined as follows: $$X_t =\begin{cases} \cos(\pi \cdot t) &\text{if}\quad X=0 \\ \sin(\pi \cdot t) &\text{if}\quad X=1 \end {cases}$$

Is the probability distribution of $$X_t$$ given by $$f(t) = p\cdot \cos(\pi \cdot t) + (1-p) \cdot \sin(\pi \cdot t)$$?

It looks like it but I'm not really sure, any help and explanation would be great, thank you. Also with it how can I calculate it's expected value, do I just integrate $$x\cdot f$$ over $$\mathbb{R}$$?

The $$t$$ in $$X_t$$ is not a density variable but the index for a sequence of random variables, so for each $$t$$, $$X_t$$ is a random variable.

For example: $$X_1$$ is $$\cos(\pi)=-1$$ if $$X=0$$ (Probability $$1-p$$) and $$X_1$$ is $$\sin(\pi)=0$$ if $$X=1$$ (Probability $$p$$).

The distribution function for every $$X_t$$ is discrete, for $$X_1$$ lets denote the distribution function as $$F_1$$, then it holds:

$$F_1(x)=P(X_1\leq x)=0$$ for all $$x <-1$$

$$F_1(x)=1-p$$ for all $$-1\leq x<0$$

$$F_1(x)=1$$ for $$0\leq x$$

Edit: The expected value for a discrete Random variable is $$\sum xP(X=x)$$ over the discrete set of $$x$$ with $$P(X=x)>0$$

$$E[X_1]=(-1)(1-p)+0p=p-1$$