added formula from Discrete lecture