Deriving trigonometric identities