Implemented part 2 - the partition matrix