Afrikaans
Akan
Albanian
Amharic
Arabic
Armenian
Azerbaijani
Basque
Belarusian
Bemba
Bengali
Bihari
Bosnian
Breton
Bulgarian
Cambodian
Catalan
Cebuano
Cherokee
Chichewa
Chinese (Simplified)
Chinese (Traditional)
Corsican
Croatian
Czech
Danish
Dutch
Esperanto
Estonian
Ewe
Faroese
Filipino
Finnish
French
Frisian
Ga
Galician
Georgian
German
Greek
Guarani
Gujarati
Haitian Creole
Hausa
Hawaiian
Hebrew
Hindi
Hmong
Hungarian
Icelandic
Igbo
Indonesian
Interlingua
Irish
Italian
Japanese
Javanese
Kannada
Kazakh
Kinyarwanda
Kirundi
Kongo
Korean
Krio (Sierra Leone)
Kurdish
Kurdish (Soranî)
Kyrgyz
Laothian
Latin
Latvian
Lingala
Lithuanian
Lozi
Luganda
Luo
Luxembourgish
Macedonian
Malagasy
Malay
Malayalam
Maltese
Maori
Marathi
Mauritian Creole
Moldavian
Mongolian
Myanmar (Burmese)
Montenegrin
Nepali
Nigerian Pidgin
Northern Sotho
Norwegian
Norwegian (Nynorsk)
Occitan
Oriya
Oromo
Pashto
Persian
Polish
Portuguese (Brazil)
Portuguese (Portugal)
Punjabi
Quechua
Romanian
Romansh
Runyakitara
Russian
Samoan
Scots Gaelic
Serbian
Serbo-Croatian
Sesotho
Setswana
Seychellois Creole
Shona
Sindhi
Sinhalese
Slovak
Slovenian
Somali
Spanish
Spanish (Latin American)
Sundanese
Swahili
Swedish
Tajik
Tamil
Tatar
Telugu
Thai
Tigrinya
Tonga
Tshiluba
Tumbuka
Turkmen
Twi
Uighur
Ukrainian
Urdu
Uzbek
Vietnamese
Welsh
Wolof
Xhosa
Yiddish
Yoruba
Zulu
If you want to understand the weird and wonderful world around you,
then maths is your friend.
But the real trick is, that with a little bit of mathematical
thinking, you can take those rules and patterns, bend and twist them,
and fire them straight back at you.
Tonight, we are going to explore just how far we can push those
barriers to achieve amazing things.
CHEERING AND APPLAUSE
Welcome to the Christmas Lectures. I am Dr Hannah Fry
and tonight we are going to be talking about how to give
ourselves superhuman skills.
Now, we're very good at using maths to understand the world around us.
But if we want to bend the world to our will, we're going
to need to be a little bit more inventive.
We're going to need to take this maths up a level here.
So I thought what we'd do is we would start off tonight with
something of a competition.
So I wonder, does anyone know how to solve one of these?
Who doesn't? Oh, actually, quite a few of you.
OK. Who doesn't mind coming down?
Let's go with you, actually, yeah.
If you want to come down. Round of applause, if you can,
as he comes to the stage.
What's your name? George. George.
OK. How good are you at these, George?
Solved it a few times. OK. All right. Let's give you a go.
We're going to give you lots of encouragement as you go.
Can I look at it first, like...? Yeah, you can have a little look,
yeah. Cheers. We'll be patient with you, though. OK.
All right. Yeah. I reckon I'm ready to go.
OK. Come on, then, George. Come on, George!
Hang on, George. Hang on, George.
AUDIENCE MURMURS
George?
AUDIENCE: Whoo!
AUDIENCE WHOOPS
George, you've solved these more than a few times, haven't you?
Yeah, quite a few, actually. Tell us who you actually are, George.
I'm actually the UK champion for solving a Rubik's Cube.
Yeah. You're the best in Britain.
Yeah. Currently reigning UK champion. Yeah.
So tell us, OK, how do you actually solve one of these?
OK, so I guess the first thing to know is that, like, it's got quite
a lot of combinations. So it's not like you just like learn one thing
and then you can solve it straight away.
So, like, when you scramble it, chances are that scramble's
actually never, ever been seen before. It just has so many
combinations - it has 42 quintillion
combinations... That's a big number. 43 followed by 19 zeros.
So, you kind of need to split up into steps and you need to learn
algorithms, like this whole actual... A list of instructions.
Yes.
So, algorithms, when applied to a cube, that kind of means
you're temporarily mixing up the cube, then putting
it back, having switched a few pieces.
So the more algorithms you know, the more efficient you'll be.
If I combine that efficiency with faster turning, it allows me
to be a faster solver.
Now, there's a very key point here in what George is saying,
which is that sometimes maths doesn't look like numbers and
equations, sometimes maths can just look like a list of instructions.
I mean, you can solve this by following a list of instructions.
An algorithm, as you say.
And that means, George, that if I want to beat you at this, all I've
got to do is follow those instructions faster than you,
right? Yeah. Well, thankfully I have just the thing that's going to
help me, and Illius here is the creator of this machine.
So I tell you what, hang on, let me just scramble this one up again.
We're going to have a bit of a competition. We're going to do you
against the machine. OK, so here we go.
Let's scramble this one.
You're not allowed to look at this now. All right.
So I'll tell you when you're allowed to look.
Is it ready to go, Illius?
OK. All right. We're going to count it down. And then you and the
machine can both look. Ready? Three, two, one, go.
Who's going to win? Who's going to win?
Ohhh!
George! You're letting yourself down! I know!
That is absolutely incredible.
APPLAUSE AND CHEERING
I mean, that was amazing. That was amazing. OK.
Let's go over here have a little look back at what we're seeing.
I mean, this machine is doing the same things as you. Exactly, yeah.
It's just, it's, like, seeing when to use those algorithms way more
quickly and it does it, like, all in one go,
so it doesn't have to pause to look to when to use the next
algorithm or anything like that. So we can look at a little slow-mo
replay, I think, of this.
And it is a properly mixed-up cube, there.
Wow! Amazing.
That was absolutely incredible.
So it's not better than you. It's just faster.
I suppose so. Yeah. It'll know more algorithms than I do.
Yeah. Amazing. George and the cube-solving machine,
thank you very much. Thank you.
Thank you. That was amazing. So impressed.
That really, I think, was a great example
of a machine following instructions.
The question is, how do you get those instructions into the machine
in the first place?
Well, one man who knows the answer is coder extraordinaire
Seb Lee-Delisle.
Hey, Seb!
So, Seb, tell us about the kind of things that you code.
Well, I like to make really big light installations
that are interactive. Oh, OK.
And we're seeing some footage of this, here. On the side of
buildings, no less. Yeah. Yeah.
See, my ambition really is to replace fireworks. With lasers.
With lasers. Yeah, cos, like, fireworks are old technology.
Uh-huh. Now we've got technology that's just as bright as fireworks,
lasers, super-bright LEDs.
But all of my technology is controlled by computers.
OK, so talking about computers, then, how do
you control these things?
Well, I'm going to show you how we make something called
a particle system.
So I've got a browser open.
I'm going to do some coding in JavaScript to make some graphics.
You're going to make an algorithm. An algorithm, yeah. A series of
instructions for the machine. Exactly right.
So the first thing I'm going to do is make a single particle,
which is essentially just a shape. And we've got to decide
what colour that shape should be. Any ideas what colour?
AUDIENCE SHOUTS SUGGESTIONS
I think first thing I heard was "pink".
So I'm going to actually use magenta,
which is my favourite type of pink,
and it's a very nice bright pink.
And the next thing I've got to do is draw a filled-in shape, so
let's hear some shapes.
AUDIENCE SHOUTS SUGGESTIONS
Circle. OK, OK!
Square. I think I heard "square".
Definitely. OK. Square. So a square is just a rectangle.
So let's draw a filled-in rectangle.
We're going to draw it at 00, which is the top left of the screen
in X and Y coordinates, and we're going to make it 100 wide and
100 high, so let's look at our square. There it is.
So this X and Y that you were talking about there... Yeah.
..are you treating this as though it's a graph?
Yeah. So this huge canvas in JavaScript,
it's got pixels and I can identify each pixel by its X and Y
co-ordinate. OK. Yeah. This is just straight-up maths so far.
It's all maths. It's maths all the way down, and I can change this X
value and you can see that the rectangle moves to whatever
co-ordinate I specify for the X position. As you increase X,
this is moving right. Yeah. Exactly.
So let's do the same thing for the Y value.
You can see it moves down and to the right. Ahh!
Right. So this is good. It's the start of our particle.
But it's not moving.
It's completely static.
So in order to get it moving, I'm going to wrap all of this stuff up
in a function, and I'm going to call this function 60
times a seconds.
But now I can do X+=1, which adds one to X every time.
And now, we should have the rectangle in a brand-new place
every time. We've made some animation. Aha!
Doesn't look much like a firework. No.
So we get we're getting there.
So, in particle systems, usually the particles are very small.
That's the first thing we can fix.
Let's just make it really little. Aww!
And now, let's make some new variables for the X velocity
and for the Y velocity.
The best part is when I give those velocity values a random
number. Oh, OK. So you can do that with the command "random".
If I pass in minus ten to plus ten, then we're going to get a random
number in the X velocity between those two numbers
and the same with the Y velocity.
And you'll see now that every time we run it...
Goes in a different direction! ..it goes in a completely
different direction. A random direction every time.
Right. Exactly. So that's kind of fun.
So we've got one particle.
One particle is cute.
But really, the idea of particle systems is that we make a whole
bunch of particles.
So now, in this next bit of code,
I'm doing essentially the same thing,
but I'm creating an array of particles.
And we get an effect like this. Ahh!
That looks like a sparkler! We're getting there. Aren't we?
We're getting to the sparkler.
Now, this is an ordinary projector, so it's not very bright.
If we want to create something that's truly spectacular,
like a real firework, we need to use a laser.
Ah. Wow! They're extremely bright. Right.
They're really, really bright, aren't they?
And so I can adjust all the settings here.
I can change the speed, how fast they are,
make them fade out over time a little bit.
And, yeah, I can add some gravity to make them fall down. Amazing!
But, of course, the stuff that you are really well known
for, Seb, is not just you having control
of where this is on the Y axis, where it is on the graph...
Yeah. ..but letting the audience control it. Exactly. I love doing
interactive things, so what I thought I'd do is actually take
the sound from the microphone in my laptop and apply that level
to the Y origin of the particles and then we could make a game
out of it. So here we've got this.
You can see the sparkler on the left.
Now it should be that the more noise that you make, the higher
this sparkle rises. All right.
Here we go. Three, two, one, go.
AUDIENCE CHEERS RAUCOUSLY
NOISE DROWNS SPEECH
This is it, guys!
It's getting harder. It's getting harder.
NOISE DROWNS SEB'S SPEECH
Ohh! That was amazing! That was such a high score.
Well done, everyone. Amazing, amazing. Seb, thank you
for showing us your all your lasers. Very, very welcome. Thank you.
Thank you very much. Thank you.
CHEERING AND APPLAUSE
Now, Seb's fireworks look very realistic, there,
but I think if you want something that looks as real as possible,
then you really can't do better than looking at Hollywood films -
the visual effects that they use in their movies.
Now, these are the people, the people who create those,
they're the people who, they don't only copy reality, but they really
know how to bend the rules to their will
for our entertainment.
And we are very lucky, because today, we are joined by someone who
does exactly that. From Weta Digital in New Zealand,
please join me in welcoming Anders Langlands.
CHEERING AND APPLAUSE
Hi. Hey, Anders!
So what films have you worked on, Anders?
Well, Weta's got quite a long history of going all the way back
to The Lord Of The Rings, Avatar, Planet Of The Apes and then, most
recently, Avengers this year. Oh, crikey.
I mean, you don't get much bigger than Avengers. No.
How much of the animations that we see - the CGI that we see in films -
how much of it is maths?
Well, it's all maths, really.
It's like a combination between art and science.
And we use algorithms to simulate how things move, to give animators
controls, to make things move according to their desires,
and to render the pictures and make the images through mathematical
equations, as well.
But presumably, if you want to make things look realistic on the screen,
you have to understand how they work in real life.
And that really is what this tower behind us, that has just been built,
is here for.
Because I would like a volunteer who would like to come
down and help me to dismantle this tower.
Let's go for, yeah, do you want to come down?
Round of applause as they come to the stage!
CHEERING
What's your name?
APPLAUSE DROWNS RESPONSE
All right, so we have got this bowling ball.
Now, I want you to roll it very gently.
This is a very old and important building and we will send you a
bill. So very gently and try and smash down this tower.
Can I stand somewhere else? You can stand a bit further back here
if you want to, give you a bit of a run up, but let's count it
down. Ready? OK. Three... ALL: Two, one.
Go!
Oh!
It's pretty good!
Yay! Ha-ha. Well done!
CHEERING
But stuff like that, it isn't just for fun for you guys, right?
No, I mean, we have to do things a little bit more complex than that,
but the basic equations of motion that govern something like that,
as you've just seen, are pretty simple.
Simple enough to solve by hand, in a lot of cases.
And if you've done GCSE maths, then you've probably encountered some
of that, too. Just the physics behind what just happened?
The physics behind what just happened. Of course, we want to
simulate much more complex things, and even
something like this tower falling over,
we need to use computers to do that so we can do it fast enough
to make a moving animation.
And, in fact, talking of moving animations, you have brought one
with you, so let's have a little look over here.
This is our tower, right?
This is kind of the same as our tower? Yes, pretty similar.
But this one is a complete animation.
Yes. So we look at the forces of gravity and the force of the ball
being thrown, analyse the collisions, and then,
every single frame -
so, at least 24 times a second - we update all of that and work out
where the blocks are going to be on the next frame
to create an animation. So let's have a little look at it
as it's animated. It's pretty good.
I mean, you've even got the little bit I had to kick down.
Just the wrong way round.
I haven't got a digital Hannah to kick it down, I'm afraid. OK.
So once you are at this stage, once you have this stuff created,
you understand how the basics work, then what do you do?
Well, then we can have a little fun with it. So because we create the
world, we can do things like change
all the boxes into china so they shatter when it gets hit,
rather than falling over.
We could change all the boxes into balloons and then pump them full
of helium so they float away.
That's nice! Escaping round the side. That's nice.
I like that a lot. It's getting away. Or maybe if we wanted
something a bit more exciting, we could douse them
in petrol and then set them on fire. Oh, wow!
AUDIENCE LAUGHS
That looks very realistic.
Thanks. That's kind of the point!
How do you make that look that realistic, though?
Well, like you said, we have to analyse what's
going on in the real world and use maths to try and simulate it
as closely as possible. So in the case of fire or explosions, for
example, we look at the chemical processes that drive that.
So, for fire, the combustion process is turning a fuel into water
and carbon dioxide and some carbon.
And then the temperature then decides how hot that soot gets,
and that decides what the brightness and the colour of the flame then is.
When you're working with buildings, say, do you take into
account the things that the buildings are made from?
Yeah, we want to analyse all the different material properties
that are in a building, so, like,
how bricks shatter when they get hit.
Mortar turning into dust, the steel bending.
We have to layer all of these things up using either one big simulation
or lots of simulations to get put together.
And, you know, if you're doing a giant bath toy knocking a building
down, you're kind of outside of the realm of real-world physics
at that point. So a lot of what our effects artists do, a lot of their
skill comes into figuring out how to tune the physics of the simulation
to give something that you've never seen before that the director wants,
but also something that the audience can believe is real.
Take reality and bend it. Yeah. So a big part of what our team of
scientists and software engineers
at Weta do is use maths to figure out cool tricks to make the
simulations run faster, while still looking real.
That is amazing. Anders, thank you. very much.
Thank you.
CHEERING
As Anders mentioned there, it takes a huge amount of brainpower
to compute those simulations - takes even machines days to do.
But, of course, it's not just fun and frivolity that's on the table
when you could get machines to do your maths for you,
because working out how to get computers to crunch the numbers
also saves lives.
And something that has had a huge impact from using algorithms
is organ-donor matching.
Let me explain what I am talking about here.
So let's imagine that you're a bit poorly
and you needed a new kidney.
Now, luckily, your friend here has very kindly and generously
offered to donate to you one of hers.
Almost all of us are born with two kidneys and you can live
a very long and happy life with just one healthy kidney.
Now, if you were both good tissue matches or blood matches for each
other, then this would be absolutely fine, the transplant could go ahead.
But if for some reason your blood or tissue type didn't match,
then you would be in a position where you had one person
who needed a kidney,
one person who is willing to donate a kidney,
but nothing that you could do about it.
That was until very recently.
All you could do was really wait around on the transplant list,
hoping for another donation.
That was until quite recently, when someone had a very bright idea.
Because while you two might be stuck in that position, perhaps,
over here, there are another two people
who are in a similar position.
So maybe you need a kidney.
I mean, you have one that you are willing to donate,
but that unfortunately doesn't match your loved one
who you're trying to help.
But what if your kidney, rather than matching your friend here,
what if your kidney was a match for you?
Now, that transplant could go ahead and that would be fine.
But the question is, why would you want to give
up your kidney to someone you've never met before, especially
when your friend is still sick and in need of a transplant?
But what if there was a third pair of people?
What if we could close this loop
with another group who are over here?
So one more person and their loved one who is willing to give
them one, you've got a little loop up here. Perfect. Thank you.
I'll take that down.
Now, in this situation, if this could happen,
if this happened to be a match for you as well,
then everyone's happy, right?
Everyone who needs a transplant has got one and everyone has helped
make sure that their loved ones have the operation that they need.
Now, the only problem with this is that there are often hundreds
of people in the country who will find themselves
in this position.
And finding these matches is incredibly difficult.
The number of possibilities with hundreds of people
is absolutely enormous.
And you have to make sure that you create a closed loop every
single time so that everybody ends up happy.
But this is the kind of thing that computers
are absolutely perfect for.
And, in fact, this is exactly what a team at the University
of Glasgow have done.
So here is the output from that algorithm.
This algorithm runs in seven seconds.
And this is the network that it spits out.
So each one of these dots is a real person, and each one of the lines
is, effectively, a ribbon.
And if we zoom in on this, you can see here just how many
ribbons this algorithm is potentially considering.
Now, clearly, there is no way that any human would be able to weigh
all of this up within their own minds.
But this algorithm, this isn't just something that's theoretical.
This is something that actually does go on to save lives because,
in fact, up there, holding on to the green ribbon is Yuki,
who was part of a real-life chain.
So, Yuki, if you want to join us on stage. Round of applause for Yuki.
CHEERING
Thank you for joining us, Yuki.
So how long ago did you have your operation?
I had it three years ago.
And who was the loved one who donated a kidney on your behalf?
It was my grandma from Japan. From Japan.
I think we have a photograph, actually, here, of you guys
outside Great Ormond Street.
So your grandmother's kidney went to someone else.
Where did your kidney come from?
My kidney came from someone in Birmingham.
And do you know how many people there were in your chain?
I think three. So exactly the same as we have here.
Yeah. It's a really incredible story.
Yuki, thank you so much for joining us and telling your story.
CHEERING
Now, this work is a monumental breakthrough, it's something that's
been a real game-changer for people within the UK.
And the key thing that that algorithm can do, the thing that no
human can do on their own,
is consider this vast number of possibilities.
And that is the superhuman power that you open up when you hand
over your maths to a machine, because suddenly it can use
all of its grunt to tailor things to the individual, to work out
precisely what is right for you,
which kidney you need,
and in a much smaller, but no less profound way,
which song or video you might like.
Now YouTube videos, Netflix, Amazon, BBC iPlayer - all of them
are crunching through vast amounts of information on their websites.
But how do they make sense of the content that is uploaded?
And what kind of process do they use to decide
what you might like to see next? Well, OK, I'll tell you what.
Let's find out here by making our own video.
So I wonder, can I have a volunteer, someone who is happy to help me
commentate on a little YouTube video?
OK. Perfect. Yeah. Let's go there.
Come on down. Round of applause as he comes to the stage.
Now, what's your name? Anthony.
Anthony. OK, perfect. Anthony.
Right. So we're going to make... Have you got your phone? Yeah.
OK. Perfect. Right. We're going to make a video, Anthony.
And we want it to be seen by as many people as possible.
Right? We want it to be picked up by the algorithm.
So we're going to make a great YouTube video here.
Now, thankfully, the world famous Royal Institution demo team are on
hand to help us make our video as exciting as possible.
So if you give me this and I'll do your video for you.
If you take these, you can come and stand over here and help me
commentate on this video.
So I'll take the video.
Here's Gemma. You start off whenever you want to, Anthony.
There we go!
What's up, folks?
It's me, Anthony, again.
Thanks for subscribing.
This is my best...
..best friend Gemma doing some science.
They have some extremely cold liquid nitrogen.
Whoa! Look at all these balloon dogs!
Where are they coming from?
It's the balloon-dog challenge!
Now, Gemma is going to add hot water to the liquid nitrogen and it
will yeet everywhere!
Let's give her a countdown.
Nice and loud.
ALL: Three, two, one...
AUDIENCE WHOOPS
Now, sure to get views, it's YouTuber Tom Scott!
And behind the cloud, appears
YouTube sensation Tom Scott.
Anthony, thank you so much. There, and you've got your video there.
Thank you very much indeed. Big round of applause if you can!
Do you often appear in clouds of smoke?
No, it's the first time I've been summoned like this.
It's wonderful. Now, I should tell you, for any of you who don't
recognise Tom, Tom is one of Britain's foremost YouTubers.
If there is one person that we can ask about how to make
sure a video gets seen by as many people as possible,
I mean, you are that person. Yeah.
I wish there was some magical way to guarantee it but, I mean,
I've done some pretty cool stuff.
I've been in Zero G, but that video didn't do well compared to, well,
a two-minute shot of me continuously looking at some toasters
and talking about how long it's going to take them to pop up.
That video did better than me flying about in zero G.
But what did better than both of those, to achieve, like, 25 million
views, was me attaching some garlic bread to a helium
balloon and sending it to the edge of space, then bringing it back
down and eating it. Now... 25 million. 25 million.
I kind of figured that one was going to do well.
I didn't think it was going to do THAT well. I have never, ever been
able to find anything that will get these recommendation engines,
these algorithms, to specifically go for a particular video.
Because it is an algorithm that's deciding what gets promoted
on different people's YouTubes, right? Yes. Originally,
years and years ago, it was all down to the title and the thumbnail.
CRACKLING
Is that OK? That's crackling a lot. I'm slightly nervous!
I mean, this is going to make quite a YouTube video
if it explodes on us now, Tom! I'm going to keep going.
Keep going. Originally, when I started 2006, it was all about
the title and the thumbnail and that was it.
So you could trick people into clicking on something
with a lie in the thumbnail, a lie in the title,
and that's still true now, but it doesn't work as well,
because after that, they said it was more about how long people
watched a video for.
So at that point, people put, you know, a little explosion
at the end of a 20-minute video.
So you'd have to watch all the way through. Those long introductions
that were very fashionable for a while.
Because they kept people watching. So now YouTube doesn't give any
advice at all on how to make something please the algorithm.
And as a YouTube creator, all of us just call it
"the algorithm". This one monolithic thing.
They say that if people watch it and people like it,
then the algorithm will also recommend it to other people.
But they will never, ever say what the reasons are,
because the minute they do that, everyone will say, "Oh, yeah, well,
"I'll start doing that."
And suddenly 100,000, 200,000 people are all doing that and
no-one's watching it any more. Yeah. There are 500 hours of video
uploaded to YouTube every minute. Not watched - like, uploaded.
So I'm sure it's a great video on your phone.
Statistically, it's probably not going to go big, but it might, cos
the more times you can roll that dice, the better your chances are.
I'm going to go create a garlic bread video of my own now, I think.
Good luck.
Apparently it does work!
Tom Scott, thank you very much indeed. Thank you. Thank you.
CHEERING
Now, as Tom hinted there, there is actually something slightly
different going on here to the fireworks
or the organ-donor algorithms that we saw earlier.
That YouTube algorithm, it isn't just crunching through a straight
list of instructions any more.
It's actually doing something a little bit different.
I want to explain this to you using a cup of tea and a robot.
Oh, OK.
Maybe not an actual robot, but definitely the next-best thing.
Please join me in welcoming robot Matt Parker.
CHEERING
That's a... Thank you!
That's a great outfit, Matt. Thank you. I've made it myself.
Yeah. Sorry...
ROBOTIC VOICE: I compiled it myself.
OK. Now, robot Matt, like all robots,
he isn't particularly bright.
Oh-oh. Offence registered.
They also take things incredibly literally,
as we are about to discover, because we are going to, together,
try and instruct robot Matt Parker with how to make a cup of tea.
OK, so here we go.
What's the first thing to do if you make a cup of tea?
You heat up the water in the kettle.
Heat up the water in the kettle.
Perfect. Sounds sensible?
There's a kettle. OK, next step. Next step.
You take out the teabags. Take out the teabags.
Ha-ha! That's good. Next step?
Er, get a mug.
Get a mug.
Oh, it's a teeny, tiny one.
What should we do next?
Put the teabag in the mug.
LAUGHTER
Is that the right mug, there?
Well, let's get another.
Put the boiling water in.
LAUGHTER
He takes things very literally!
HANNAH CHUCKLES
Heat registering!
Get a normal-sized teabag and cup.
A bigger cup.
The normal teabag in the mug.
LAUGHTER
I'm going to come round there. Hang on. One second.
Hold on a second. I'm going to come up here.
Here we go.
What's next? What's next?
Stop pouring the water.
Put the teabag in the mug.
Pour the water into the mug.
AUDIENCE MEMBERS CHORTLE
LAUGHTER
Stop pouring the water.
Add milk and sugar to taste.
HANNAH CHUCKLES
LAUGHTER
Pour the milk from the first mug into the mug with the tea.
OK. I think we've got one more.
Stop pouring the milk into the cup.
And the last step?
Drink it.
LAUGHTER
I made this for you.
Cheers, everyone.
Oh, that's...
LAUGHTER AND CHEERING
Thank you very much!
OK. So I think it's quite obvious that our list of instructions there
needs we need to be quite long and that is only for making
a cup of tea - something very easy.
So imagine how much harder it would be to write a list
of instructions for a very literal computer.
OK. How would you explain to a computer how to recognise a picture
of a dog?
What do dogs look like? Shout out.
What are the important things about what dogs look
like that you would need?
AUDIENCE OFFERS SUGGESTIONS
Fluffy, fur, yeah.
AUDIENCE SHOUTS
Four legs.
Er, tail? Yeah. OK.
All right, all right. So we got... We got...
We got fluffy or furry, tail, and four legs. Great.
OK. But what about this? Uhhh...
Slight problem, there.
OK. All right. What else? What else? What about its face?
What's important to recognise about its face?
AUDIENCE OFFERS SUGGESTIONS
Pointy ears.
Pointy snout. OK. OK. OK. Here we go.
All right. So "pointy snout", someone said.
How about this, though?
Ahhh. OK.
Even if you could work out, you know, maybe take into account
the colour, all of that stuff,
didn't you say that a dog had to have four legs?
Because what about this guy?
Still definitely a dog.
Still definitely a dog. But it just goes to show just how hard it is
if you are trying to write a long list of instructions, just how hard
it is to pin down exactly what a dog looks like.
Now, humans, we're amazing at this.
We can do this without even thinking, but explaining how we do
it, especially to a pretty dumb computer that takes things
very literally, ends up being quite a lot harder than you might imagine.
But there is another way around this to explain.
Please join me in welcoming computer scientist extraordinaire
Anne-Marie Imafidon.
CHEERING AND APPLAUSE
There is another way to all of this, Anne-Marie?
There is another way. We need a different type of program
that isn't as specific. Isn't a list of straightforward "do this,
"do this, do this". Exactly.
We need a type of program that has an end point or a goal.
And we let the computer or the machine figure out
its own rules to get to that end goal. Without giving
it straightforward instructions? Without giving
it any instructions other than that's where we're going,
and maybe when it's got it right. OK.
Anne-Marie, this sounds like magic.
Oh, it is computer science more than it's magic!
It's a lot like training an animal.
When you get a dog, you're training it to maybe do a particular trick.
You don't say, "Move this muscle and look that way."
You kind of just give it a treat when it does the right thing.
And you've got a clear idea in your mind of what it is you want
them to do. Exactly. Whether it's sitting
or whether it's anything else. OK. All right.
Well, on that point, then, of training animals, what's this kind
of algorithm called, incidentally, when it's in computer science?
So we call it a reinforcement training algorithm.
And it's one that learns on its own, so it's actually part of machine
learning. OK. All right. So reinforcement learning.
Let's see how this works, because we're going to try some
reinforcement learning on one of you.
So who would like to be our volunteer?
You had your hand up, I think, first. So if you want to come down.
CHEERING
What's your name? Emily. Emily. OK. Perfect.
Emily, if you want to come over here. OK.
So, Emily, what we're going to do, then, is we're going to play
a little game with you. If you just come to the side while they bring
all these things on. What we're going to do is we're going to show
you four pots. You can see all the different rounds
that we've got there. These pots are coloured and they've got sums
on them on the side, and so on. Now, Anne-Marie and I, we've got in
our minds, we've got a very clear idea of which pot
we want you to pick.
So, in each round, all you do is you just touch one pot.
OK. If you are correct, we're going to give you a treat,
we're going to give you a little reward, and I think they might just
be in here. We're going to give you a little reward of a humbug.
And if you're wrong, we're going to move on to the next round. OK?
If you want to just stand in there for me. Now, just to prove
that this really is something that is not specific to humans,
you are going to play this game against a competitor,
by which I mean a pigeon.
If we can welcome onto the stage
Alfie and his trainer, Lloyd. Round of applause.
Now, I have to tell you, Emily,
Alfie has had a bit of a head start on this. Alfie has been trained.
Look how sweet Alfie is!
Very beautiful bird.
You happy? You understand the game? All right, let's go.
Let's go for round one.
So just touch one pot.
Incorrect.
Ah, Alfie got it right, though. He did. He did!
Alfie, one. Human, zero.
LAUGHTER
OK. Here we go.
Round two.
Incorrect.
Ohhh! Alfie, two. Human, zero.
And here we go.
Next one.
Correct. OK!
Next one.
Ohh! Incorrect.
Alfie's got it correct again.
OK. Let's go final round.
Now. OK. The equations on this side are getting harder and harder
and harder, almost like
there's no possible way that you could solve them.
Ohh! Incorrect!
That is tough, that is tough!
OK. Tell us, how did you find it? Tell us what you thought.
It was quite hard.
I just basically picked random ones.
There wasn't really a method.
What were you thinking when you got it right?
I didn't really have a thing. I just sort of picked one, apart from
the one where the yellow pot fell on the floor.
Oh, did you see the yellow pot? That was a big clue.
In fact, actually.
Which pot do you think that Alfie was picking every time?
Shall we tell her? The yellow one? The yellow one.
Exactly right. Exactly right.
APPLAUSE
Now, I know that was quite tough, that was quite tough.
But, Anne-Marie, tell us, how similar is this to the things we see
in computer science?
So this is very similar to what we see in computer science.
But with a computer, it's able to do this thousands, millions, billions
of times in a second,
and so can then pick up that pattern quicker than we can as humans.
And often it can see patterns that we humans can't see and can make
those kind of connections, as well.
And that is a really important point because you only had a few rounds,
but if you were a computer, you'd have had 10,000 in that time.
So there you go, have another treat and a big round of applause.
Thank you! Thank you very much, Emily. Thank you.
CHEERING
Now, the way that Alfie was trained there was just using exactly
that same technique. Alfie just had a lot more goes at it.
But as Anne-Marie said there, if an animal can learn in this way
with very simple rewards, never hearing full instructions,
then so can a machine. Now, that might seem like a bit of leap.
How do computers learn, especially when, as we found out
with that cup of tea, machines are incredibly dumb?
Well, it is possible.
And perhaps unsurprisingly, given that it's in this programme, it is
totally mathematical because it turns out you CAN teach an inanimate
object to learn.
And we have been doing exactly that for the last week.
Please welcome Matt Parker and the Menace Machine.
Have to be honest, Matt. Menace Machine looks quite a lot like a
whole heap of matchboxes.
That's because Menace IS just a heap of matchboxes!
But we've taught these matchboxes to play noughts and crosses.
OK, OK. Talk me through it. How on Earth can matchboxes play
noughts and crosses? Well, the great thing about noughts and crosses is
there aren't that many possible games. There's only nine squares,
it's a nought or a cross.
And on the front of these boxes, every single one is a different
state that the game could be in.
In fact, this is every possible position of every possible game
that Menace could possibly face.
We've got all the first moves,
second moves, the third moves are in blue and the final, fourth
moves are over here in pink.
And inside each box, we've put some coloured beads.
So here's one that we haven't used yet. And you can see there's a real
mixture. There's, like, nine different-coloured beads
and each colour of bead corresponds to a move Menace can make.
Because, of course,
there's only ever nine possible places that you could play for
noughts and crosses. Exactly.
OK, so how do you actually train it, though? Well, initially, there's
just a random collection of beads in every single one.
So actually it's making every possible move equally likely.
And initially, Menace is terrible.
But the reinforcement learning is we track each game, and if Menace
wins, we give it more beads that are the same colour
into the same boxes.
If it loses, we confiscate those beads, which makes
it less likely to do that move again. And to train it,
we've had it play hundreds of games.
And thank you so much, everyone who, before the show tonight,
played against Menace.
Each time we either reward it or we punish it.
And with each game, it gets a little bit better.
And how good is it? Do you think it can beat a human?
I think it will probably not lose to a human.
All right. Well, let's give it a go.
Who would like to come and play with Menace?
Let's get you, there, yeah. Round of applause as she comes down.
So, what's your name? Ali. Ali. OK, perfect.
Ali. Now, Ali, you've got the advantage of being a sentient being,
so I think it's only fair that we let the matchboxes go first.
OK, so Menace is going to go first.
And this is the blank box, where there's nothing
on it because we haven't played at all yet.
I'm going to give it a shake and then I'm going to pull a bit
out at random. So while Menace is the brain,
I've got to do the actual moving around. OK.
So the first bead is green,
which is not surprising because you look in the box -
they're all green!
There's one purple one, because Menace
has learnt very quickly
if it goes in the middle to start with, it's way more likely to win.
Now, there you are, Ali. Where would you like to go?
Put a cross wherever you wish.
Oh, a corner. Bold move.
OK. I've now got to find, in the group of second-move boxes,
this game. OK, there it is.
But if you have a look, Ali, it's the same as this game,
but it's the mirror image.
And that's because we didn't want to use twice as many boxes.
It's not good for the environment.
So if you don't mind me turning the game over,
are you happy that's still the same game? Uh-huh.
But now, it exactly matches what's on the box. So I can give it a shake
and Menace is going to go...
Make sure it's properly random. Yellow.
They're all yellow. OK. So, it's learnt...
I mean, there are other moves it could make, but it happens
to have learnt that there is a good second move.
OK, your go.
Predictable. OK.
You're not letting it win that easily.
That's fine. OK.
Third move. Where are we? Where are we?
There! OK.
So you can see that one there, that matches this state.
Here we go. Give it a shake.
OK. Oh, white. OK.
So the next move is going to be white.
That's... Oh, that's not bad.
There you are.
You're just not letting Menace have any luck, are you? OK.
That's fine. So now I've got to find this in here.
Bear with me.
This is exactly as much fun as real noughts and cross.
HANNAH CHUCKLES
Ah, OK. I think that's it.
Let's have a look. That's...
Yes. OK. Right.
Menace is going to go....
Oh, there's not many beads left in this one.
Oh, orange. OK.
So I'm going to put an orange one there.
Now, that move.
And now, for the exciting conclusion...
LAUGHTER
Excellent. And now we go over... It's a draw.
And the problem with noughts and crosses is if everyone's playing
perfectly well, it always ends in a draw.
So in this case, I'm going to give Menace one extra of those beads
to say that was fine, but I'm not going to give it as many
as if it had won. Amazing.
Well, there we go. You managed to draw with a bunch of cardboard
boxes. Very impressive! A big round of applause, if you can. Thank you.
The point here is that you don't need to explain the rules
or the instructions. The machine - in that case, the matchboxes -
learns from getting rewards
when it does the right thing and it turns out that you can use this for
all kinds of things, so you can teach matchboxes how to play noughts
and crosses.
And going back to that earlier challenge of recognising dogs -
turns out you can teach machines to do it, too.
Now, for this, I would like a volunteer
to help me demonstrate this.
At the back there. Yeah.
With the red jumper. Round of applause as she comes to the stage.
Thank you.
What's your name? Felicity.
OK, Felicity, right. So let's have a little look over here.
I'm going to demonstrate to you how a machine can learn
to recognise pictures of dogs and not dogs.
Now, the way that this works is, what you do is you give
the machine a bunch of pictures of both dogs and not dogs,
and then you label them for the machine.
So that one goes into the dog pile. Just here.
Perfect.
Now, initially, when you give these pictures to the machine,
it's just going to be guessing at random, like we saw earlier
in the first stages of that pigeon thing.
But what you can do is if you play this over and over and over again
with tens or maybe hundreds of thousands of different images,
and eventually, if you do this enough times, you can end up with
something like this little app over here.
If you want to come and sit over here.
Now, we've got a little algorithm running on this iPod
that has been trained in just the way that we described.
And we are going to show this algorithm a series of objects.
And the algorithm is going to work out whether they are dogs
or not dogs. All right.
Is everyone ready to play dog or not dog?
ALL: Yes! Here we go.
Contestant number one, please. Dog or not dog?
Hello!
DOG BARKS
Ohh! Dog!
Hooray!
Thank you, Luna! Contestant number two!
Dog or not dog?
Not dog! Thank you very much.
Contestant number three.
AUDIENCE: Awww...
You OK, little guy?
Dog! Amazing!
Next contestant, please!
HANNAH CACKLES
Oh, this is very cute! Sit! Sit!
Not dog! Well done.
Haven't got one, mate!
Next contestant, please!
Aww! Look!
Not dog!
And our final contestant.
AUDIENCE: Aww!
Look how beautiful!
Dog!
Thank you very much,
and thank you very much for playing the game with us.
Big round of applause for everyone involved in dog or not dog!
Now, this idea, this kind of algorithm, a reinforcement learning
algorithm, it can actually have profound consequences
because the algorithm doesn't really care what it's looking at.
If it can learn to identify dogs, it can also learn
to identify diseases.
To explain, please welcome an ophthalmologist
from Moorfields Eye Hospital, Pearse Keane.
So, Pearse, tell me what it is that you do.
So I'm a consultant ophthalmologist at Moorfields Eye Hospital
and I specialise in the treatment of retinal diseases.
So, in particular, I specialise in the treatment of a disease
called macular degeneration,
and macular degeneration is the commonest cause of blindness
in the United Kingdom. And is it treatable?
So the thing about macular degeneration is that, if we pick
it up early, we have some good treatments and we can stop
people going blind from it.
The problem that we have is that it affects so many people as they get
older that sometimes we have a challenge to actually find
the people who've developed it and treat them in a timely
fashion. Because there are so many people. Because there's so many.
So we actually get 200 people who develop the blinding forms
of macular degeneration every single day just in the UK.
And so, for us, it seemed like this would be a perfect example
where we could apply artificial intelligence to try to identify
those people with the most sight-threatening diseases at the
earliest point and save their sight.
And I've brought Elaine Manor,
a patient of mine at Moorfields Eye Hospital.
Thank you very much for joining us, Elaine.
For me, Elaine exemplifies actually why this is important,
because the Elaine story is that actually she had lost sight
in one eye from this condition, from macular degeneration,
and then in 2012, she started to develop it in her good eye.
And she went to her high street optician and was told,
"You need to be urgently seen by a retina specialist,"
someone like me, but she got an appointment for six weeks later.
So you can imagine a situation if you're losing sight
in your good eye and there is an effective treatment, but you're told
that you have to wait six weeks.
What was that like at the time, Elaine?
I was absolutely terrified.
I felt that, when I went to bed, would I wake up to a world
of darkness? Would I see my family again?
It was worrying. Yeah.
And this is all just because of the sheer volume of patients?
Because of the huge number of patients.
So what is this machine? How does that work?
So this is an eye scanner.
It's something that scans the retina.
It's super-high resolution, a three-dimensional image
of the back of your eye.
But it's something that these algorithms can get to work on.
Well, that's exactly it.
I mean, if the algorithm can tell dog or not dog,
then it seems like it could tell macular degeneration or not macular
degeneration, and help people...help prevent people from going blind.
So I hope that we can have a look at how this algorithm looks
when it tries to process an image.
Can we have a little look? You can see here on the scan, it's called
out that there is an urgent problem with the eye.
It's identified choroidal neovascularisation.
This red area here is some blood vessel growth at the back
of the eye, which is suggestive of the condition Pearse was describing.
We've published a research article.
What we've shown is the proof of concept that the algorithm
that we've developed is actually as good as me or other consultants
at Moorfields or other world-leading eye doctors
at diagnosing these diseases.
And this stuff is, I mean, it's incredibly important to get
you to those urgent cases quicker. Yes.
Yes. Like Elaine, I guess.
But the great thing was, although it was stressful for Elaine
at the start, she was able to get the treatment
that she needed in this eye in time,
and we have been able to save the sight
that she has in her good eye.
Pearse Keane and Elaine, thank you very much indeed for joining me.
APPLAUSE
Wow.
As I think Pearse's work there demonstrates you can see
just how far you can go with a machine that is capable
of categorising images. As impressive
as all of this technology is,
it's not quite perfect.
It is important to say that these algorithms,
they don't really understand the world in the same way that we do.
They don't understand context, they don't understand nuance,
and that means that it really can make mistakes.
In particular, when you take something and you put
it in a strange situation, like this picture, here.
So if we take farmyard animals and we put them in strange situations,
like being cuddled by a child, for instance,
the algorithm labels as a dog.
This one I quite like. If you take a farmyard animal and put it in a
tree - this is a real photograph, by the way -
the algorithm gets a bit confused!
LAUGHTER
Surely it's an orangutan?!
And my favourite one of all is that, if you leave them back
in the original context but instead paint them pink, the algorithm
thinks they must be flowers, which I think is quite sweet!
LAUGHTER
This is the consequence of the way that these machines learn.
As we have seen a couple of times during this show,
in the beginning they just start off doing loads of completely random
things, which means that as they settle in to completing
their task they can end up with some rather
strange little quirks. Have a look at this little video, here.
So this is a simulation
of an algorithm that was given a body, and its objective was to
work out how to move its body.
Every time it falls over, it fails and starts again.
And you can see it in the beginning,
it's just trying lots of things, lots of random things.
But the consequence of that is that it really has, like, some quite
strange...quite strange habits that it ends up picking up
as it's sort of flailing all of its limbs around at random.
Now, this is what happens when you put reinforcement learning
into a body - a simulated one in that particular case -
but there is nothing stopping you from putting the very same ideas
into the body of a robot too. So, to explain,
please join me in welcoming back Anne-Marie Imafidon.
So, Anne-Marie, robots - talk me through it.
So, embodied robots, we've got
lots of them that we're trying to train to do all kinds
of different tasks, and we've got an example here.
OK. So this is from Professor Pieter Abbeel
at the Berkeley AI Research Lab. Exactly.
So we can see this is a robot that has never kind of known
how to move its arm before.
So it's just basically flinging its arm around at random,
trying to get the stuff in the box?
Yes, just trying to get the peg into the hole.
It's not doing very well.
It's not, because it hasn't had the time to learn what an elbow
is, kind of how it needs to move around, but also that the shape
needs to fit the hole that it's got there.
OK. So this is after five goes.
We can see here iteration eight as well
we've jumped to, and it's getting very close.
Yeah, it's still not managing it. I mean, it's basically just trying
lots and lots of things at random.
Yes. This I think, actually, it's something that pretty much every
parent of a young child will recognise.
This... This is Juno. Come on, then,
Juno, do you want to come and have a little play?
Now, this is something that you really notice,
is that, when they're very little, they don't necessarily understand
how to control their limbs. Let's give you a go.
You can try this, too, Juno, here we go.
Do you want to play with this one?
Is it a similar thing going on? Exactly.
So you learn the kind of motor skills you might need to actually
complete this task between 12 to 18 months,
and Juno here is only six months
so it's gone in her mouth,
which the robot didn't do, admittedly!
Different kind of reward! Exactly.
But it's only over time, by learning through lots and lots of
random behaviour, initially,
that we learn how to control our limbs.
We've all been there. We've all been Juno!
So the robots are learning in a very similar way,
just they do have fewer distractions.
They don't want to put things in their mouths, and their rewards
are just a little bit different.
So if the humans take about 18 months to master this task,
how long did that robot take?
So this particular robot that we were just looking at learned
to do that task in under an hour.
Yeah. Well, not long to go now, Juno. You might not manage it in
an hour, but give it a few months
and you'll definitely be doing these.
Thank you very much to Juno and Anne-Marie! Thank you.
APPLAUSE
That is the key idea - it's all about harnessing the power
of randomness, using trial and error to hone in on something that works.
Babies do it, robots do it,
and as an audience now, we're going to do it, too.
So, as a room, we're all going to be artificial intelligence.
We're going to let you loose like the machine-learning bots.
And for that, I'm going to hand over
to the very wonderful WiFi Wars.
CHEERING AND APPLAUSE
OK, Steve, tell us what we're going to do.
So what we're going to do is we'll get you guys here to represent
random computer attempts at navigating a maze.
What we need to do is get your phones out
and go into your browsers.
And while you are going back into there, I will show you the maze
if I can, please, Rob. There we are. So what we're going to do,
we're going to put all of you in this blue room in the bottom right
corner, but we're going to incentivise you to go exploring.
So you will get ten points for each square in the corridor
you get through, but, far more importantly,
you'll get 1,000 bonus points for each
of the coloured rooms you manage to get to.
So the big prize in this one is get to these three interconnected rooms
in the top left. If you do that, I will be very impressed.
Everything we do at WiFi Wars is competitive
so what we've done is we split you into two halves.
So you guys on this half of the room,
I believe, are the blue computer. CHEERING
And you guys are the much louder red computer!
CHEERING/BOOING
That wasn't fair. That wasn't fair. Booing already!
OK. So I'm going to give you 90 seconds to go through that.
So, because there's so many people
and we're going to be looking at that big map... Yeah.
..it's really difficult to work out who you are, right?
So you are essentially each representing a random
attempt at winning this game. Exactly.
So if it was one or two you could find your way through,
but we're going to make that much more complicated. OK.
Good. Are you ready? ALL: Yeah!
All right. Let's do a game, then.
If you send it into their phones now, please, Rob. We'll put
90 seconds on the clock and hopefully we're going to see...
Immediately we see you all there appearing.
We've got a lot of blue and red players from the two computers.
Already people are getting out - a red person was the first one out.
My goodness me! Although collectively the blue team...
I was going to say they're doing better
but by the time I said it, they're not, so the red computer
after 15 seconds have 6,000 points and the blues 5,400.
No-one's found a coloured room yet.
And, as I've said, if you can get
to these three in the top left corner...
Blues doing very well. Yeah, they're all going for it. Going round
the two main channels. As you would expect, sort of more often than not
they're picking the main thoroughfares as they hit dead ends.
And actually we've got a few people who are in the purple room now,
so well done. I think red was the first so well done.
For context, if you're wondering what's going on,
what Rob's created is a thing that allows us - without installing
anything, any device, browser or operating system -
to beam games onto your devices. A red one's on the way!
Wow. All right. Yeah. Good. I don't know if you know...
If there's a red, if you now are in a green room, cheer.
Yes, you! Well done to you. You were very, very good.
You've got 30 seconds left to do something about it.
Nobody's managed to find the orange or the red yet,
but we have got a few...
Well, we've got another red coming for the green, but a lot more blues,
actually, so the blues might level this up
if they can all get in there, but with 20 seconds left
it is 70,000 points to the red computer.
Blues, you need to do better.
You've got only 60,000 with 16 seconds left.
So many people getting stuck in this horrible dead end
that we cruelly put in the top right corner.
I think blues will need a miracle. The reds are cheering.
Ten seconds left.
Five seconds left now. 88,000 for the red computer.
82,000 now for the blues,
so that is a win, I'm afraid, for the red computer!
Wahey! Well done to you all.
"Boo!" Polite applause.
Well done. That was absolutely fantastic.
OK. Here is the big question
on top of all of that, because we saw in the last lecture
the highs and the lows of uncertainty. We saw what can go
right and what can go wrong when you rely on something
that has randomness at its core.
So, OK, if we accept that perfection is impossible - if we acknowledge
that these things are always going to have errors - we have to ask,
do we want to put flawed machines in a position of power?
That, I think, is one for the next lecture.
But, for now, who'd like to have a rematch of this?
CHEERING
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.