Edited formula to put absolute values (more correct). Added comments
explaining mathematics.