Sum of probabilities or mean of probability My question is about being confused about two way of approaching a problem, which in this case lead me to the same solution. One method is very verbose, the other one is fast and clean.
Let's consider this problem where there are three only components of a computer with probability of being defective 0.1, 0.05, 0.02. Now, I want the expected value E(X), where X is number of defective components.
Method 1
Sum of probabilities, a computer has a piece of each then:
$$E(X) = 0.1+0.05+0.02=0.17 $$
Method 2
Mean of probabilities, I calculate $ \Sigma\ x_i p_i$. Therefore:
$$p_1 = 0.1\times0.95\times0.98+0.9\times0.05\times0.98+ ... = 0.1543$$
$$p_2 = 0.9\times0.05\times0.02+0.1\times0.95\times0.02+... = 0.0077$$
$$p_3 = 0.1\times0.05\times0.02 = 0.0001$$
To then do $E(X) = 1\times0.1543+2\times0.0077+3\times0.0001 = 0.17$
In summary, both the methods give the same answer. The first one seems logical to me, but I don't have in my hands any proper formula, like I have it for the second method. Is there any flow that I am not seeing?

Both methods are correct! 
To see that Method 1 is correct, define the independent Bernoulli random variables 
$$X_i=\begin{cases} 1, &\text{component $i$ is defective} \\ 0, &\text{component $i$ is not defective} \end{cases}$$ for $i=1,2,3$. Then $$X_i \sim \mathrm{Bern}(p_i)$$ where the $p_i$'s are the given probabilities. Now, obviously $$X=\sum_{i=1}^{3}X_i$$ so that due to linearity of expectation $$E[X]=E\left[\sum_{i=1}^{3}X_i\right]=\sum_{i=1}^{3}E[X_i]$$ But, since $E[X_i]=p_i$ we have that $$E[X]=\sum_{i=1}^{3}p_i$$ which yields the result that you found with Method 1, i.e. $E[X]=0.17$.

Just to verify that Method 2 yields also the correct result:
Since you have defined your random variable $X$ then - in order to calculate it's expected value - you should proceed as follows 


*

*Firstly, determine the sample space of $X$. There can be from $0$ up to $3$ defective components, so that $$X \in \{0,1,2,3\}$$

*Secondly, determine the probability mass function of $X$, i.e. the probability of $X$ taking each of these values. You have that $$P(X=0)=(1-0.1)\cdot(1-0.05)\cdot(1-0.02)$$
and $$\begin{align*}P(X=1)=&0.1(1-0.05)(1-0.02)+(1-0.1)0.05(1-0.02)+(1-0.1)(1-0.05)0.02\end{align*}$$
and
$$\begin{align}P(X=2)=&(0.1)(0.05)(1-0.02)+(0.1)(1-0.05)(0.02)+(1-0.1)(0.05)(0.02)\end{align}$$
and 
$$P(X=3)=0.1\cdot0.05\cdot0.02$$


This gives the following probabilities $$P(X=x)=\begin{cases}0.8379, & x=0 \\ 0.1543, & x=1 \\ 0.0077, & x=2 \\ 0.0001, & x=3 \\ \end{cases}$$ (note that these probabilities add up to $1$). Now the expected value of $X$ is given by $$E[X]=\sum_{x=0}^{3}xP(X=x)=0P(X=0)+P(X=1)+2P(X=2)+3P(X=3)=0.17$$ 
