(YouTube Link)
This video shows a selection from Johann Sebastian Bach's Musical Offering (1747) played forwards, then backwards, then both forwards and backwards at the same time. It was created by mathematical illustrator Jos Leys and science/philosophy blogger Xantox. This Bach piece has long intrigued mathematicians:
In each of these canons a musical line is played twice (or four times in Canon 10). The second version is always transformed with respect to the first by shifting in time, but it may also be shifted in pitch, turned upside-down, stretched, or played backwards. Each of these transformations occurs in the mathematics of elementary functions; they are examples of how new functions can be made out of old and of how a function can be tailored to fit a new situation.
Link via Boing Boing
Do some more research into Xenakis and the likes to see some REAL math at work in music.