I'm stuck on this exercise for sometimes now. Let $X$$\sim$G(p)
- Determine P($X$ is even)
- P($X=n-k|X<n$)
For 1. I just write it like, $P(X)=p(1-p)^{2k-1}$ For 2. I managed to write something really long but can't verify it. Also if anybody have any tip to help me verify my solutions myself.(I've heard of R but do not really know how to use it.)
For number one, I don't know what you're asking. What you wrote down: $p(1-p)^{2k-1}$ is the probability that $X=2k.$ This is the probability of $X$ being a given even number $2k.$ To get the probability that $X$ is even, you need to add up all of those: $$ P(\mbox{$X$ is even}) = \sum_{k=0}^{\infty}p(1-p)^{2k-1}.$$ This sum can be done with a little work using the geometric series.
For your question regarding 2, I'm not sure if R has built-in geometric distibution, but it can be simulated from the bernoulli distribution by the number of trials it takes for a success. You would want to do draw a bunch of geometrics, filter on the ones that are greater than $n$ and then get the frequencies of $n-k$ for each $k=1$ to $n.$
Learning to simulate things is a useful tool, but since it's probably not feasible to learn in short order, I'll give an answer to compare to: $$ P(X=n-k\mid X< n) = \frac{p(1-p)^{n-k}}{1-(1-p)^n}$$ for $k=1$ to $n$ (zero otherwise).