Consider the function:
$$ \displaystyle l(p) = \begin{cases} \displaystyle -\frac{y-1}{p^2} - \frac{1}{(1-p)^2} &\text{if } X = 1, Y\neq 1\\ \displaystyle -\frac{1}{p^2} - \frac{x-1}{(1-p)^2} &\text{if } Y = 1, X\neq1 \end{cases} $$
where $X, Y$ take on natural numbers as values. We lso have the following joint pmf:
$$ P(X = x, Y=y)= \begin{cases} p^{y-1}(1-p), & \text{if } x = 1, y \neq 1\\ (1-p)^{x-1}p, & \text{if } y = 1, x \neq 1 \\ 0, & \text{otherwise} \end{cases} $$
Now, I wish to compute $\mathbb{E}(l(p))$. My idea was to do this from first principles, i.e. to compute:
\begin{align*} \displaystyle \mathbb{E}(l(x,y | p)) &= \sum_x \sum_y l(x,y | p) P(X=x, Y=y) \\ &= \sum_x \left [ l(x,1 | p) P(X=x, Y=1) + \sum_{y\ge 2} l(x,y | p) P(X=x, Y=y) \right ]\\ &= \sum_x \left [ \left [ -\frac{(1-p)^{x-1}}{p} - p(x-1)(1-p)^{x-3}\right ] + \sum_{u} \left [ -\frac{p^{u}}{1-p} - (1-p)up^{u-2}\right ] \right ]\\ &= \sum_x \left [ \left [ -\frac{(1-p)^{x-1}}{p} - p(x-1)(1-p)^{x-3}\right ] + \frac{-p^2+p-1}{p(p-1)^2} \right ]\\ \end{align*}
Unless I have made a mistake in applying the definition of expectation, I am stuck at this point.