The clever part is shown in what happens when the motor rotates in the opposite direction (clockwise), as shown below:If you study these two diagrams carefully, you will see that in the first case, rising edges of Q1 occur when Q2 is low, but in the second case, rising edges of Q1 occur when Q2 is high. This means that a device (typically a microcontroller) attached to the Q1 and Q2 outputs can determine both the rotational speed and the absolute angular position of the motor shaft, even if it rotates both clockwise and anti-clockwise.The presence of the index pulse (IDX) which is generated only once per revolution provides a way to identify the zero position of the shaft.