How to Plot the density of Z if : “Z = Gaussian RV + Discrete RV ”?

I want to do a hypothesis testing excersise that comes after, but i'm a little bit confused about the plot of the density of Z, which i feel i need to understand first: More specifically, where do i see in the graph the "P[Y=1]=P[Y-1]=1/2" of the discrete RV? if i am adding a normal distribution to it, with a variance that reaches those limits in the x axis (-1,1).

How does the discrete RV affects my normal distribution in terms of limits?

Side note: I thought about using R to plot it as well, is it a good idea? or should i use matlab?

Thank you

• Do you mean plot the distribution function of $Z$? – StubbornAtom Jan 6 at 19:39
• The density of Z – mjginno Jan 6 at 19:46

I think you're asking for the density of $$Z$$. $$Z=X+Y$$ is either a normal RV with mean $$1$$ or mean $$-1$$ (variance is $$1$$), based on the value of $$Y$$. Let $$f(x,\mu)$$ be the density function of a normal RV with mean $$\mu$$ and variance $$1$$. Then, density of $$Z$$ is $$f_Z(z)=f(z,1)/2 = f(z,-1)/2$$. Recall that, $$f(x,\mu)=\frac{1}{\sqrt{2\pi}}e^{-\frac{(x-\mu)^2}{2}}$$. When you plot this function, you'll see a two peak curve on your screen. R or Matlab doesn't matter.