Let $\{X_{n}\}_{n}$ be a sequence of i.i.d. random variables of uniform distribution on $(0,1)$. Find $E\tau$ if $$\tau=\inf{\{n\mid X_{1}+\dots+X_{n}\ge1\}}$$
Should I compute probability of $\tau$ being equal to $n$ for all $n$'s?
Let $\{X_{n}\}_{n}$ be a sequence of i.i.d. random variables of uniform distribution on $(0,1)$. Find $E\tau$ if $$\tau=\inf{\{n\mid X_{1}+\dots+X_{n}\ge1\}}$$
Should I compute probability of $\tau$ being equal to $n$ for all $n$'s?
Notemos primero que $\tau$ es una variable aleatoria discreta, que toma valores enteros no negativos. Podemos notar que $\tau\geq2$ pues las variables aleatorias $X_j$ toman valores en $(0,1)$. Entonces estamos interesado en determinar
\begin{equation} \mathbb{E}[\tau]=\sum_{n=2}^\infty n\mathbb{P}(\tau=n) \end{equation} Veamos que $\{\tau=n\}\Leftrightarrow \{S_n>1\}$ y $\{S_{n}<1\}$, donde $S_n=\sum_{j=1}^nX_j$. Por lo tanto
\begin{equation} \mathbb{P}(\tau=n)=\mathbb{P}(S_n>1)-\mathbb{P}(S_{n-1}>1) \end{equation} Ahora debemos determinar la función de distribución de probabilidad de la variable aleatoria $S_n$, notemos que nos es conveniente determinar como se distribuye solo para valores en el intervalo $(0,1)$. Hagamos esto mediante inducción. Para $n\geq 1$ deseamos probar que
\begin{equation} \mathbb{P}(S_n=x)=\frac{x^{n-1}}{(n-1)!}, \quad 0<x<1. \end{equation}
Para $n=1$, es inmediato que $S_1=X_1\sim U(0,1)$, lo cual cumple la relación. Para $n=2$, $S_2=X_1+X_2$, toma valores sobre $(0,2)$. Sin embargo veamos que para valores en (0,1)
\begin{equation} f_{S_2}(x)=\int_0^xf_{X_1}(y)f_{X_2}(x-y)dy=\int_0^xdy=x \end{equation} lo cual cumple la hipótesis. Asumiento válida la hipóteis para $n$, y $0<x<1$. Comprobemos ahora para $n+1$.
\begin{equation} \begin{aligned} f_{S_{n+1}}(x))&=\int_0^xf_{S_n}(y)f_{X_{n+1}}(x-y)dy=\int_0^x\frac{y^{n-1}}{(n-1)}dy=\frac{x^n}{n!} \end{aligned} \end{equation} donde hemos asumido válida la relación para $S_n$ en $(0,1)$
Con todo lo anterior tenemos que
\begin{equation} \begin{aligned} \mathbb{P}(S_n>1)=1-P(S_n\leq 1)=\int_0^1f_{S_n}(y)dy=1-\frac{1}{n!} \end{aligned} \end{equation} y asi
\begin{equation} \mathbb{P}(\tau=n)=\left(1-\frac{1}{n!}\right)-\left(1-\frac{1}{(n-1)!}\right)=\frac{n-1}{n!} \end{equation} Por lo tanto
\begin{equation} \mathbb{E}(\tau)=\sum_{n=2}^\infty n\frac{n-1}{n!}=\sum_{n=2}^\infty \frac{1}{(n-2)!}=\sum_{n=0}^\infty \frac{1}{n!}=e\end{equation}
You can easy compute $P(\{\tau = n\}$ if you consider following:
$$\tau = n \iff X_1 + \ldots X_n \ge 1 \text{ but }X_1 + \ldots X_{n-1} < 1$$
So: $$\begin{align*} \{\tau = n\} &= \{X_1 + \ldots X_n \ge 1, X_1 + \ldots X_{n-1} < 1\} \\ &= \{X_1 + \ldots X_{n-1} < 1\}\setminus\{X_1 + \ldots X_n < 1, X_1 + \ldots X_{n-1} < 1\} \\ &= \{X_1 + \ldots X_{n-1} < 1\}\setminus\{X_1 + \ldots X_n < 1\}\end{align*}$$
Where the last equality follows due to $X_n \ge 0$. And with continuity of $S_n = \sum_\limits{k=1}^n X_k$ it follows:
$$P(\{\tau = n\}) = P(S_n \le 1) - P(S_{n-1} \le 1) = F_{S_n}(1) - F_{S_{n-1}}(1)$$
So all you have to do is calculate the distribution of $S_n = \sum_\limits{k=1}^n X_k$