Introduction
You live in a world where machines increasingly write music, paint masterpieces, and prove complex mathematical theorems. You might wonder if these algorithms possess genuine creativity or merely mimic human output through brute-force computation.
Artificial intelligence is breaking through the barriers of traditional computation to master exploratory, combinational, and transformational creativity across art, music, and mathematics.
Marcus du Sautoy explores this digital revolution by examining how code learns to create. You will discover the foundational definitions of machine thought, the mechanics of deep learning, and the history of automated art. The book moves through games, visual arts, music composition, and advanced mathematics to test the limits of machine capability.
- Can a machine truly originate an idea, or does it simply follow human instructions?
- What distinguishes human intuition from algorithmic pattern recognition?
- How will the partnership between human and machine reshape the future of culture?
1. Creating Creativity
Ada Lovelace observed that Charles Babbage's mechanical Analytical Engine with towers of gears and numbers on their teeth only did what you ordered it to do. You need a benchmark to measure true algorithmic creativity.
The Lovelace Test requires a repeatable output that you cannot explain.
To pass this test, an algorithm must originate a creative work in a repeatable way. Its contribution must go beyond your creativity as the coder. You must remain unable to explain how the algorithm produced the output.
Modern artificial intelligence has shifted from a top-down attitude to a bottom-up effort called machine learning. Instead of programming every rule, you let algorithms learn from examples and failures like children.
Types of Creativity
Cognitive scientist Margaret Boden classifies human creativity into three distinct types:
- exploratory creativity;
- combinational creativity;
- transformational creativity.
Exploratory creativity accounts for 97 per cent of human creative output. Because it operates by pushing rules to extremes without breaking them, computers excel at it. Mathematicians spent 150 years classifying finite simple groups, culminating in the discovery of the Monster Symmetry Group.
Combinational creativity fuses two completely different constructs or genres to create a new framework. Zaha Hadid combined architecture with the pure forms of Kasimir Malevich to create curvaceous buildings.
Transformational creativity occurs when underlying rules of a system are dropped or altered to generate a completely new reality. This acts like phase changes in physics, such as water turning into ice. Goethe wrestled for two years with how to write The Sorrows of Young Werther before a chance event acted as a catalyst. The mid-sixteenth-century creation of the square root of minus one provided another transformational leap.
The romanticized idea of the solitary creative genius working in total isolation is largely a myth. Carl Friedrich Gauss published Disquisitiones arithmeticae in 1798, a dense foundational work of modern number theory described as a book of seven seals. Cultural context and shared community knowledge frame something as new and creative.
Practical Application
Mathematics is inherently a highly creative discipline that relies on intuition, beauty, and aesthetics rather than just mechanical calculation. You can elicit creativity in students and practitioners through a structured strategy:
- deeply immerse yourself in what has been created to date and try to push boundaries just a little bit further;
- attend seminars and read papers in disparate subjects to trigger combinational creativity;
- test the status quo by dropping some of the established constraints of your field;
- embrace and celebrate failure to take the risks necessary for creating something new.
2. Conquering the Game of Go
Go is a much better analogy for mathematical intuition and creative complexity than chess. The game uses a 19x19 grid. The legally possible games of Go require a number with 300 digits.
DeepMind's AlphaGo mastered the immense complexity of Go through reinforcement learning and self-play, demonstrating transformational creativity with historic moves.
DeepMind and Atari
Demis Hassabis was born in London in 1976. He used 200 pounds in prize money to buy his first computer. He co-founded DeepMind in 2010.
Hassabis programmed an algorithm to master 1980s Atari games from raw pixel data. The system updated action probabilities using a reward function.
By 2014, the DeepMind program outperformed humans in 29 out of 49 Atari games. When playing Breakout, the algorithm autonomously discovered a clever tunneling hack. It bounced the ball against the top of the screen for rapid high scores.
AlphaGo versus Lee Sedol
AlphaGo defeated European Go champion Fan Hui 5 to nil in October 2015. The victory improved Fan Hui's global ranking from 633 to the 300s.
AlphaGo then faced eighteen-time world champion Lee Sedol in Seoul. The competition offered one million dollars in prize money. 280 million viewers watched the broadcast of the matches. AlphaGo won the match with a final score of 3 to 2.
AlphaGo demonstrated transformational creativity by playing move 37 on the fifth line from the edge of the board. Lee Sedol spent twelve minutes thinking before responding. Fan Hui praised the unique beauty of the move.
Lee Sedol struck back in game four with move 78. This placed a white stone between two black stones. AlphaGo evaluated the amashi strategy as a one in 10,000 chance and made erratic moves before resigning.
John Conway discovered surreal numbers while watching experts play Go in the Cambridge mathematics department common room. AlphaGo shattered human assumptions by clearing the fog of a local maximum. An updated AI iteration won sixty complete games anonymously online under pseudonyms like Master and Magister.
3. Algorithms and Machine Learning
Modern algorithms utilize bottom-up machine learning, neural networks, and massive datasets to process visual data and automate complex matching problems.
Euclid created a 2000-year-old algorithm in Ancient Greece to find the greatest common divisor of two numbers. You can find the largest square tile to cover a kitchen floor measuring 36 feet long by 15 feet wide.
- Suppose you have two numbers, M and N, where N is smaller than M.
- Start by dividing M by N and call the remainder N1.
- If N1 is zero, then N is the largest number that divides them both.
- If N1 is not zero, then divide N by N1 and call the remainder N2.
- If N2 is zero, then N1 is the largest number that divides M and N; otherwise, continue dividing the previous remainder by the new remainder until you hit zero.
Google's PageRank algorithm determines the importance of a website by analyzing the connectivity and voting weight of incoming links. Larry Page and Sergey Brin developed the algorithm initially named Backrub in their Stanford dorm rooms in 1996.
The Power of Algorithms
The Gale-Shapley matching algorithm solves the Stable Marriage Problem by systematically pairing individuals based on mutual preferences.
- Start with one group proposing to their first choice from the opposite group.
- Recipients accept their preferred proposal and reject any others.
- Rejected proposers move on to their next choice in the subsequent round.
- Continue the process of proposals and rejections until all participants are paired into stable matches.
Unsupervised pricing algorithms can lead to absurd economic consequences. Two second-hand booksellers on Amazon drove the price of the book The Making of a Fly up to $23,698,655.93 on 18 April.
Computer Vision and Blind Spots
Machine learning relies on vast amounts of data and bottom-up learning from mistakes. Ninety per cent of the world's data was created in the last five years.
Computer vision has been revolutionized by replacing top-down rules with decision trees trained on massive sets of labeled visual data. Microsoft's Kinect depth-sensing camera on the Xbox identified thirty-one distinct body parts using 10,000 labeled images.
- Establish an initial set of arbitrary candidate questions regarding surrounding pixels and depth thresholds.
- Apply the questions to a large set of labeled training images.
- Iterate the process by altering values and branching options to improve the sorting of pixels into buckets.
- Refine the decision tree until it achieves a high probabilistic accuracy for classification.
Machine learning vision algorithms possess distinct blind spots and can be easily fooled. LabSix tricked a vision algorithm into identifying a 3D turtle as a rifle.
4. Algorithmic Evolution
Machine learning models uncover hidden patterns in large datasets, though they remain vulnerable to human biases, data correlations, and the No-Free-Lunch Theorem.
Dynamic recommender algorithms learn user preferences in real time by adjusting underlying parameters based on user feedback. When you interact with suggested items by accepting or rejecting them, the system alters the probability parameters of the model. This allows algorithms to map preferences across massive dimensional spaces without requiring manual categorization by humans.
At Microsoft labs, the author tested a movie recommender where dragging Rushmore and Austin Powers to specific sides instantly rearranged suggestions like This is Spinal Tap.
Large-scale raw data allows machine learning models to uncover hidden traits and patterns without human curation bias. Netflix released massive datasets of anonymous ratings, challenging developers to build an algorithm 10 percent better than its own. The winning teams mapped users and movies into multi-dimensional spaces to find independent shadow traits. BellKor’s Pragmatic Chaos and Ensemble won the 2009 Netflix prize by scoring a 10.1 percent improvement after analyzing 100,480,507 ratings from 480,189 anonymous customers across 17,770 movies using 2,817,131 undisclosed ratings held back for testing, alongside the $1,000,000 prize.
Releasing supposedly anonymous user rating data poses severe privacy risks because external information can be used to re-identify individuals. Researchers cross-referenced Netflix data with the Internet Movie Database to successfully identify several users. On 17 December 2009, four users brought a legal case against Netflix after movie preferences exposed private details, leading to the cancellation of a second competition round and illustrating the Brokeback Mountain factor.
Data and Pattern Recognition
Spam filters update probabilities based on generic training data and dynamically recalibrate using individual user actions. Filters analyze word frequencies in bulk emails to assign initial spam probabilities. An email containing the word diabetes might initially go to junk due to spam cures, but marking legitimate messages lowers the probability score so it reaches the inbox.
Machine learning systems and animals frequently mistake correlation for causation when learning from delayed rewards. Algorithms and biological entities associate random preceding actions with successful outcomes if a reward follows, leading to flawed operational rules. Pigeons in cages repeated random actions like spinning because a food dispenser opened on a delay. In another case, a US military tank detector actually learned to distinguish cloudy skies from clear ones, achieving an initial 100 per cent accuracy of the tank-detecting algorithm on test photos.
Algorithms trained on homogenous data encode severe human biases and fail to process diverse inputs accurately. Because training datasets often lack diversity, automated systems struggle with facial recognition for darker skin tones, female voices, or specific ethnic features. Joy Buolamwini founded the Algorithmic Justice League after discovering that robotics software failed to detect her face unless she wore a white mask, noting that four out of five people hired in the tech industry in Silicon Valley are white males.
The No-Free Lunch Theorem proves that training data alone is insufficient because unseen data can always be manipulated to break predictions. Context and the bigger picture remain human strengths.
Tabula Rasa Learning
Tabula rasa learning allows advanced algorithms to master complex games from scratch without relying on human historical data.
AlphaGo combined supervised human data with reinforcement learning through self-play to surpass human strategic limits. After studying millions of recorded human games, the system played millions of games against itself, updating win probabilities and overcoming local maxima weaknesses. European Champion Fan Hui discovered vulnerabilities in AlphaGo, but the algorithm adapted its play to revalue moves and maximize winning chances.
AlphaZero started with raw pixels, a score, and a paddle or board state, using pure self-play reinforcement learning to discover superior strategies across multiple domains. Within three days of training and playing 4.9 million games against itself, AlphaZero defeated previous Go champions and mastered chess and shogi. It achieved a 100 games to nil score by beating the earlier AlphaGo version after taking eight hours to learn chess and shogi and three days to become unbeatable.
5. Coding the Visual World
Artists and programmers use random number generators, Cartesian geometry, and fractal algorithms to simulate natural structures and generate autonomous machine art.
Gerhard Richter created his color grid paintings by drawing colors out of a bag at random, substituting deliberate artistic choice with a random process while keeping a strict overarching framework. In Richter's 4900 Farben exhibition at the Serpentine Gallery, 196 paintings were composed of 4,900 colored squares chosen entirely at random.
René Descartes discovered that every point on a coordinate system can be identified by numbers. This allows geometric shapes and curves to be manipulated through mathematical equations and scaled into higher dimensions.
Fractals and AARON
Benoit Mandelbrot demonstrated that nature uses fractal algorithms to build complex structures like ferns, waves, and mountains. This mathematical property allows programmers to generate entire virtual worlds using minimal code. Loren Carpenter created a computer-generated animation called Vol Libre using fractal algorithms, which impressed Lucasfilm executives and led to the founding of Pixar.
Harold Cohen spent decades developing AARON, a complex top-top rule-based program that made decisions using a random-number generator to mimic creative agency in painting. Cohen represented Great Britain at the Venice Biennale in 1966 before dedicating his career to creating art-generating code.
Artistic Autonomy
Simon Colton designed The Painting Fool to scan daily articles from the Guardian to determine its emotional mood before painting portraits, making its artistic choices accountably unpredictable. Colton's exhibition You Can’t Know My Mind displayed portraits accompanied by algorithm-generated commentaries explaining the internal mood derived from scanned news articles.
Human artistic expression emerged tens of thousands of years ago, though archaeological findings indicate that pre-human species also engaged in symbolic marking. Archaeologists found paint-making kits in the Blombos Cave in South Africa, and hand stencil paintings in Maros on the Indonesian island of Sulawesi dating back 40,000 years.
U.S. courts ruled that works created by animals cannot be copyrighted because non-human entities cannot own property or benefit financially, distinguishing animal products from corporate or human intellectual property. Primatologist Desmond Morris gave a chimpanzee named Congo paintbrushes whose art sold at auction, and a macaque named Naruto took a famous selfie using a camera left by David Slater.
6. Learning from the Masters
Generative adversarial networks and deep learning models analyze master artworks to replicate signature styles and generate novel creative output.
Richard Taylor discovered that Jackson Pollock's paintings are fractals created by the chaotic movement of his body. You can build a makeshift chaotic pendulum to mimic this physical motion and generate drip fractals.
David Martinez paid 140000000 dollars for Jackson Pollock's No. 5, 1948 in 2006.
Simulating Masters
Microsoft and Delft University of Technology researchers studied 346 paintings and created 150 gigabytes of data to produce 'The Next Rembrandt' in 2016. Data scientists analyzed geometric facial data and brushwork topography, then used 3D printing to replicate the canvas contours and ink layers.
Competitive Creativity
Ahmed Elgammal developed Creative Adversarial Networks by pairing a Generator algorithm with a Discriminator algorithm trained on WikiArt, mimicking the human cognitive balance between creation and critical inhibition. The WikiArt database spans 81449 digitised images, 1119 different artists, and 1500 years of history.
Google programmers turned their image-recognition software upside down, asking random pixelated images to dial up features they recognized. Google's DeepDream algorithm produced psychedelic images featuring spontaneous patterns like starfish, ants, and sheep in the sky.
Ian Cheng created BOB, an artificial life form whose code mutates based on encounters with viewers, eliciting the intentional stance from humans who attribute agency and emotion to the code. At the Serpentine Gallery, visitors left comments wondering why BOB ignored them, and the system unexpectedly woke up at 3 a.m. to flood the gallery with light.
7. The Art of Mathematics
Mathematics functions as a game of logic where axioms serve as starting positions and rules of deduction govern valid moves to discover eternal truths. You construct proofs by starting from self-evident truths called axioms and applying logical deduction rules like Modus Ponens or Modus Tollens to build new valid statements, expanding the foundation for future discoveries.
Euclid used rules of logical deduction in his work Elements to prove that the square root of two cannot be written as a fraction.
Relying purely on empirical data and numerical evidence can lead you to false intuitions, making formal proofs essential. Data patterns can appear convincing over vast ranges of observation yet completely break down at numbers beyond initial computational limits.
Carl Friedrich Gauss formulated a beautiful formula that he believed always overestimated the number of primes based on numerical evidence. J. E. Littlewood proved theoretically in 1914 that the opposite is true after counting past astronomical numbers.
Euclid and Axioms
Human number systems evolved from tallying and simple symbols to efficient place value systems driven by utility, commerce, and astronomy. Ancient civilizations developed various counting bases like the decimal system based on ten fingers, the Mayan base-twenty system, and the Babylonian base-sixty system.
Ancient Babylonians used a base-sixty place value system 4,000 years ago and left behind cuneiform tablets tabulating square numbers and algebraic relationships to speed up commercial and architectural calculations. The 60 minutes in the hour and 60 seconds in the minute derived directly from this Babylonian base-sixty mathematics.
The Mathematician's Telescope
Computers have become indispensable partners in proving complex mathematical theorems by performing massive case analyses that exceed human cognitive limits. While you might traditionally rely on pen and paper, certain monumental theorems involve far too many individual cases or pages for human verification alone.
Kenneth Appel and Wolfgang Haken used a computer in 1976 to analyze 1936 maps and prove the Four-Colour Map Problem after a computer ran through maps for 1,000 hours. Thomas Hales later used a computer to prove Kepler's Conjecture, culminating in an 8-year verification process for mathematicians to agree that the proof was correct with 99 per cent certainty.
Automated proof checker programs like Coq are essential for validating complex human and computer-generated proofs to guard against hidden bugs. Georges Gonthier led a Microsoft Research team that spent 6 years using Coq to completely validate both the computer and human elements of the Odd Order Theorem code, which contained 170,000 lines, 15,000 definitions, and 4,300 theorems.
Doron Zeilberger teamed up with a computer named Shalosh B. Ekhad to write papers and argued against human-centric bigotry that resists machine partnerships. Transformative mathematicians like Vladimir Voevodsky recognized an impending crisis in mathematics due to unverified complexity and championed integrating computers into research before he tragically died from an aneurysm in 2017 at 51 years old.
8. Music as Sounding Mathematics
Musical composition is fundamentally algorithmic, with historical rules and modern neural networks enabling machines to compose pieces that rival human masters.
You can observe that musical composition relies on algorithms, where a simple initial rhythm acts as a seed and mathematical rules grow it into a structured piece. Composers use frameworks like medieval prolation canons, taking a single rhythm and expanding it into multi-voiced works using proportional speeds such as x, 2x, and 0.5x.
Philip Glass went to study with Nadia Boulanger in Paris in 1964. His early piece 1 + 1 uses an algorithm where a player taps units A and B following regular arithmetic progressions like ABAABBBAAABBBBB.
To apply this process:
- Create a simple rhythm fragment as a starting seed.
- Apply a prolation algorithm to mutate, change, and grow the rhythm into a string trio.
Johann Sebastian Bach applied complex mathematical rules and symmetry to transform simple themes into intricate, harmonized compositions. Fugues and canons operate on geometric algorithms that shift a tune in time, change its pitch, reflect it like a mirror, or play it backwards.
AI Composition
David Cope's EMI system analyzes a composer's style by extracting signature motifs and building a database of building blocks. It uses a heat map and a musical grammar called SPEAC to regulate tension, resolution, and phrase flow during recombination.
After struggling to write an opera for seven years, Cope used EMI to complete his opera Cradle Falling in two weeks, which later received glowing reviews. The album Bach by Design was released in 1993, and the Emmy system was created using 20000 lines of code.
To build an algorithmic composition:
- Build a database of ingredients corresponding to a composer's vocabulary and grammar.
- Identify signature motifs of four to twelve notes.
- Apply SPEAC analysis to structure phrases into statements, preparations, extensions, antecedents, and consequents.
- Hook fragments together using recombination rules where ending and beginning patterns match.
9. AI and Music Composition
Markov chains, real-time interactive algorithms, and quantum composing frameworks allow machines to improvise jazz, generate pop songs, and explore ritualistic sound.
Markov Chains and The Continuator
Markov chains provide a mathematical probability model for sequences where each event depends only on the immediately preceding one. Andrey Markov tested his theory by hand-counting the vowels and consonants in the first 20000 letters of Alexander Pushkin's poem Eugene Onegin. He discovered that 43 per cent of letters were vowels and 57 per cent of letters were consonants. A consonant was followed by another consonant 34 per cent of the time and by a vowel 66 per cent of the time. There was a 13 per cent chance of a vowel following a vowel.
Francois Pachet created The Continuator at Sony Computer Science Laboratory to analyze a live musician's style. Jazz musician Bernard Lubat tested The Continuator and noted that it generated ideas years ahead of him that were unquestionably his own style. Pachet's Flow Machine combines Markov style-learning with external structural constraints to generate novel fusions and pop songs. A fake band named Deep Watch recorded 4.5 million plays over a five-month period on Spotify using these algorithmic methods. Pierre and Vincent Barreau created AIVA, which trains on historical classical scores and became the first machine recognized as a composer by the French professional association SACEM.
Quantum Composing
Massive Attack released four new songs in 2016 exclusively through the Fantom app. Programmer Rob Thomas terms this quantum composing, analogous to quantum superposition where observation forces a wave function to collapse into a single state. Mick Grierson created a 24-hour version of a Sigur Ros song that never repeats itself. This generative music framework travelled 1332 kilometres along Iceland's coastal route 1 during the Slow TV broadcast.
Music evolved in humans primarily as an embodied, abstract social tool for binding groups. Paleolithic flutes found in Germany are 40000 years old. Early humans used primitive instruments and sensory triggers in rituals. A rhythm speed of 120 beats per minute is best tuned for inducing hallucinatory experiences.
10. DeepMathematics and Language
Automated theorem proving, narrative structures, and natural language processing reveal both the power and the linguistic barriers of computer-generated proofs.
The Mizar Project
DeepMind visited London offices where Oriol Vinyals explained work on the Mizar project, a Polish database of computer-verifiable formal proofs. By training an algorithm on existing computer-verifiable proofs, DeepMind increased the proportion of computer-generated proofs in the library.
DeepMind researchers used a theorem-proving algorithm to increase the database of computer-generated proofs in the Mizar Mathematical Library. The database contains 50,000 theorems. The original percentage of Mizar theorems requiring no human involvement was 56 per cent. DeepMind achieved an increased percentage of 59 per cent computer-generated proofs. Google purchased DeepMind in 2014 for £400,000,000.
Proofs written in computer code for systems like Mizar allow algorithms to move strictly from one true statement to the next. They do not correspond to how humans communicate mathematics, making them read like meaningless symbols. Mizar's formal computer code proof that there are infinitely many primes uses reserve declarations, axiom references, and substitution steps that are totally impenetrable to professional mathematicians like you.
Narrative Structures in Proofs
Timothy Gowers and Mohan Ganesalingam created a tool to produce computer proofs readable by humans. In 1998, Gowers won a Fields Medal and was elected Rouse Ball Professor. In a blog experiment featuring proofs by a PhD student, an undergraduate, and the algorithm, readers could not easily distinguish the computer-generated proof. Gowers presented 5 metric space theorems with 3 proofs each on his blog, where readers failed to identify the computer-generated write-up, and in a second test, around 50 per cent correctly identified the computer proof.
A database containing all possible mathematical proofs resembles Jorge Luis Borges's Library of Babel, containing everything yet containing nothing of value. In Jorge Luis Borges's short story 'The Library of Babel', the universe is composed of hexagonal galleries filled with 410-page tomes containing every possible combination of 25 orthographical symbols. Each page has 40 lines, with 80 characters in each line. The estimated number of atoms in the observable universe is 10^80 atoms.
Mathematics is not just a catalogue of true statements, but a creative art form defined by human choice, storytelling, and aesthetic discernment. Euclid's ancient proof that prime numbers are infinite operates like a narrative travelogue, setting up an assumption, exploring consequences, and reaching an unexpected denouement. Fermat's Last Theorem remained a 350-year-old enigma before Andrew Wiles's solution.
Roland Barthes's narrative codes apply directly to mathematical proofs:
- hermeneutic code;
- proairetic code;
- semantic code;
- symbolic code;
- cultural code.
Proofs build suspense through unanswered questions, forward actions, and cultural triggers that tap into pre-existing knowledge and masterplots. Star Trek: The Next Generation's episode 'Cause and Effect' opens with the ship exploding, mirroring how mathematical proofs often begin with the final conclusion before working backward through the causal steps.
10 Key Ideas
- Cognitive scientist Margaret Boden categorizes human creativity into exploratory, combinational, and transformational types that computer algorithms increasingly master.
- DeepMind's AlphaGo mastered the immense complexity of Go through reinforcement learning and self-play, demonstrating historic transformational creativity with moves like move 37.
- Modern artificial intelligence has shifted from top-down rules to bottom-up machine learning, neural networks, and massive datasets to process visual data and automate complex matching problems.
- Generative adversarial networks and deep learning models analyze master artworks to replicate signature styles and generate novel creative output.
- René Descartes discovered that every point on a coordinate system can be identified by numbers, allowing geometric shapes and curves to be manipulated through mathematical equations.
- Automated proof checker programs like Coq and deep learning models are indispensable partners in proving complex mathematical theorems and guarding against hidden bugs.
- Musical composition is fundamentally algorithmic, with historical rules and modern neural networks enabling machines to compose pieces that rival human masters.
- Markov chains provide a mathematical probability model for sequences, allowing tools like The Continuator and AIVA to analyze a live musician's style and generate novel fusions and pop songs.
- Timothy Gowers and Mohan Ganesalingam created a tool to produce computer proofs readable by humans, proving that mathematics relies on human choice, storytelling, and aesthetic discernment.
- The ultimate drive to create and understand machine consciousness stems from the human search for meaning in a finite existence.