Initial, slow, solution to 9.
Still a slow solution to 9. Perhaps making use of triangle identities and such might help, but that'll be for another time.