Based on explanations from scrathapixel.com, stackoverflow.com and Wolfram Mathworld.