- Let $X_i, i=1,2, \ldots$ be i.i.d. random variables with $\mathbb{P}\left\{X_i=1\right\}=p=1-\mathbb{P}\left\{X_i=-1\right\}>\frac{1}{2}$, $S_0=0$, and $S_n=\sum_{i=1}^n X_i$ for $n \geq 1$. In other words, $S_n$ is a simple drifted random walk on $\mathbb{Z}$ starting from the origin, jumping to the right with probability $p>\frac{1}{2}$ and to the left with probability $1-p=: q<\frac{1}{2}$. Fix $\theta \in \mathbb{R}$ and define
$$M_n:=\frac{\mathrm{e}^{\theta S_n}}{\left(p \mathrm{e}^\theta+q \mathrm{e}^{-\theta}\right)^n},$$
as well as
$$T:=\inf \left\{n \geq 1: S_n=1\right\}$$
the hitting time of level 1 for this random walk.
(c) (8 marks) Use the previous parts to calculate $\mathbb{E}\left(p \mathrm{e}^\theta+q \mathrm{e}^{-\theta}\right)^{-T}$ when $\theta>0$.
(d) ( 7 marks) By taking a derivative in $\theta$, find $\mathbb{E} T$ from Part (c). You don't need to justify swapping this differentiation with the expectation.
Could anyone give me tips on how should i approach question d). The answer to c) should be
$$\mathbb{E}(p \mathrm{e}^{\theta}+q \mathrm{e}^{-\theta})^{-T} = e^{- \theta}$$
however i'm stumped on where to move on from when i take the derivative inside the expectation to get:
$$-\mathbb{E}\left[T \cdot \frac{p e^\theta-q e^{-\theta}}{\left(p e^\theta+q e^{-\theta}\right)^{T+1}}\right]=-e^{-\theta}$$