How to derive a formula for π