I was reading text on probability where they state:
$$Ex[C]=\sum_{i=1}^{\infty}i.Pr[C=i]=\sum_{i=0}^{\infty}Pr[C>i]$$
Now assuming there is a system which fails at each step with probability $p$. What is the expected time to failure? They calculated this using the above relation.
Assuming $C$ is the random variable which is equal to the number of steps until first failure occurs. Thus $Ex[C]=\sum_{i=0}^{\infty}Pr[C>i]=\sum_{i=0}^{\infty}(1-p)^i=\frac{1}{p}$. I was able to understand till here.
Now they say that $Ex[C|A]=1+Ex[C]$ where $A$ is the event when system does not fail on the first step. They reasoned that conditioning on $A$ is equivalent to taking a first step without failure and then starting over without conditioning. I am not able to understand how this reasoning works. Can anyone help?
Further when I try to calculate $Ex[C|A]$, $Ex[C|A]=1.Pr[C=1|A]+2.Pr[C=2|A]+3.Pr[C=3|A]\dots$.
Now $Pr[C=1|A]=0$ as we know system doesn't fail on the first step. Thus $Ex[C|A]=0+2.Pr[C=2|A]+3.Pr[C=3|A]\dots$
Now $Pr[C=i|A]$ for $i>1$ should be simply $Pr[C=i]$ as if system doesn't fail on the first step, the probability of failing at step $i$ is still $p$. Thus $Ex[C|A]=0+2.Pr[C=2]+3.Pr[C=3]\dots$ which is equal to $Ex[C]-1.Pr[C=1]=Ex[C]-p$. Can anyone tell me where I am wrong.
I think you missed the part where it says "starting over without conditioning." So $E(C|A) = 0 + P(C=1) + 2P(C=2) + \cdots .$
In general, for a random variable $X$ taking non-negative integer values, one has $E(X) = \sum_{i=0}^\infty iP(X=i) = \sum_{i=0}^\infty P(X > i),$ provided the series converge.
Denoting $P(X = i) = p_i$ for brevity, the right-hand side is
$$\sum_{i=0}^\infty P(X > i) \\ = (p_1 + p_2 + p_3 + p_4 +p_5 + \cdots) + (p_2 + p_3 + p_4 +p_5 + \cdots) + (p_3 + p_4 + p_5\cdots) + \cdots\\ = p_1 + 2p_2 + 3p_3 + \cdots = \sum_{i=0}^\infty ip_i = \sum_{i=0}^\infty iP(X=i),$$ by rearranging and collecting terms.
In the particular case of your problem, this identity is used to prove that the expected value of your 'geometric random variable' $C$ is $E(C) = 1/p.$ [If it isn't in your textbook, you can google 'geometric distribution', perhaps starting with the first parameterization (column one) on the Wikipedia page.]
Additional examples:
If you toss a fair coin repeatedly, the probability of Heads on any one toss is $p = 1/2,$ so the average waiting time until you see the first Head is $\frac 1 p = \frac{1}{1/2} = 2$ tosses.
If you roll a fair die repeatedly, the probability of $6$ on any one toss is $p = 1/6,$ so the average waiting time until you see the first $6$ is $\frac 1 p = 6$ rolls.
Note: Very briefly, if a geometric random variable $X$ (as described in your Problem) has event probability $p,$ then its 'moment generating function' is $M_X(t) = E(e^{Xt}) = \frac{pe^t}{1-(1-p)e^t}$ and one can show that $E(X) = M_X^\prime(0) = 1/p.$