how three phase math works