Chaos theory has a bad name, conjuring up images of unpredictable weather, economic crashes and science gone wrong. But there is a fascinating and hidden side to Chaos, one that scientists are only now beginning to understand. It turns out that chaos theory answers a question that mankind has asked for millennia - how did we get here? In this documentary, Professor Jim Al-Khalili sets out to uncover one of the great mysteries of science - how does a universe that starts off as dust end up with intelligent life? How does order emerge from disorder? It's a mindbending, counterintuitive and for many people a deeply troubling idea. But Professor Al-Khalili reveals the science behind much of beauty and structure in the natural world and discovers that far from it being magic or an act of God, it is in fact an intrinsic part of the laws of physics. Amazingly, it turns out that the mathematics of chaos can explain how and why the universe creates exquisite order and pattern. And the best thing is that one doesn't need to be a scientist to understand it. The natural world is full of awe-inspiring examples of the way nature transforms simplicity into complexity. From trees to clouds to humans - after watching this film you'll never be able to look at the world in the same way again.

In the last episode, Al-Khalili turns detective, hunting for clues that show how the scientific revolution that took place in the 16th and 17th centuries in Europe had its roots in the earlier world of medieval Islam. He travels across Iran, Syria and Egypt to discover the huge astronomical advances made by Islamic scholars through their obsession with accurate measurement and coherent and rigorous mathematics.He then visits Italy to see how those Islamic ideas permeated into the west and ultimately helped shape the works of the great European astronomer Copernicus, and investigates why science in the Islamic world appeared to go into decline after the 16th and 17th centuries, only for it to re-emerge in the present day. Al-Khalili ends his journey in the Royan Institute in the Iranian capital Tehran, looking at how science is now regarded in the Islamic world

Dr Hannah Fry explores a paradox at the heart of modern maths, discovered by Bertrand Russell, which undermines the very foundations of logic that all of maths is built on. These flaws suggest that maths isn't a true part of the universe but might just be a human language - fallible and imprecise. However, Hannah argues that Einstein's theoretical equations, such as E=mc2 and his theory of general relativity, are so good at predicting the universe that they must be reflecting some basic structure in it. This idea is supported by Kurt Godel, who proved that there are parts of maths that we have to take on faith.

Hannah then explores what maths can reveal about the fundamental building blocks of the universe - the subatomic, quantum world. The maths tells us that particles can exist in two states at once, and yet quantum physics is at the core of photosynthesis and therefore fundamental to most of life on earth - more evidence of discovering mathematical rules in nature. But if we accept that maths is part of the structure of the universe, there are two main problems: firstly, the two main theories that predict and describe the universe - quantum physics and general relativity - are actually incompatible; and secondly, most of the maths behind them suggests the likelihood of something even stranger - multiple universes.

We may just have to accept that the world really is weirder than we thought, and Hannah concludes that while we have invented the language of maths, the structure behind it all is something we discover. And beyond that, it is the debate about the origins of maths that has had the most profound consequences: it has truly transformed the human experience, giving us powerful new number systems and an understanding that now underpins the modern world.

Hannah then explores what maths can reveal about the fundamental building blocks of the universe - the subatomic, quantum world. The maths tells us that particles can exist in two states at once, and yet quantum physics is at the core of photosynthesis and therefore fundamental to most of life on earth - more evidence of discovering mathematical rules in nature. But if we accept that maths is part of the structure of the universe, there are two main problems: firstly, the two main theories that predict and describe the universe - quantum physics and general relativity - are actually incompatible; and secondly, most of the maths behind them suggests the likelihood of something even stranger - multiple universes.

We may just have to accept that the world really is weirder than we thought, and Hannah concludes that while we have invented the language of maths, the structure behind it all is something we discover. And beyond that, it is the debate about the origins of maths that has had the most profound consequences: it has truly transformed the human experience, giving us powerful new number systems and an understanding that now underpins the modern world.

Al-Khalili travels to northern Syria to discover how, a thousand years ago, the great astronomer and mathematician Al-Biruni estimated the size of the earth to within a few hundred miles of the correct figure. He discovers how medieval Islamic scholars helped turn the magical and occult practice of alchemy into modern chemistry. In Cairo, he tells the story of the extraordinary physicist Ibn al-Haytham, who helped establish the modern science of optics and proved one of the most fundamental principles in physics - that light travels in straight lines. Prof Al-Khalili argues that these scholars are among the first people to insist that all scientific theories are backed up by careful experimental observation, bringing a rigour to science that didn't really exist before.

Mathematician Dr Hannah Fry explores the mystery of maths. It underpins so much of our modern world that it's hard to imagine life without its technological advances, but where exactly does maths come from? Is it invented like a language or is it something discovered and part of the fabric of the universe? It's a question that some of the most eminent mathematical minds have been wrestling with. To investigate this question, Hannah goes head first down the fastest zip wire in the world to learn more about Newton's law of gravity, she paraglides to understand where the theory of maths and its practice application collide, and she travels to infinity and beyond to discover that some infinities are bigger than others.

In this episode, Hannah goes back to the time of the ancient Greeks to find out why they were so fascinated by the connection between beautiful music and maths. The patterns our ancestors found in music are all around us, from the way a sunflower stores its seeds to the number of petals in a flower. Even the shapes of some of the smallest structures in nature, such as viruses, seem to follow the rules of maths. All strong evidence for maths being discovered. But there are those who claim maths is all in our heads and something we invented. To find out if this is true, Hannah has her brain scanned. It turns out there is a place in all our brains where we do maths, but that doesn't prove its invented.

Experiments with infants, who have never had a maths lesson in their lives, suggests we all come hardwired to do maths. Far from being a creation of the human mind, this is evidence for maths being something we discover. Then along comes the invention of zero to help make counting more convenient and the creation of imaginary numbers, and the balance is tilted in the direction of maths being something we invented. The question of whether maths is invented or discovered just got a whole lot more difficult to answer

In this episode, Hannah goes back to the time of the ancient Greeks to find out why they were so fascinated by the connection between beautiful music and maths. The patterns our ancestors found in music are all around us, from the way a sunflower stores its seeds to the number of petals in a flower. Even the shapes of some of the smallest structures in nature, such as viruses, seem to follow the rules of maths. All strong evidence for maths being discovered. But there are those who claim maths is all in our heads and something we invented. To find out if this is true, Hannah has her brain scanned. It turns out there is a place in all our brains where we do maths, but that doesn't prove its invented.

Experiments with infants, who have never had a maths lesson in their lives, suggests we all come hardwired to do maths. Far from being a creation of the human mind, this is evidence for maths being something we discover. Then along comes the invention of zero to help make counting more convenient and the creation of imaginary numbers, and the balance is tilted in the direction of maths being something we invented. The question of whether maths is invented or discovered just got a whole lot more difficult to answer