now we calculate the transition matrix