Calculate the expected value of X I have no idea how to solve this problem, any help would be greatly appreciated:

During the course of $9$ lessons the teacher randomly selects one student (from a class of $30$), asks him several questions and either grades him (with the probability of $1/3$) or not (with the probability of $2/3$). It is possible for the same student to be chosen on more than one lesson. Let $X$ be the total number of students with at least one grade at the end of those $9$ lessons and calculate the expected value of $X$.


Let $X_i$ be the indicator random variable that the $i$-th student is selected and graded at least once in the nine lessons.   (Having a value of $1$ if the event happens, or $0$ otherwise.)
Then the count of students graded is: $\sum\limits_{i=1}^{30} X_i$
Now find the expectation of this count.   (Hint: use the Linearity of Expectation.)


Ok, it is my bad for not having said what the problem is: 1) I have basically thought of defining $X_i$ as 1 if the event occurs and 0 if it doesn't. My problem is with working out $P(X_i=1)$

It is the probability that a particular student is selected and graded at least once in a sequence of nine lessons.   In any particular lesson, the probability that that student is selected is $1/30$, and when selected the (conditional) probability of being graded is $1/3$.   The probability the student is selected and graded in a particular lesson is therefore obvious.   Thus the probability this happens at least once among nine lessons is readily determined (such as by considering the complementary event: that it does not happen in any of them).


2) Considering that $P(X_i=1)=0$ for $i > 9$, can we not just sum up to 9?

Because it is not true.   $X_i$ is the indicator that the $i$-th student on the class roll receives some grade.   Because there is apparently no bias in selection or grading, then for all $i$ in $1$ to $30$, $\mathsf P(X_i=1)$ equals the same value.
