Added problem 3. Generates all the matrices needed for the rotations