how to understand the occurrences of free variables?
A possible definition (From Lambda-Calculus and Combinators):


  Definition 1.11 (Free and bound variables) An occurrence of a variable
  $x$ in a term $P$ is called:
  
  
  bound if it is in the scope of a $\lambda x$ in $P$
  bound and binding, iff it is the $x$ in $\lambda x$
  free otherwise
  


Let's define the set of free variables $FV$:


The free variables of $x$ are just $x$, that is $FV(x) = \{x\}$
$FV(\lambda x. P) = FV(P) \setminus \{x\}$ (since $x$ is bound)
$FV(st) = FV(s) \cup FV(t) $


And maybe you just need some examples:


$y$ is free in $y$
$x$ is free in $(\lambda x.x)x$ (Try to work out why)
$y$ is free in $(yy)$.