How is this expectation calculated This is from an old practice midterm from my statistics class. Suppose $$X = \begin{cases} 2 & \text{w.p. $\theta$} \\ 4 & \text{w.p. $\theta^2$} \\ 6 & \text{w.p. $1-\theta-\theta^2$} \end{cases}$$
The goal is to calculate $$i(\theta) = E\left[\left(\frac{\partial}{\partial\theta}\log f_\theta (x)\right)^2 \right]$$
From the solution key, it claims $$i(\theta) = \theta\left(\frac{1}{\theta}\right)^2 + \theta^2\left(\frac{2\theta}{\theta^2}\right)^2 + (1-\theta-\theta^2)\left(\frac{-1-2\theta}{1-\theta-\theta^2}\right)^2$$ 
which we can simplify. However, I'm not understanding where this expression is coming from. I think I see where the part in parenthesis comes from (e.g. $\frac{\partial}{\partial\theta}\log(\theta^2) = \frac{2\theta}{\theta^2}$), and the whole expression resembles $$E[X] = \sum_{x \in X} xp(x)$$ 
but the $x$ in that expression is appearing as the probabilities themselves so I'm a bit confused over how this expression is derived (it's probably simple and I'm just missing it).

Hint: $\frac{\partial logf_{\theta}\left ( x\right ) }{\partial \theta} = \frac{1}{f_{\theta}\left ( x \right )}\frac{\partial f_{\theta}\left ( x\right )}{\partial \theta}$.  
Use this to compute the derivative, square it, and plug it in the expectation which is really a sum.
