Lex Fridman Podcast - #219 – Donald Knuth: Programming, Algorithms, Hard Problems & the Game of Life
Episode Date: September 9, 2021Donald Knuth is a computer scientist, Turing Award winner, father of algorithm analysis, author of The Art of Computer Programming, and creator of TeX. Please support this podcast by checking out our ...sponsors: - Coinbase: https://coinbase.com/lex to get $5 in free Bitcoin - InsideTracker: https://insidetracker.com/lex and use code Lex25 to get 25% off - NetSuite: http://netsuite.com/lex to get free product tour - ExpressVPN: https://expressvpn.com/lexpod and use code LexPod to get 3 months free - BetterHelp: https://betterhelp.com/lex to get 10% off EPISODE LINKS: Donald's Stanford Page: https://profiles.stanford.edu/donald-knuth Donald's Books: https://amzn.to/3heyBsC PODCAST INFO: Podcast website: https://lexfridman.com/podcast Apple Podcasts: https://apple.co/2lwqZIr Spotify: https://spoti.fi/2nEwCF8 RSS: https://lexfridman.com/feed/podcast/ YouTube Full Episodes: https://youtube.com/lexfridman YouTube Clips: https://youtube.com/lexclips SUPPORT & CONNECT: - Check out the sponsors above, it's the best way to support this podcast - Support on Patreon: https://www.patreon.com/lexfridman - Twitter: https://twitter.com/lexfridman - Instagram: https://www.instagram.com/lexfridman - LinkedIn: https://www.linkedin.com/in/lexfridman - Facebook: https://www.facebook.com/lexfridman - Medium: https://medium.com/@lexfridman OUTLINE: Here's the timestamps for the episode. On some podcast players you should be able to click the timestamp to jump to that time. (00:00) - Introduction (07:02) - First programs (30:26) - Literate programming (33:35) - Beauty in programming (39:30) - OpenAI (48:41) - Optimization (54:46) - Consciousness (1:03:29) - Conway's game of life (1:16:16) - Stable marriage (1:19:35) - Richard Feynman (1:30:29) - Knuth-Morris-Pratt Algorithm (1:40:02) - Hardest problem (1:57:41) - Open source (2:02:54) - Favorite symbols (2:12:27) - Productivity (2:20:08) - Meaning of life
Transcript
Discussion (0)
The following is a conversation with Donald Knuth, his second time in this podcast.
Don is a legendary computer scientist, touring award winner, father of algorithm analysis,
author of the art of computer programming, creator of tech that led to late tech,
and one of the kindest and most fascinating human beings I've ever got a chance to talk to.
and most fascinating human beings I've ever got a chance to talk to. I wrote him a letter a long time ago, he responded, and the rest, as they say, is history.
We've interacted many times since then, and every time it's been joyful and inspiring.
To support this podcast, please check out our sponsors in the description.
As usual, I'll do a few minutes of As Now, no ads in the middle. I try to make this
interesting, so hopefully you'll skip, but if you do, please
still check out the sponsor links in the description. It is, in
fact, the best way to support this podcast. I use their stuff, I
enjoy it, maybe you will too. This show is brought to you by Coinbase,
which is a trusted and easy to use platform to buy, sell, and spend cryptocurrency.
I use it, I love it. You can buy Bitcoin, Ethereum, Cardano, Dogecoin, and all the most popular digital currencies.
Ever since I did a bunch of podcasts on cryptocurrency, there will be people that come up to me kind of curious about cryptocurrency
and ask for advice on how they can get started with it and I always recommend Coinbase.
I think it's the easiest way to buy cryptocurrency and also to learn about the different cryptocurrencies.
In fact, I agreed at some point recently, but also a long time ago to talk to Coinbase CEO,
Brian Armstrong on this podcast, he's a fascinating time ago to talk to Coinbase CEO Brian Armstrong
on this podcast. He's a fascinating guy. That's unrelated to the sponsorship, but I very
much look forward to that because I like the way he looks at the digital currency, but
even just the technology world. Anyway, go to coinbase.com slash Lex. For limited time, new users can get $5 and free Bitcoin.
When you sign up today at coinbase.com slash Lex,
that's coinbase.com slash Lex.
This shows also brought to you by Inside Tracker,
a service I use to track biological bio data.
They have a bunch of plans, most of which
include a blood test that gives you a lot of information
that you can then make decisions based on.
They have algorithms that analyze your blood data, DNA
data, and fitness tracker data to provide you
with a clear picture of what's going on inside you
and to offer you science-backed recommendations
for positive diet and lifestyle changes.
The great, the powerful Andrew Huberman talks a lot about Inside Tracker, David Sinclair also talks a lot
about Inside Tracker, including in my conversation with him.
They love it, I love it.
In general, I just love the idea of using actual data
from your body to make actionable decisions about lifestyle.
For a limited time, you can get 25% off the entire inside tracker story if you go to
inside tracker.com slash Lex. That's inside tracker.com slash Lex. This show is
also brought to you by NetSuite. NetSuite allows you to manage financials, human resources,
and ventry, e-commerce, and many more business-related details,
all in one place.
Running a company of any size really is very hard,
because of all the moving pieces involved.
I've actually recently had a few conversations with Jim Keller offline about
various aspects of what it takes to not just design great products, but manufacture them
at scale. It's a lot easier than it sounds if you make good decisions and think from
first principles and make great hiring decisions. So you build a great team, but it's also a
lot more difficult if you go in naively. It can be both
Easier than you think and harder than you think depending on the choices you make and again depending on the tools you use
Anyway, right now special financing is back for NetSuite head to NetSuite.com slash Lex to get there one of a kind financing program
That's NetSuite.com slash that's netsuite.com slash lex.
Netsuite.com slash lex.
This shows also brought to you by ExpressVPN.
I use them to protect my privacy on the internet.
ISPs are able to collect your data, you know, use a VPN.
Even when you're using incognito mode on your browser,
it can still collect the data.
So if you want to protect yourself from the ISBs
and use a great tool for the job of preserving your privacy,
you should definitely use the VPN.
And ExpressVPN is my favorite VPN.
Another useful reason to use ExpressVPN
is you can change your location to watch shows
that are only available to certain parts of the world. So you can change your location to watch shows that are only available to certain
parts of the world.
So you can travel the world without ever actually leaving your computer.
Finally, I really just enjoy the quality of the interface.
It does one job and it does it really well.
It works on basically any operating system, including Linux, my favorite operating system.
But anyway, if you go to expressvpn.com slash flex pod,
you'll get extra three months free.
That's expressvpn.com slash Lex pod.
This episode is also brought to you by BetterHelp,
spelled H-E-L-P-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H-H- They figure out what you need and match you with a licensed professional therapist in under 48 hours. I've actually recently had a conversation with the Jay McClelland, who is one of the
seminal figures in the early history of artificial intelligence and neuroscience,
sort of at the intersection of those, or perhaps not neuroscience, but also cognitive science.
So that whole sort of mix of biology and computation. He was part of the group with Jeff
Hinton from which emerged the Bragg propagation paper. Anyway, I mentioned all that because I had a conversation with him about
psychiatry. He also wanted to be a psychiatrist going up as I have. And so very much believes in the magic of talk therapy,
of exploring the human mind through talking.
And so I think better help is worth trying.
It's easy, private, affordable, available worldwide.
Check them out at betterhelp.com slash Lex.
That's betterhelp.com slash Lex.
This is the Lex Friedman podcast, and here is my conversation with Donald Knuth.
Your first large-scale program, you wrote it in IBM IBM 650 assembler in the summer of 1957. I wrote it in decimal machine language.
I didn't know about assembler until a year later.
But the year 1957, the year and the program was take back though.
Yeah, I might have learned about it.
Assembly later that summer, I probably did.
In 1957 hardly anybody had heard of assemblies.
You looked at the user manual,
how do you write a program for this machine?
It would say, you know, you would say 69,
which meant load the distributor,
and then you would give the address of the number you wanted
to load into the distributor.
Yesterday, my friend at Doug Spicer at the computer history
museum sent me a link to something that just went on YouTube, it was the IBM's Progress
Report from 1956, which is very contemporary with 1957. And in 1956, IBM had donated Stanford University
an IBM 650, one of the first ones.
When they showed a picture of the assembly line
for IBM 650s and they said,
this is number 500 or something coming off the assembly line.
And I had never seen so many IBM 650s.
I did in this movie that was on YouTube now.
And it showed the picture from Stanford,
you know, they said,
we donated one of these to Stanford, one to MIT,
and they mentioned one other college.
And in December of 56, they donated to my university,
K-Stack, but anyway, they showed a picture then of a class session
of where a guy was teaching programming
and on the blackboard, it said 69, 8,000.
I mean, he was teaching them how to write code
for this IBM 650, which was in decimal numbers. So the instructions
were 10 decimal digits. You had two digits that said what to do, four digits to say, what
to do it to, and four more digits to say where to get your next instruction.
And there's a manual that describes what each of the numbers mean.
And the manual was actually one, if the manual had been well written,
I probably never would have gone into computer science, but it was so bad.
He written, I figured that I must have a talent for it because I'm only a
freshman and I could write a better manual.
And as he did.
And so I started working at the computer center and wrote some manuals then.
But this was the way we did it.
And my first program then was June of 1957.
The Tic Tac Toe.
No, that was the second program. The first, the third program, the first
program was factoring a number. Okay. So you dial a number on the, on the, um, uh, there's
switches. I mean, you sat at this big main, main frame. And, and, and, and you turn the dials,
set a number and, and then it would then it would punch out the factors of that number
on cars.
So that's the input is the number.
The input was, yeah, the input was a number,
yeah, a ten-digit number.
And the output was its factors.
And I wrote that program.
I still have a copy out somewhere. And how many lines of code do you remember?
Well, yeah, it started out as about 20,
but then I kept having to debug it.
And I discovered debugging, of course,
when I wrote my first program.
What does debugging look like on a program with just all numbers?
Well, you sit there and I don't remember how I got it into the machine, but I think there was a way to punch it on card, so each instruction would be one card. Maybe I could get seven instructions
on a card, eight instructions, I don't know, but anyway, so I'm sitting there at the console of
the machine. I mean, I'm doing this that night when nobody else is around.
Of course.
And so you have one set of switches where you dial the number
I'm inputting, but there's another switch that says,
OK, now execute one instruction and show me
what you did or you could do another four switches.
And say, stop if you get to those, if you get to that instruction.
So I can say, now go until you get there again.
And watch, okay.
So I could watch, you know,
it would take that number and it would divide it by two.
And if it's, you know, there's no remainder,
then okay, two is a factor.
So, so then I work on it.
But if, if, if not, the visible by two, divide by three, okay, keep trying until you know you're at the end.
And you would find a bug if you were just surprised at something weird happened.
Well, certainly. I mean, first of all, I might have tried to divide by one instead of two. You go off by one error as people make all the time.
But maybe I go to the wrong instruction.
Maybe I left something in a register that I shouldn't have done.
But the first bugs were pretty, you know,
I probably on the first night I was able to,
I was able to get the factors of 30, you know,
as equal to two, three and five, okay?
So you're sorry to interrupt you were so you're sitting there late at night. Yeah, so all
It feels like you spent many years late at night working on a computer. Oh, yeah, so like what's that like? So most of the world is sleeping and
You have to be there at night because that's when you get access to the computer.
Between my freshman sophomore year, I didn't need sleep.
I used to do all nighters.
When I was in high school, I used to do the whole
student newspaper every Monday night.
I would, you know, I would just stay up all night
and it would be done in Tuesday morning.
That was, I didn't get all sorts and stuff like that until later.
You know, but, but, but, well, the, I don't know if you know Rodney Brooks.
Rod Brooks, of course.
Yeah, he, he told, he told me a story that he really, you know, he really looked up to you.
He was actually afraid of you.
Well, vice versa. I must say.
But he tells a story when you are working on tech that they screwed up something with a machine.
I think this might have been MIT, I don't know. And you were waiting for them to fix the machine.
So you can get back to work late at night.
Oh, oh. That happened all the time.
He was really intimidated.
He's like, Doc, Anuth is not happy with us.
Oh, that's interesting.
But no, the machine at time for the AILA was down.
I'm awful lot because they had,
they had many talented programmers
changing the operating system every day.
And so the operating system was getting better every day, but it was also crashing.
So I wrote almost the entire manual for tech during downtime.
That's another story.
Well, he was saying this is a hardware problem.
They tried to fix it. They reinserted something
and smoke was everywhere. Oh, wow. He was hurt. Well, that didn't happen as often as the
operas. But yeah, there was a funny story because you're saying there's this tall, uh,
Donk, newt that I look up to and it was pressure to, to fix the computer. Well, it's funny.
OK.
The kind of things we remember, that's the kind of memory.
Well, OK.
Yeah.
I can tell you a bunch of Rod Brick stories, too, but let's
go back to the 50.
So I'm debugging this my first program.
And I had more bugs in it than a number of lines of code.
I mean, the number of lines of code kept growing and let me explain.
So I had to punch the answers on cards.
All right.
So suppose I'm factoring the number 30, then I got to put two somewhere on the card.
I got to put a three somewhere on the card. I got to put a three somewhere on the card.
I got to put a five somewhere on the card, right?
And you know what, my first program,
I probably screwed up and you know,
it fell off the edge of the card or something like that.
But I didn't realize that there are some tended
to numbers that have more than eight factors.
And the card has only 80 columns. to the numbers that have more than eight factors.
And the card has only 80 columns. And so I need 10 columns for every factor.
So my first program didn't take a count for the fact
that I would have to punch more than one card.
My first program just lined up up in memory
and then I punched the card.
But to by the time I finished,
I had to deal with lots of things.
Also I, if you put a large prime number in there, my program might have sat there for
10 minutes or 650 was pretty slow.
So it would sit there spinning its wheels and you wouldn't know if it was in a loop or
whatever.
You said 10 digit as the end of the year.
10 digits, yeah. whatever. You said 10 digit is the end. Yeah. So I think the largest is sort of 9999999997 or something like that.
And that would, you know, that would take me a while.
For that first, anyway, that was my first program.
Well, what was your goal with that program? Was there something you were hoping to find a large
prime maybe or the opposite? No, my goal was to see the lights flashing
and understand how this magical machine would be able to do
something that took so long by hand.
So what was your second program?
My second program was a converted number
from binary to decimal or something like that.
It was much, much simpler.
It didn't have that many bugs in it.
My third program was Tic Tac Toe.
Yeah, and it had some, so the Tic Tac Toe program
is interesting on many levels,
but one of them is that it had some,
you can call machine learning in it.
That's, yeah, that's right.
I don't know how long it's going to be before the name of our field is changed from computer
science to machine learning.
But anyway, it was my first experience with machine learning.
Okay, so here we had.
Yeah, how does the program, well, first of all, what is the problem you were solving?
What is Tic-Tac-Toe?
What are we talking about?
And then, how was it designed?
Right, so you've got a three by three grid
and each could be in three states.
It can be empty or it can have an X or an O.
So three to the ninth is a, well, what is how big is it? I should know,
but it's 80, 81 times 81 times three. So anyway, 80, 8 is like two to the third. So that would be,
So, eight is like two to the third. And so that would be, that would be like two to the sixth.
But that would be 64 then you have to anyway.
I love how you're doing the calculation.
So, the three, anyway.
The three comes from the fact that it's either empty
and X or an L.
Right.
And the 650 was a machine that had only
2000
10 digit words you go from 0 0 0 to 1 9 9 and that's it and and each word you have a 10 digit number
so that's not many bits I mean I got to have through, in order to have a
memory of every position I've seen, I need three to the ninth bits. Okay, but it was a decimal
machine too. It didn't have bits, but it did have, it did have strange instruction,
where if you had a 10-digit number, but all the digits were either eight or nine.
You know, you'd be eight, nine, nine, eight, eight, eight, eight, or something like that. That would
you could make a test whether it was eight or nine. That was one of the strange things IBM
engineers put into the machine. I have no idea what. Well, um, hardly ever used. But anyway,
Well, highly ever used, but anyway, I needed one digit for every position I'd seen. Zero meant it was a bad position, and I meant it was good position.
I think I started out at five or six, but if you win a game, then you increase the value
of that position for you, but you decrease it for your opponent.
But I could, I had that much total memory for every, every possible position was one digit.
And I had a total of 20,000 digits, which had to, which had to also include my program.
And all the logic and everything, including how to including how to ask the user what the moves are
and things like this.
Okay, so I think I had to work it out.
Every position in Tic-Tac-Toe is equivalent
to roughly eight others because you can rotate the board
which gives you a factor four
when you can also flip it over.
And that's another factor, too.
So I might have needed only three to the ninth over eight
positions, plus a little bit.
So I had, but anyway, that was a part of the program
to squeeze it into this tiny.
So you tried to find an efficient representation
that took account for that kind of rotation?
I had to, otherwise I couldn't do the learning.
So, but I had three parts to my TikTok top program.
And I called it Brain 1, Brain 2, and Brain 3.
So Brain 1 just played a random.
It's your turn, okay, you got to put an X somewhere.
You have to go into empty space, but that's it.
Okay, choose one and play it.
Brain 2 had a can routine, and I think it was, it also, maybe it had, maybe it assumed
you were the first player or maybe it allowed you to be the first, I think you're hard to
be either the first or second, but it had a can, built in strategy known to be optimum
for detectile. Before I forget, by the way, I learned
many years later that Charles Babbage had planned
to, had thought about programming TikTok
for his, for his dream machine that he,
that he would never be able to finish.
Wow. So that was the program he thought about.
More than a hundred years ago. Yeah.
Yeah. He had, he, he did that. Okay. And I had, and I had
how I've been influenced by a demonstration at the at the Museum of Science and Industry in Chicago.
It's like Boston's science museum. I think Bell Labs had had prepared a special exhibit of
had prepared a special exhibit about telephones and relay technology, and they had a tic-tac-toe
playing machine as part of that exhibit.
So that had been one of my, you know,
something I'd seen before I was a freshman in college
and inspired me to see if I could write a program for it.
Okay, so anyway, I had brain one random, you know, knowing nothing,
brain two, knowing everything. Then brain three was the learning one. And I could, I could
play brain one against brain one, brain one against brain two, and so on. And so you could
also play against the user, against the live servers. But so I started going, the learning thing,
and I said, OK, take two random people,
just playing TikTok, knowing nothing.
And after about, I forget the number now,
but it converged after about 600 games to a safe draw.
The way my program learned was actually,
it learned how not to make mistakes.
Because I, you know, I, I, I, I, it didn't try to do anything
for winning.
It just tried to, yeah, say, yeah, music.
And I lose.
So that was probably because of the way I designed the learning
thing.
I could have had a different reinforcement function that would reward brilliant
play.
Anyway, it didn't.
And if I took a novice against the skilled player, it was able to learn how to play a good
game.
That was really my...
But after I finished that, I felt I understood programming.
Was there...
Did you...
Did a curiosity and interest in learning systems persist for you?
So, why did you want Brain 3 to learn?
Yeah, I think naturally we were talking about Rod Brooks. He was teaching all kinds of
very small devices to learn stuff. If a leaf drops off of a tree,
learn stuff. If a leaf drops off of a tree, you know, he was saying something, well, it learns if there's wind or not. But I mean, he pushed that a little bit too far, but he said
he could probably train some little mini bugs to just cover out dishes if he had enough
financial support. I don't know. Can I ask you about that?
He also mentioned that during those years,
there was discussion about inspired
by touring about computation,
of what is computation.
Yeah.
And.
Yeah, I never thought about it.
He's stuck like that. That was that
was way too philosophical. I mean, I was a I was a freshman after all. I mean, I didn't
I was pretty much a machine. So it's almost like, yeah, I got you. It's a tinkering mindset, not a philosophical mindset.
It was just exciting to me to be able to control something,
but not to say, am I solving a big problem
or something like that?
Or is this a step for humankind or anything?
No, no way.
When did you first start thinking about computation in the big sense?
You know, like the universal touring machines. Well, I mean, I had to pass and I had to take
classes on computability when I was a senior. So, you know, we read this book by Martin Davis and
yeah, this is cool stuff. But, you know, I learned about it by Martin Davis and said, yeah, this is cool stuff.
But, you know, I learned about it
because I need to pass the exams.
But I didn't invent any of that for stuff.
But I had create fun playing with the machine.
You know, I wrote a program
because it was fun to write programs
and get this, I mean, it was like watching miracles happen.
You mentioned in an interview that when reading a program, you can tell when the author of
the program changed.
Oh, okay.
Here.
Well, how the heck can you do that?
Like what makes a distinct style for a programmer, do you think?
You know, there's different Hemingway as a style of writing
or as James Joyce or something.
Well, those are pretty, yeah, those are pretty easy to imitate,
but we get the same with music and whatever you can.
I found, well, during the pandemic, I spent a lot more time
playing the piano and I found something that I'd had. I had it when I was taking lessons
before I was a teenager and it was Yankee Doodle played in the style of, you know, and you had Beethoven and you had WC and Chopin
and you know, and the last one was Gershwin. And I played over and over again, I thought
it was so brilliant, but it was so easy, but also to appreciate how this author, Mario, somebody or other had, had been able to reverse
engineers the styles of those computer. But now, particularly to your question, I mean,
there would be, it was pretty obvious in this program I was reading.
It was a compiler and it had been written by a team
at Carnegie Mellon.
And I have no idea which program was responsible for that.
But you would get to a part where the guy would just not know
how to move things between registers very efficiently.
And so everything that could be done in one instruction
would take three or something like that.
That would be a pretty obvious change in style.
But there were also flashes of brilliance
where you could do in one instruction,
normally I used to, because you knew enough
about the way the machine worked, that you could
accomplish two goals in one step. So it was mostly the brilliance of the concept more
than the semicolons or the use of short sentences versus long sentences.
So you would see the idea in the code and you see the different style of thinking.
Right. It was stylistic. I mean, I could identify authors by their, by the amount of technical
aptitude they had, but not by styling the sense of rhythm or something like that. So if you think about Mozart, Beethoven, Bach,
if somebody looked at Don Knuth's code,
would they be able to tell that this
is a distinct style thinking going on here?
What do you think?
And what would be the defining characteristic
of the style?
Well, my code now is,
is literate programming.
So it's a combination of English and C mostly.
But if you just looked at the C part of it,
you would also probably notice that I don't,
that I use a lot of global variables
that other people don't and I
expand things in line more than instead of calling. Anyway, I have different
subset of C that I use. Okay, but that's a little bit stylistic. But with
literate programming, you alternate between English and C or whatever. And and by the and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, significant thing I think to come out of the tech project is that I realized that my programs
were to be read by people not just by computers and that typography could massively enhance that. And so, I mean, they're just wonderful.
If they're gonna look it up,
that they should also look up this book
by, it's called Physically-Based Rendering
by Matt Far and Gosh,
anyway, it, you know, God in Academy Award.
But it's, but only if, on the graphic effects
you see in movies,
you know, are accomplished by algorithms.
And this book, the whole book is a literate program.
It tells you not only how you do all the shading
and bring images in that you need for animation
and textures and so on,
but it also, you can run the code.
And so I find it an extension of the way I, of how to teach programming is, but by telling a story
as part of the program. So it's, it works as a program, but it's also readable by humans.
Yes, and especially by me, a week later or a year later,
that's a good test.
You yourself understand the code,
yeah, easily a week or a month or a year later.
Yes.
So it, it's,
it's,
with this piece, it's the greatest thing since sliced bread.
Programming or literate.
Literate program.
Okay.
You heard it here first.
Okay.
You all dodged this question in an interview I listened to.
Now, so let me ask you again here.
What makes for a beautiful program? what makes for a beautiful program?
What makes for a beautiful program?
What are the characteristics you see?
Like you just said, literally programming.
What are the characteristics you see in a program
that make you sit back and say, that's pretty good.
Well, the reason I didn't answer is because there are
dozens and dozens of answers to that.
Because each, you can define beauty,
the same personal, define beauty,
a different way from our hour.
I mean, it depends on what you're looking for.
At one level, it's beautiful, just if it works at all.
Another level, it's beautiful if it's,
it can be understood easily, it's beautiful. If it's a literate programming, it's beautiful, it makes you laugh. I mean, yeah. I'm actually, so I'm with you, I think,
beauty, if it's readable, readable, yeah. If you understand what's going on and also understand
the elegance of thought behind it and
Then also as you said wit and humor. I was always I remember having this conversation. I had this conversation on stack overflow
whether humor is good in comments and
I think it is whether human is good in comments. And I think it is.
Whether humor is good in comments.
Like when you add comments to code.
Yeah.
I always thought a little bit of humor is good.
It shows personality.
It shows character, shows wit and fun and all those kinds of things of the personality
that programmer.
Yeah, okay. So a couple of days ago, I received a wonderful present
from my former editor at Asun Wesley.
He's downsizing his house and he found that somebody
at the company had found all of their internal files
about the art of computer programming from the 1960s
and they gave it to him and then, before throwing the garbage.
And then he said, oh yeah, he planned to keep it for posterity, but now he realized that
posterity is too much for him to handle.
So he sent it to me. And so I just received this big stack of letters, some of which I had written to them,
but many of which they had written to early guinea pigs who were telling them whether
they should publish or not. And one of the things was,
in the comments to William Wren,
the major reader was Bob Floyd,
who is my great coworker in the 60s, died early unfortunately,
but, and he commented about the humor in it.
And so we had, you know, we ran it by me, you know,
it says, you know, keep this joke in or not, you know.
They also sent it out to focus groups.
What do you think about humor in a book about computer program?
What's the conclusion?
And I stated my philosophy is, it says, you know, the ideal thing is that it's something
where the reader knows that there's probably a joke here if you only understood it.
And this is a motivation to understand, to think about it a little bit.
But anyway, it's very delicate humor as a bit.
I mean, it's really,
each century invents a different kind of humor too.
I mean, and different cultures have different,
different kinds of humor.
Yeah, like we talked about Russia a little bit offline.
You know, there's dark humor. And there's, you know,
what when a country goes to something different. Right, better than that live and stuff like this.
And Jack Benny, I mean, Steve Allen wrote this book about humor and it was the most boring book,
but he was one of my idols, but, but, it's called the Funny Men or something like that.
But yeah, okay.
So anyway, I think it's important to know that this is part of life.
And it should be fun and not.
And so I wrote this organ composition, which is based on the Bible.
But I didn't refrain from putting little jokes and it
also in the music. It's hidden in the music. It's there, yeah. A little humor is okay. Yeah,
I mean not egregious humor. So in this correspondence, you know, there were things I said, yeah, I really shouldn't have done that.
But other ones, I assisted on it.
And I've got jokes in there that nobody has figured out.
In fact, in volume two, I've got a cryptogram, a message in cyphered.
And in order to decipher it, you're gonna have to break an RSA key,
which is larger than people know how to break.
So if computers keep getting faster and faster,
then it might be 100 years,
but somebody will figure out what this message is
and they will laugh.
I mean, I've got a joke in there.
So that one you really have to work for.
I don't know if you've heard about this.
Let me explain it.
Maybe you'll find it interesting.
So open AI is a company that does AI work and they have this language model.
It's a neural network that can generate language pretty well.
But they also, on top of that, develop something called OpenAI CodeX.
And together with GitHub, they develop a system called OpenAI Co-Pilot.
Let me explain what it does.
There's echoes of literate programming in it.
So what you do is you start writing code,
and it completes the code for you.
So for example, you start,
let's go to your factoring program,
you write in JavaScript and Python and any language
that you trained on,
you write the first line and some comments like what this code does and it generates the
function for you.
And it does an incredibly good job.
Like, it's not probably right, but it often does a really good job of completing the code
for you.
I see whether, but how do you know whether it did a good job or not?
You could see a lot of examples where you did a good job.
And so it's not a thing that generates a good thing.
It starts, it gives you, so it puts the human in the seat of fixing issues versus writing
from scratch.
Do you find that kind of idea at all interesting?
Every year we're going to be losing more and more control over what machines are doing and people are saying,
well, when I was a professor at Caltech, in the 60s, we had this guy who talked a good game.
He could give inspiring lectures and you'd think,
well, Thrillin thinks he was talking about an hour later,
you say, well, what did he say?
But he really felt that it didn't matter
whether computers got the right answer or not,
it just made you happy or not.
In other words, if your boss paid for it,
then you had a job, you could, you know, you could, you could take care of your wife.
The happiness is more important than truth. Exactly. He didn't leave it truth, but he was
a philosopher. I like it. And somehow you see, we're going that way. I mean, so many more things are taken over by saying, well,
this seems to work. And so when there's, when there is a competing interest involved,
neither side understands whether decision is being made, you know, we realized now that
it's that is bad, but but consider what happens
private 10 years you're done aligning what when things get even more
further detached and each thing is based on something from the previous year. Yeah, so you start to lose the more you automate, the more you start to lose track of some deep human nature. Exponentially. But so that's the dark side.
The positive side is the more you automate, the more you let humans do what humans do best.
So maybe programming, this, you know, maybe humans should focus on a small part of programming
that requires that genius, the magic of the human mind.
And the mess you let the machine generate.
I mean, that's the positive, but of course it does come with the darkness, like,
automation. What's better?
I'm never going to try to write a book about that.
I'm never going to recommend to any of my students to work for them.
So you're on the side of understanding.
And I think these things are really marvelous if they do is, you know,
although we have a better medical diagnosis or help guide some scientific experiment or something
like this, you know, so you have curing diseases or whatever. But when it, when it affects people's
life in a serious way, so if you're writing, if you're writing cold for, oh yeah, here this is great,
Oh, yeah, here this is great. This will make a slaughter butt.
Okay.
So I see.
So you have to be very careful.
Like right now it seems like fun and games.
It's useful to write a little JavaScript program that helps you with a website.
But like you said, one year passes, two years passes, five years and you forget,
you start building on top of it,
and then all of a sudden you have autonomous weapon systems.
Based on what we're all dead,
doesn't matter in that sense.
Well, in the end, this whole thing ends anyway.
So, but it pays for it.
There is a heat death of the universe. Yeah, I predicted, but I'm
trying to postpone that for a little bit. Well, it'd be nice that at the end, as we approach
the heat death of the universe, there's still some kind of consciousness there to appreciate it.
Hopefully human consciousness. I'll settle for 10 to the 10 to the 10 to the to appreciate it. Hopefully human consciousness.
I'll settle for 10 to the 10 to the 10 to the 10th year.
There's some finite number, but yeah, but things like this might be the reason we
don't pick up any signals from extra terrestrial.
They don't want anything to do with us.
Oh, because they, they they they invented it too. And
so you you do have a little bit of worry on the existential threats of AI and automation.
So like like removing the human from the picture.
Yeah, etc. Yeah. People have more more potential to do harm now than by far than they did 100 years ago.
But are you optimistic about so the humans are good at creating destructive things, but
also humans are good at solving problems.
Yeah.
I mean, there's half empty and half full, you know, so I would have full.
I can go, yeah, so let me, let me put it this way because because it's the only way I can
be optimistic, but, but, but think of, of things that have changed because of civilization. They don't occur just in nature.
So just imagine the room we're in, for example. Okay, we've got pencils, we've got books,
we've got tables, we've got microphones, we have a clothing, food, all these things were added.
All these things were added. Somebody invented them one by one.
Millions of things that we inherit, okay.
And it didn't conceivable that so many murders and
murders and things wouldn't have problems.
And we get it all right.
And each one would have no negative effects and so on.
So it's very amazing that it much works as it does work.
It's incredibly amazing.
And actually that's the source of my optimism as well,
including for artificial intelligence.
So we drive over bridges.
We use all kinds of technology.
We don't know how it works.
And there's millions of brilliant people
involved in building a small part of that.
And it doesn't go wrong.
And it works.
And I mean, it works.
And it doesn't go wrong often enough for us to suffer. And we can identify things that
aren't working and try to improve on them in a suboptimal way. Oh, absolutely. But it's
the same. But the the kind of things that I know how to improve, require human beings to be rational.
And I'm losing my confidence that human beings are rational.
Yeah, yeah. Now here you go again with the worst case analysis. They may not be rational, but they're
They're clever and beautiful in their own kind of way. I tend to think that most people have the desire and the capacity to be good to each other
and love will ultimately win out.
Like if they're given the opportunity, that's where they lean.
In the art of computer programming you wrote, the real problem is that programmers have spent far too much time worrying about efficiency in the wrong places and at the wrong times, premature optimization is the root of all evil in parentheses or at least most of it in programming.
Can you explain this idea?
What's the wrong time? What is the wrong place for optimization?
So first of all, the word optimization. I started out writing software and optimization was,
I was a compiler writer, so optimization meant making the, making a better translation
so that it would run faster on a machine.
So an optimized program is just like,
you know, you want to program and you set the optimization
level for the compiler.
So that's one word for optimization.
And at that time, I have to be looking in an unabridged dictionary
for some reason or other, and I came to word optimize.
So what's the meaning of the word optimize?
And it says, to view with optimism.
And you look in Webster's dictionary of English language in the early 1960s, that's what
optimized me.
Okay.
Now, so people started doing cost optimization, all the kinds of things, you know, call
subfields of algorithms and economics and whatever are based on what they call optimization. But to me,
optimization, when I was saying that, was changing a program to make it more tuned to the machine.
And I found out that when a person writes a program,
We're in a person writes a program.
He or she tends to think that the parts that we're hardest to write are going to be hardest for the computer to execute.
So maybe I have 10 pages of code, but I had to work a week writing this page.
I mentally think that when the computer gets to that page, it's going to slow down.
It's going to say, oh, I don't understand what I'm doing. I better be more careful. Anyway, this is of course silly, but it's something that we don't know when we read a
piece of code. We don't know what whether the computer is actually going to be executing that code very much.
So people had a very poor understanding of what the computer was actually doing.
I made one test where we studied a Fortran compiler,
and it was spending more than 80% of its time reading the comments card.
But as a programmer, we were really concerned about how fast it could take a complicated expression
that had lots of levels of parentheses
and convert that into something.
But that was just less than 1% of the...
So if we optimize that,
we didn't know what we were doing. But if we knew that it was spending 80% of his time on the comments, card, you know,
in 10 minutes, we could make the compiler run more than twice as fast.
You could only do that once you've completed the program.
And then you empirically study where I had some kind of profiling that I knew what was
important.
Yeah. So you don't think this applies generally?
I mean, there's something that rings true to this across all of our country.
I'm glad that it applied generally, but it was only my good luck.
I said it, but I said it in a limited context, and I'm glad if it makes people think about stuff because I'm, you know, but it applies,
in another sense too, that is sometimes I will
do optimization in a way that does help
the actual running time,
but makes the program impossible to change next week
because I've changed my data structure
or something that made it less adaptable.
So one of the great principles of computer science
is laziness or whatever you call it, late binding.
Hold off decisions when you can. And we understand how quantitatively, how valuable
that is. What do you mean we understand? So you mean from a...
People have written thesis about how you can how late binding will improve the, I mean, you know, just in time, manufacturing
or whatever, you can make, you can defer a decision instead of doing your advanced planning
and say, I'm going to allocate 30% to this and 50% to this.
So in all kinds of domains, there's an optimality to laziness in many cases.
Decision is not made in advance. So instead, you design in order to be flexible
to change with the with the way the wind is blowing. Yeah, but so the reason that line resonated with
a lot of people is because there's something about the programmers mind that wants that enjoys optimization. So it's a constant struggle to balance laziness
and lay binding with the desire to optimize.
The elegance of a well optimized code
is something that's compelling to programming.
Yeah, it's another concept of beauty. The Meska weird question. So Roger Penrose
has talked about computation computers and he proposed that the way the human mind discovers
mathematical ideas is something more than a computer that
a universal touring machine cannot do everything that a human mind can do. Now, this includes
discovering mathematical ideas, and it also includes, he's written a book about it, consciousness.
So I don't know if you know Roger, but...
about it, consciousness. So I don't know if you know Roger, but.
You think my, my daughter's kids played with his kids
in Oxford.
Nice.
So do you think there is such a limit to the computer?
Do you think consciousness is more than a computation?
Do you think the human mind, the way it thinks,
is more than a computation?
I mean, I can say yes or no, but, but, but I don't think I have no reason.
I mean, so you don't find it useful to have an intuition in one way or the other.
Like when you think about algorithms, it's not.
I think it's on an on an
elements, an answer of a question.
And my opinion is is no better than anybody else.
You think it's not an answerable. So you don't think eventually side.
How many angels can dance on the head of a, I mean, I don't know.
But angels are,
I, I, I, I, there are lots of things that are beyond that we can speculate about.
But I don't want somebody to say, oh, yeah,
Knuth said this and, and so he's, he's, he's smart.
And so, so that must be, I mean, I say it's something that we'll
never know.
Interesting. Okay, that's a strong statement. I don't, I personally think it's something
we will know eventually. Like, there's no reason to me why the, the workings of the human
mind are not within the reach of science.
That's absolutely possible and I'm not denying it. Yeah. But right now you don't have a good
intuition. I mean, that's also possible, you know, that AI created the universe.
Intelligent design has all been done by an AI. Yes. This is, I mean, all of these things are, but, but, but you're
asking me to, to pronounce on it, and I don't have any expertise. I'm a teacher that passes
on knowledge, but I don't, but I don't know the fact that I, that I vote, yes or no on.
Well, you do have expertise as a human, not as a not as a teacher or a scholar of computer
science. I mean, that's ultimately the realm of where the discussion of human thought. Yeah,
well, I know we're conscious. I know where we're going from. He I'm sure he has no
he might even thought he proved it, but no, he doesn't, he doesn't prove it.
He is following intuition. But I mean, you have to ask John McCarthy, I think we're totally
unimpressed by these statements. So you don't think, so even like the touring paper on the touring tests that you know starts by asking Kim
machines think. Oh, you don't think these kind of, so he, touring doesn't like that
question. Yeah, I don't consider it important, let's just put it that way, because
it's in the category of things that it would be nice to know, but I think it's beyond
knowledge.
And so I'm more interested in knowing about the Remind hypothesis or something.
So when you say, it's an interesting statement beyond knowledge.
Yeah, I think what you mean is it's not sufficiently well, it's not even known well enough to be able to formalize it
in order to ask a clear question.
And so that's why it's beyond knowledge,
but that doesn't mean it's not eventually going to be formalized.
Yeah, yeah, maybe consciousness will be understood
some day, but the last time I checked,
it was still 200 years away. I haven't been specializing in
this by any means, but I went to lectures about it 20 years ago when I was, there was a symposium
at the American Academy in Cambridge, and it started out by saying essentially everything that's
been written about consciousness is is
called washer. I tend to I tend to disagree with that a little bit. So, well, so consciousness
for the longest time still is in the realm of philosophy. So it's just conversations
without any basis and understanding. Still, I think once you start creating artificial intelligence systems that interact with humans,
and they have personality, they have identity, you start flirting with the question of consciousness,
not from a philosophical perspective, but from an engineering perspective.
And then it starts becoming much more like I feel like, yeah, yeah, don't misunderstand
me. I certainly don't disagree with that at all. And even at this lecture, is that we
had took, you know, 20 years ago, there were neurologists pointing out that that human
beings had actually decided to do something
before they were conscious of making that decision. I mean, they could tell that signals were
being sent to their arms before they knew that they were sick and things like this art to end. And my less valiant has an architecture for the brain
and more recently,
Christus Puppet de Mietrio
in the Academy of Science Proceedings a year ago
with two other people, but I know Christus very well.
And he's got this model of this architecture
by which you could create things
that correlate well with experiments
that are done unconsciousness.
And he actually has a machine language
And he actually has a machine language
in which you can write code and test hypothesis.
And so it might, you know, we might have a big breakthrough. My personal feeling is that consciousness,
the best model I've heard of to explain the
miracle of consciousness is that that that somehow inside of our
brains, we're having a, a continual survival for the fittest
competition. And I'm speaking to to you all the possible things I might be wanting to say
All in there. There's like a voting going on. Yeah, right and you know, and one of them is winning and and that's affecting
you know
the next sentence and so on yeah, and
There was this book, machine intelligence.
On intelligence. On intelligence. Yeah. Bill Atkinson was, was it, was it, was a total
devotee of that book? Well, I like whether it's consciousness or something else. I like the
storytelling part that we, it feels like for us humans, it feels like
there's a concrete, it's almost like literary programming. I don't know what the programming
going on on the inside, but I'm getting a nice story here about what happened. It feels
like I'm in control and I'm getting a nice, clear story, but it's also possible there's
a computation going on that's really messy.
There's a bunch of different competing ideas.
And in the end, it just kind of generates a story for you to a consistent story for you
to believe.
And that makes it all nice.
And so I prefer to talk about things that I have some expertise and then things which
I'm only on the sideline.
So there's a tricky thing. I don't know if you have any expertise in this. You might be a little
bit on the sideline. It'd be interesting to ask though, what are your thoughts on cellular
automata and the game of life? Have you ever played with those kind of little games? I think the game of life is wonderful and I, and shows all kind of stuff about how things
can evolve without the creator understanding anything more than the power of learning in a way.
But to me, the most important thing about the game of life
is how it focused for me,
what it meant to have free will or not.
Because the game of life is obviously totally deterministic.
Yes. And I find it hard to believe that anybody
who's ever had children cannot believe in free will.
On the other hand, this makes it crystal clear.
John Conway said he wondered whether it was immoral
to shut the computer off after he got into a particular
interesting play of the Game of Life. Wow. Yeah. So there is, to me, the reason I love the
Game of Life, it is exactly, as you said, a clear illustration that from simple initial conditions
with simple rules, you know, exactly how the system is operating
is deterministic.
And yet, if you allow yourself to lose that knowledge,
a little bit enough to see the bigger organisms
that emerge, and then all of a sudden,
they seem conscious.
They seem unconscious, but living.
If the universe is finite, we're all living in the game of life to slow down. I mean, it's
sped up a lot. But do you think technically some of the ideas that you used for analysis of
algorithms can be used to analyze the game of life.
Can we make sense of it or is it too weird? Yeah, I mean, I've got, I've got a dozen exercises in mind for
fascicle six that actually work rather well for that purpose.
But Bill Gospers came up with the algorithm that allows Goli to run down the town of
times faster.
You know the website called Goli.
And T-O-L-L-Y.
It simulates the cellular automata game of life.
Yeah, you got to check it out. Can I ask you about John Conway?
Yes, in fact, I'm just reading now the issue
of mathematical intelligence that came in last week.
It's a whole issue devoted to, you know,
memory, remembrance of him.
Did you know him?
I slept overnight in his house several times.
He recently passed away. Yeah, he died a year ago.
May, I think it was of COVID.
What are some memories of him, of his work that stand out for you? Is
that the on a technical level that any of his work inspire you on a personal level that
he himself inspire you in some way? Absolutely to all of those things, but let's see, when did I first meet him?
I guess I first met him at Oxford in 1967 when I was...
Wow.
Okay, that's a long time ago.
Yeah, yeah, you were minus 20 years old, I don't know, 1967.
But there was a conference where I think I spoke and I was speaking about something that no one has the
Knuth Bendig's algorithm now, but he gave it famous talk about knots. And I didn't know
at the time, but anyway, that talk had now the source of thousands and thousands of papers since then. And he was reported
on something that he had done in high school almost 10 years earlier before this conference,
but he never published it. And he climaxed his talk by building some nods.
You have these little plastic things that you can stick together.
It's something like Lego, but easier.
And so he made a whole bunch of nods in front of the audience and so on.
And then disassembled it.
So it was a dramatic lecture before he had learned how to give even more dramatic
lecture later. So all right. And.
Would you at that lecture? And I was there. Yeah, because I had to, you know, I was at the same
conference. For some reason, I was, I happened to be in in Calgary. at the same day that he was visiting Calgary. And it was spring of
of 72, I'm pretty sure. And we had lunch together. And he wrote down during the lunch on a napkin,
all of the facts about what he called numbers.
And he covered the napkin with the theorems about his idea of numbers.
And I thought it was incredibly beautiful.
And later in 1972, my sabbatical year began and I went to Norway. And in December of that year, in middle of the night, the thought came to me.
You know, Conway's theory about numbers would be a great thing to teach students how to invent research and what the joys are of research.
And, and so I said, and I had also read a book in dialogue by, by Alfred Renny,
where he kind of a suck-cratic thing where the two characters were talking to each other about mathematics and so I,
the two characters were talking to each other about mathematics and so I
And so At the end in the morning
I
will get my wife and said
Jill, I think I want to write a book about Conway's theory
and
You know, I'm supposed to be writing the art of computer programming doing all of a sudden stuff, but I got, but I really want to write this other book. And so we made this plan,
but I said, I thought I could write it in a week. And we made the plan then. So in January,
I rented a room in a hotel in downtown Oslo. We were in sabbatical in Norway.
I rented a room in a hotel in downtown Oslo. We were in sabbatical in Norway.
And I rented the hotel in downtown Oslo
and did nothing else except right up Conway's theory.
And I changed the name to surreal numbers.
And so this book is not published as surreal number.
And we figured out, we'd always wonder,
what do you like to have a fair enough hotel room?
So we figured out that she would visit me twice during the week
and things like this.
You know, we would try to sneak in.
This hotel was run by a mission organization.
These ladies were probably very strict, but anyway, so, so, so, and the
Wild Week in every way. But the thing is, I had lost that, I had lost that
napkin in which he wrote the theory, but like, I looked for it back in
front. So I tried to recreate for memory what he told me at that luncheon in Calgary.
And as I wrote the book, I was going through exactly what the characters in the book were supposed
to be doing. So I start with the two axioms and start out the whole thing and everything's
defined, flows from that, but you have to discover why. And, every mistake that I make as I'm trying to do discover it,
I, my characters make too, and so it was,
it's a long, long story,
but I work through this week,
and it was one of the most intense weeks of my life.
And I described it in other places.
But anyway, after six days, I finished it,
and on the seventh day I rested, and I sent my secretary
to type it.
It was flowing as I was writing it faster
than I could think almost.
But after I finished it, and tried to write a letter to my secretary telling her how to type it,
I couldn't write anymore.
So you gave it everything.
The muse had left me completely.
Can you explain how that week could have happened?
Like why is that seems like such a magical week of our life?
No idea, but anyway, there was some.
It was almost as if I was channeling.
So, so the book, it was typed, I sent it to Conway,
and he said, well, then you got the one axiom wrong.
It is a difference between less than or equal and not greater
than, I don't know.
The opposite of being greater than, and less than or equal.
But anyway, technically, it can make a difference
when you're developing a logical theory.
And the way I had chosen was harder to do than trans-original.
So, and we visited him at his house in Cambridge in April. We took a boat actually
from Norway over to across the channel and so on and stayed with him for some days.
And he talked about all kinds of things he had, he had puzzles that I'd never heard of before. He had a great way to solve the game of solitaire.
Many of the common interests that we'd, you know, he had never written up. But anyway,
then in the summertime, I took another week off and went to a place in the mountains of Norway and rewrote the book using the correct accent. So that was the most
intensive connection with Conway. After that, it started with an Appkin. But we would run into each other.
and run into each other. Well, yeah, the next really,
I was giving lectures in Montreal.
I was giving a series of seven lectures
about a topic called Stable Marriages.
And he arrived in Montreal
between my six and seventh lecture.
And we met at a party, and I started telling him about the topic I was doing.
And he sat and thought about it.
He came up with a beautiful theory to show that the technical terms,
it's that the set of all stable marriages, it forms a lattice.
And there was a simple way to find the greatest floor bound of two stable bearings and
least upper bound of two stable marrying.
And so I could use it in my lecture the next day.
And he came up with this theorem during the party.
And it's a brilliant answer.
It's a distributive lesson.
I mean, it's, you know, it added greatly
to the theory of stable matching.
So you mentioned your white Jill.
Imagine stable marriage.
Can you tell the story of how you two met?
So we celebrated 60 years of Wettadbliss last month and we met because I was dating her
roommate.
This was my sophomore year, her freshman year.
I was dating her roommate and I wanted her advice on strategy or something like this. And anyway, I found I enjoyed her advice better than her.
I enjoyed her roommate.
You guys were majoring the same thing?
No, no, no.
Because I read something about working on a computer in grad school,
on a difficult computer science topic.
So she's an artist and I'm a geek.
Okay.
And I'm a geek.
What was she doing with a computer science book?
All right.
I read the, was it the manual that she was reading?
What was she reading?
I wrote the manual that she had, had, she had to take a class in computer science.
Okay.
And, and, so you're the tutor.
No, no, yeah.
No, we, there were terrible times trying to learn certain concept, but I learned art
from her.
And so we worked together occasionally in design projects, but every year we write a Christmas card
and we each have to compromise our own notions of beauty.
Yes.
When did you fall in love with her?
That day that I asked her about her roommate.
Okay. I mean, no, I, I, okay. So you're, I don't mind telling
these things, depending on how you're far, how far you go, but, but, but, but, but, but, let me tell you,
I promise, I promise not to go too far. Let me tell you this, that I, I never really enjoyed kissing
Let me tell you this, that I never really enjoyed kissing until I found how she did it.
And 60 years.
Is there a secret you can say in terms of stable marriages of how you stayed together so long?
The topic's stable marriage, by the way, is not, is the technical term. Yes.
It's a joke, Don.
But two different people will have
to learn how to compromise and work together.
And you're going to have ups and downs and crises and so on.
And so as long as you don't set your expectation on having 24 hours of bliss,
then there's a lot of hope for stability. But if you decide that there's going to be no frustration,
if you decide that there's going to be no frustration.
So you're going to have to compromise on your notions of beauty when you write Christmas cards.
That's it.
You mentioned that Richard Feynman was someone you looked up to.
Yeah.
Probably you've met him in Caltech.
Well, we knew each other at Caltech for sure.
You are one of the seminal personalities of computer science.
He's one for physics.
Have you, is there specific things you picked up from him by wave inspiration or... So we used to go to each other's lectures and...
But if I saw him sitting in the front row,
I would throw me for a loop actually,
and I would miss a few sentences.
What unique story do I have?
I mean, I often refer to his time in Brazil
where he essentially said they were teaching
all the physics students the wrong way.
They were just learning how to pass exams
and not learning any physics.
And he said, if you want me to prove it,
here I'll turn to any page of this textbook learning any physics and he said, you know, if you want me to prove it, you know,
here I'll turn to any page of this textbook and I'll tell you what's wrong with this page and he did so and and the textbook I've been written by his host and and it was a big embarrassing
incident, but he had previously asked his host if he was supposed to tell the truth.
He approves the Azas host if he was supposed to tell the truth.
But anyway, it epitomizes the way education goes wrong in all kinds of fields and has to periodically
be brought back from a process of giving credentials to a process of giving knowledge.
That's probably a story that continues to this day in a bunch of places where it's too easy for educational institutions to fall into credentialism versus inspiration. inspiration, I don't know if those are words, but sort of yeah, understanding versus just
giving a little plaque.
And you know, it's it's very much like what we're talking about.
If you want the computer, if you want to be able to believe the answer, computer is
sure.
It's doing that one of the things Bob Floyd showed me in the 60s, he loved
this cartoon. There were two guys standing in front of, in those days, the computer was a big
thing. The first guy says to the other guy, this machine can do in one second what would take
a million people to do in a hundred years.
And the other guy says, oh, so how do you know it's right?
That's a good line. Is there some interesting distinction between physics and
math to you? Have you looked at physics much to like speak in a version of
Feynman? So the difference between the physics community, the physics way of thinking,
the physics intuition versus the computer science, the theoretical computer science,
the mathematical sciences. Do you see that as a gap or are they strongly overlapping?
It's quite different in my opinion. I started as a physics major and I switched into math.
Probably the reason was that I could get a plus on the physics exam,
but I never had any idea why I would have been
able to come up with the problems that were on those exams.
But in math, I knew I, I, I, I knew, you know, why the teacher set those problems,
and I thought of other problems that I could set to. And I believe it's, it's quite a different
mentality.
Is it has to do with your philosophy of geek, geek, dumb,
it, it, it, so it's, I mean, I saw some some of my computer scientists friends are really good at physics and
others are not. And I'm, you know, I'm really good at algebra, but not a geometry. Talk about
different parts of mathematics, you know, it's just, it's, so, so the different kind of physical,
but physicists think of things in terms of waves. And I can think of things in terms of waves,
but it's like a dog walking on high legs
if I'm thinking about it.
So you basically, you like to see the world
in discrete ways, and then it's more continuous.
Yeah, I'm not sure if Turing, when I grade physicist,
I think it was a pretty good
chemist by, I don't know, but anyway, I see things.
I believe that computer science is largely
driven by people who have brains
who are good at resonating with certain kind of concepts. And quantum computers
it takes a different kind of brain. Yeah, that's interesting. Yeah. Well, quantum computers
is almost like at the intersection in terms of brain between computer science and physics because they involve both at least at this time.
But the physicists have known they have incredibly powerful intuition.
And statistical mechanics and the random processes are related to algorithms in a lot of ways.
But there's lots of different flavors of physics.
There are different flavors of mathematics as well.
But the thing is that I don't see, well, actually, when they talk to physicists,
use completely different language. And when they're talking to, when they talk to physicists, use completely different language than they
when they're writing expository papers.
And so I didn't understand quantum mechanics at all
from reading about it in scientific American.
But when I read how they describe it
to each other, talking about eigenvalues
and various mathematical terms that made sense, then it made sense to me. But
Hawking said that every formula you put in a book, you lose half of your readers. And
so he didn't put any formulas in the book. So I couldn't understand his book at all.
You could say you understood it, but I really didn't.
Well, the Feynman also spoke in this way.
So Feynman, I think, provided himself
on a really strong intuition,
but at the same time, he was hiding
all the really good, the deep profutation he was doing.
So there was one thing that I was never able to,
I wish it had more time to work out with him, but
I guess I could describe it for you.
There's something that got my name attached to it called Knuth Aero notation, but it's
a notation for very large numbers. I find out that somebody invented it in 1830s.
It's fairly easy to understand anyway.
So you start with x plus x plus x plus x n times.
And you can call that x n.
So x n is multiplication.
Then you take x times x times X times X times X times n times, that gives you
exponentiation X to the nth power. So that's one arrow X. So Xn with no arrows is multiplication X
arrow n is X to the nth power. Yeah, it's just to clarify for the
to the n's power. Yeah.
Just to clarify for the, uh, so x times x times x and times is obviously x and x plus x
plus x and time.
Oh, yeah.
Okay.
And then, uh, x n, no, no, no, no, no, no, no, no, no, no, no, no, no, no, no, no, no, no,
no, no, no, no, no, no, no, no, no, no, no, no, no, no, no, no, no, no, no, no, no, no, no, no,
no, no, no, no, no, no, no, no, no, no, no, no, no, no, no, no, no, no, no, no, no, no, no, no, no,
no, no, no, no, no, no, no, no, no, no, no, no, no, no, no, no, no, no, no, no, no, no, no, no, no,
no, no, no, no, no, no, no, no, no, no, no, no, no, no, no, no, no, no, no, no, no, no, no, no, no, no, no, no, no, no, no, no, no, no, no, no, no, no, no, no, no, no, no, no, no, no, no, no, no, no, no, no, no, no, no, no, no, no, no, no, no, no, no, no, no, no, no, no, no, no, no, no, no, no, no, no, no, no, no, no, no, no, no, no, no, no, no, no, no, no, no, no, no, no, And then here the arrow is when you're doing the same kind of repetitive operation for the
explanation. So I put in one arrow and I get x to the nth power. Now I put in two arrows.
And that makes x to the x to the x to the x to the x n times the pattern power. So in other
words, if it's two double arrow three, that would be two to the two to the two so that
would be two to the fourth power that would be 16 okay so so that's the double
arrow and now you can do with triple arrow of course and and so on. And I had this paper called,
well, essentially big numbers.
You try to impress your friend by saying a number
they never thought of before.
And I gave a special name for it,
and designed a font for it that has script K and so on, but it really is 10, I think,
like 10 quadruple arrow three, and I claim that that number is so mind-boggling that you can't
comprehend how large it is. But anyway, I talked to Feynman about this, and he said, oh,
I talked to Feynman about this and he said, oh, that's just use double arrow. But instead of taking integers, let's consider complex numbers.
So you have dot x, I mean, okay, x, x arrow, arrow two, that means x, x, x, x, x, x,
x, x, double arrow, X double arrow to 2.5?
Well, that's not to try to figure out
that's interpolate between those.
But what about X double arrow,
I or one plus I or some complex number?
And so he claimed that there was no analytic function
that would do the job. But I didn't know how he could claim that that wasn't true.
And his next question was, did then have a complex number of arrows? arrows. Yeah, okay. Wow, okay. Okay, so that's that's fine. That's fine. Yeah.
Can you describe what the
news Morris Pratt algorithm does and how did you come to develop it? One of the many things
that you're known for and has your name attached to it. Yeah, all right.
So it should be actually Morris Pratt Knuth,
but we decided to use alphabetical order
when we published the paper.
The problem is something that everybody knows now,
if they're using a search engine,
you have a large collection of text and you want to know if the word canoe
with the peers anywhere in the text, or some other word that's less interesting than canoe.
That's the most interesting word.
Like Morris or something.
Like Morris, something. Meg Morris, right. So we have a large piece of text.
And it's all one long, one dimensional thing,
first letter, second letter, et cetera, et cetera.
And so the question, you would like
to be able to do this quickly.
And the obvious way is, let's say we're looking for Morris.
Okay, so we would go through and wait till we get to letter M.
Then we look at the next word and sure enough it's an O and then R.
But then that, well, too bad.
The next letter is E.
So we missed out on Morris.
And so we go back and start looking for another.
I'll call over you.
So that's the obvious way to do it.
And Jim Morris noticed there was a more clever way
to do it.
The obvious way would have started,
let's say we found that our M at character
position 1000, it was started next at character position 1000 and 1. But he said, we already
read the O and the R and we know that they are at M's. So we can start, we don't have to read those over again.
So, and this gets pretty tricky when the word isn't Morris,
but it's more like, Eberkadebra,
where you have patterns that are occurring.
Like repeating patterns.
And at the beginning, at the middle,
and at the end. So so he worked it out and he put it into the system software.
Berkeley, I think it was where he was writing some Berkeley Unix, I think it was some routine
I was supposed to find the currencies of patterns in Texas and we didn't explain it and so he found out that several months later somebody had
looked at it and looked right and so they ripped it out. So he had this algorithm but it
didn't make it through because he wasn't understood. Nobody knew about this particularly. Von Pratt also had independently
discovered a year or two later. I forget why. I think Von was studying some technical problem
about palindromes or something like that. He wasn't really,
about Palandromes or something like that. He wasn't really, one wasn't working on text searching,
but he was working on an abstract problem that was related.
Well, at that time Steve Cook was a professor at Berkeley.
It was the greatest mistake that Berkeley CST Department made was not to give him tenure.
So Steve went to Toronto.
But I knew Steve while he was at Berkeley.
And he had come up with a very peculiar theorem about a technical concept called a stack automaton. And a stack automaton is a machine that can't do everything a dream machine can do, but
it can only look at something on it at the top of a stack or it can put more things on the stack
or it can take things off the stack. It can't remember a long string of symbols, but it can remember them in reverse
orders. So if you tell a stack at Thomaton, ABCDE, it can tell you afterward, EDCBA, you
know, it doesn't have any other memory except there's one thing that it can see. And Steve cooked proved this amazing thing that says,
if a stack of automaton can recognize a language, where the strings of the language are length N,
any amount of time whatsoever. So the stack of automaton might use a zillion steps. A regular
computer can recognize that same language and time and log in.
So Steve had a way of transforming a computation
that goes on and on and on and on,
using different data structures
into something that you can do on a regular computer
of fast.
The stack of times that goes slow,
but somehow the fact that it can do it at all
means that there has to be a fast way.
So I thought this was a pretty cool theorem.
So I tried it out on a problem where I
knew a stack of time that time could do it,
but I couldn't figure out a fast way to do it on a regular computer.
I thought I was a pretty good programmer,
but by Goli, I couldn't think of any way to recognize
this language efficiently.
So I went through Steve Cook's construction.
I filled my blackboard with all the,
everything that stack of, Tomathan Dodd,
Tidginoy, I wrote down,
and then I tried to see patterns in that
and how did he convert that into a computer program
on a regular machine?
And finally I psyched it out.
What was the thing I was missing so that I could say,
oh yeah, this is what I should do in my program.
And now I have an official program.
And so I would never have thought about
that if I hadn't had his theorem,
which was purely abstract thing.
Well, then I used this theorem to try to intuit that if I hadn't had his theorem, which was purely abstract thing.
But then I used this theorem to try to intuit how to use the stack of automaton for the string matching problem.
Yeah, so, so the problem I had started with was not the string matching problem,
but then I realized that the string matching problem was another thing,
which would also be could be done by a stack of automaton.
was another thing which would also be, could be done by a stack of Thomata. And so when I looked at what that told me, then I had a nice algorithm for this string matching problem.
And it told me exactly what I should remember as I'm going through the string.
And I worked it out and I wrote this little paper called Automata Theory can be useful.
And the reason was that it was the first,
I mean, I had been reading all kinds of papers about Automata Theory,
but it never taught me, it never improved my programming for everyday problems.
It was something that you published in journals and, you know, it was interesting stuff. But here was a case where I couldn't
figure out how to write the program. I had a theorem for Mathematath theory, then I knew how to
write the program. So this was, for me, a change in life, I started to say, maybe I should learn more about him. And I showed this note to Ron Pratt and he said,
he's similar to something I was working on.
And Jim Morris was at Berkeley too at the time.
Anyway, he said,
an illustrious career, but I haven't kept track of Jim,
but one is my colleague
at Stanford and my student later.
But this would be for one, one was still a graduate student and hadn't come to Stanford
yet.
So we found out that we had all been working on the same thing.
So it was our algorithm, we each discovered it independently, but we should have had discovered a different a different part of the elephant
a different aspect of it. And so we could put our things together with my job to write the paper.
How did the elephant spring to life?
Spring to life was because I I had drafted this paper, a ton of theory.
because I had drafted this paper, a ton of theory.
Oh, it can be useful, which was seen by Vaughan,
and then by Jim, and then we combined.
Because maybe they had also been thinking of writing
something up about it.
A ball specifically is stringed.
This is a stringed, stringed,
and proud men, period.
Let me ask a ridiculous question. Last time we talked, you told me what the most
beautiful algorithm is actually for strongly connected graphs. What is the hardest problem,
puzzle, idea in computer science for you personally that you had to work through. Just something that was just a thing that I've ever been involved with.
Yeah. Okay. Well, yeah, that's, I don't know how to answer questions like that,
but in this case, it's pretty clear.
Okay. Because it's called the birth of the giant component.
Okay, so now let me explain that
because this actually gets into physics too
and it gets into something called
Bose-Einstein statistics, but anyway,
it's got some interesting stories
and it connected with Berkeley again.
So start with the idea of a random graph. Now this is,
here we just say we have end points that are totally unconnected and and there's no
geometry involved. There's no saying some points are further apart than others. All points are exactly alike.
And let's say we have 100 points.
And we number them from 0 to 9.9.
All right.
Now let's take pi, the digits of pi,
so two at a time.
So we had 31, 41, 59, 26.
We can go through Pi.
And so we take the first two, 31, 41.
And let's put a connection between 0.31 and 0.41.
That's an edge in the graph.
So then we take 59, 9, 2, 6 and make another edge. And the graph gets
bigger, gets more and more connected as we add these things one at a time. Okay. So we start
out with end points and we add M edges. Okay. Each edge is completely, we forgot about edges we had We have a lot of issues.
We have a lot of issues.
We have a lot of issues.
We have a lot of issues. We have a lot of issues. We have a lot of issues.
We have a lot of issues. We have a lot of issues.
We have a lot of issues.
We have a lot of issues.
We have a lot of issues.
We have a lot of issues.
We have a lot of issues.
We have a lot of issues.
We have a lot of issues.
We have a lot of issues.
We have a lot of issues.
We have a lot of issues.
We have a lot of issues.
We have a lot of issues.
We have a lot of issues.
We have a lot of issues. We have a lot of issues. We have a lot of issues. We have a lot of issues. We evolving a graph at random.
And a magical thing happens when the number of edges
is like 0.49 and two, two, maybe end is a million.
And I have, you know, 490,000 edges.
you know, 490,000 edges, then almost all the time it consists of isolated trees, not even any loops.
It's a very small number of edges so far.
About a little less than half an.
And.
But if I had 0.51 edges, it's a little more than half in. So, you know,
a million points, 510,000 edges. Now, it probably has a one component that's much bigger than the others.
that's much bigger than the others.
And we call that the giant component.
Is that okay, can you clarify? So can you clarify?
So is there a name for this kind of random, super cool
pi random graph?
Well, I call it the pi graph.
No, no, the pi graph is actually,
my pi graph is based on binary representation of pie,
not the decimal representation of pie,
but anyway, let's suppose I was rolling dice instead.
So I'm sorry.
So it doesn't have to be pie.
Any source of, the point is every step,
choose totally at random one of those end points.
Choose totally at random another one of the end points.
Make that an edge.
That's the process.
Yeah.
So there's there's nothing magical about pie.
No, I was using pie to sort of saying pie is sort of random that nobody knows a pattern in exactly got it.
I've got it. But it's not yeah, I could have just as well drawn straws or something.
This was a concept invented by Erdish and Rainey and they called evolution of random graphs.
And if you start out with with the large number and you repeat this process, all of a sudden a big bang happens at one half end.
There'll be two points together
then maybe we'll have have three
and then maybe branch out a little bit,
but they'll all be separate until we get to one half end.
And we pass one half end and all of a sudden,
there's subsist to it, there's a big clump of stuff
that's all joined together.
So it's almost like a phase transition of some kind?
It's exactly, it's a phase transition,
but it's a double phase transition in terms of it.
It happens, there's actually two things going on
at this phase transition, which is very remarkable about it.
Okay, so a lot of the most important algorithms are based
on random processes, and so I want to understand random processes now.
And so there are data structures that sort of grow this way.
Okay, so Dick Carp, one of the leading experts
on randomized algorithms had his students working,
looking at this at Berkeley.
And we heard a rumor that the students had found
something interesting happening.
The students are generating this,
or similarly, this random evolution of graphs.
And they're taking a snapshot.
It was so often to take a look at what the graph is.
And the rumor was that every time they looked,
there was only one component that had loops in it,
almost always.
They do a million experiments.
And only three or four times did they ever happen
to see a loop at this point.
No, more than one component with a loop.
So they watch until the graph gets completely full,
so it starts out totally empty
and gets more and more edges all the time.
And so, okay, certainly a loop comes along once.
But now all the loops stay somehow joined to that one.
They're never were two guys with loops.
Wow, interesting.
In these experiments, okay.
So anyway, almost always. Wow. Interesting. Okay. In his experimental. Okay. So anyway, this almost always
turning not always. Yeah. But but but with high, very high probability, this need to be true. So
so we heard about this rumor as Stanford and we said, if that's true, then must, you know,
lot more of us also be true. So there's a whole, but there's a whole theory out there waiting
to be discovered that we haven't ever thought about. So, there's a whole theory out there waiting to be discovered
that we haven't ever thought about.
So, let's take a look at it.
And so, we look closer and we find out, no,
it actually, it's not true.
But, but in fact, it's almost true.
Namely, there's a very short interval of time when it's true.
And if you don't happen to look at it during that short interval of time, then you miss it.
So the, in other words, they'll be a period where there are two or three components have loops, but they joined together pretty soon.
Okay. So if you don't have a real fast shutter speed, you're going to miss that
instant. So separate loops don't exist for long. That's it. Yeah. You know, I started
looking at this to make it quantitative. And basically, the problem was to slow down the
big bang so that I could watch it happening. Yeah. I think I can explain it
actually in fairly elementary terms even without writing a formula. That's right. Like Hawking would do
and and so that's that's watch the evolution and at first these edges are coming along and they're
just making things without loops,
which we call trees, okay?
So then all of a sudden a loop first appears.
So at that point, I have one component that has a loop.
All right, now I say that the complexity of a component
is the number of edges minus the number of vertices.
So if I have a loop, I have like a loop of length five,
has five edges and five vertices.
Or I could put a tail on that.
And that would be another edge or another vertex.
It's like a zero, one, two complexity kind of thing.
So if the complexity is zero, we have one loop loop I call a cycle or I call a cyclic
component. So cyclic component looks like a a a wheel to which you attach fibers or trees,
they go branching, but there's no more loops. There's only one loop and everything else feeds
into that loop, okay?
And that has complexity zero.
But a tree itself has complexity minus one
because it has, you know, like it might have 10 vertices
and nine edges to tie them together.
So nine minus 10 is minus one.
So complexity minus one is a tree.
It's got to be connected. That's what I mean by a component. It's got to be connected.
So if I have 10 things connected, I have to have 9 edges.
Can you clarify why when complexity goes, can go above 0? I'm a little...
Yes, right. So the complexity plus one is the number of loops.
So if complexity is zero, I have one loop.
If complexity is one, that means I have one more edge than I have herdex.
So I might have like 11 edges and 10 vertices.
So we call that a bicycle because it's got two loops and it's
got to have two loops in it. Well, why can't it be trees just going off of the loop?
That I would need more edges than I. All right, right. Okay, I got. So every time I get another loop, I get another excess of edges over vertices. Okay. So in other words,
we start out and
after I have one loop, I have one component that has a cycle in it. Now the next step
according to the rumor would be that at the next step I would have a bicycle
in the evolution of almost all graphs. It would go from cycle to a bicycle.
But in fact, there's a certain probability it goes from cycle to two different cycles.
And I worked out the probability with something like five out of 24.
It was pretty high.
It was substantial.
Yeah.
But still soon they're going to merge together almost like, okay, so, so that's
so cool.
But but then it splits again after you have either either two or one one,
the next step is you either have three or you have two one or you have either either two or one one, the next step is you either have three
or you have two one or you have one and one one.
Okay, and so I worked out the probability
for those transitions.
And I worked it up to the first five transitions
and I had these, so I had these strange numbers, five 2424s and I stayed up all night and about 3 a.m.
I had the numbers computed it and I looked at them and here were the denominator was something like
223023.
So the probability was something over two, three, all two, three.
I don't know how you worked that out, but I had a formula that I could calculate the probability.
Yeah.
And I could find the limiting probability as then goes to infinity and it turned out to
be this number, but the denominator was two, three, and I looked at the denominator and
I said, wait a minute, this number factors, because one thousand and one is equal to seven times
11 times 13.
I had learned that in my first computer program.
So, so, so, so, so, so, so, so, so, so, so, so, so,
so 23, oh 23, oh 23, yeah, is seven times 11 times 13
times 23.
That's not a random number.
There has to be a reason why those small primes appear in the denominator.
But my think so all of a sudden that suggested another way of looking at the problem where small prime factors would occur.
So what would that be? So that said, oh, yeah, let me take the logarithm of this
formula and sure enough, it's going to simplify. And it happened. So I wouldn't have noticed it
except for this factorization. Okay, so I go to bed and I say, okay, this looks like I'm
going down the big bang. I can figure out what's going on here.
And the next day, it turned out Bill Gates
comes to Stanford to visit.
They're trying to sell him on donating money
for a new computer size building.
Sure.
And they gave me an appointment to talk to Bill.
And I wrote down on the blackboard
this evolutionary diagram, you know, going
from one to two, five, twenty-fourths in all this business.
Yeah.
And I wrote it down.
And anyway, at the end of the day, he was discussing people with the development office
and he said, boy, I was really impressed with what Professor Knuth said about this giant component.
And so, you know, I love this story because it shows that theoretical computer science is really worthwhile.
Does Bill, have you ever talked to Bill Gates about it since then?
Yeah. That's a cool, that's a cool little moment in history. That's cool. But anyway,
he happened to visit on exactly the day after I had I had found this pattern and that allowed me
to crack the problem. So, you know, so I could develop the theory, the theory some more and
understand what's happening in the big, but because I could now write down explicit
formulas for stuff. And so it would, you know, you worked not only the first few steps, but also
they'll study the whole process. And I worked further and further and I got with two authors,
co-authors, and we finally figured out that the probability that the rumor is true, in other words,
look at the evolution of a random graph
going from zero to complete and say,
what's the probability that at every point in time,
there was only one component with a cycle.
We started with this rumor saying there's only one cycle, there's only one component with a cycle. We started with this rumor saying there's only one cycle,
there's only one component with a cycle.
And so the rumor was that it's 100%.
The rumor was that it was 100%.
It turned out the actual numbers is like 87%.
Or I don't know, I should remember the number,
but I don't have it with me.
But anyway, but the number, but I don't have it with me. But anyway, but the number, it turned out to be like 12 over pi squared or so.
It was a nice, it related to pi.
Yeah.
And we could never have done that with it.
But that's the hardest problem I ever felt in my life was to prove that this
probability is... It said you was proven. The probability was proven. Yeah, I was able to prove this
that this and this shed light on a whole bunch of other things about random graphs that were sort of
the major thing we were after. That's super cool. What was the connection to physics that you mentioned?
Well, both Einstein statistics is a study of how molecules bond together without geometry
or without distance.
You created the tech type-setting system and released it as open source.
Just on that little aspect, why did you release it as open source?
What is your vision for open source?
No, okay. Well, the word open source didn't exist at that time, but I didn't want proprietary rights over it because I saw how proprietary rights were
holding things back. In the late 50s, people at IBM developed the language called Fortran.
They could have kept it proprietary. They could have said only IBM can use this language. Everybody else has to, but they didn't. They said anybody
who can write, who can translate for training into the language of their machines is allowed to
make for tank operators too. On the other hand, in the topography industry, I had seen
On the other hand, in topography industry, I had seen a lot of languages that were developed
for composing pages.
And each manufacturer had its own language,
for composing pages.
And that was holding everything back
because people were tied to a particular manufacturer
and then a new equipment is invented later, but printing
printing machines they have to expect to advertise the cost over 20, 30 years. So you didn't want that
for tech? I didn't need the income. I already had a good job and my books were, people were buying enough books that I, that it would
bring me plenty of supplemental income for everything my kids needed for education
and whatever.
So there was no reason for me to try to maximize income any further.
Income is sort of a threshold function. If you don't have, if you don't have enough, you're
starving. But if you get over the threshold, then you start thinking about philanthropy or
trying to take it with you. But anyway, there's a, I, my income was over the threshold. So I didn't need to keep it. And so I
specifically could see the advantage of making it open for everybody.
Do you think most software should be open? So I think that people should charge for non-trivial software, but not for trivial software.
Yeah, you give an example of I think Adobe Photoshop versus GIMP on Linux as Photoshop has value.
So it's definitely worth paying for all the stuff, I mean, and I mean, well, they keep adding,
adding stuff that's, that my wife and I don't care about,
but somebody I've done, but I mean,
but they have built in a fantastic,
a new feature, for example, in Photoshop,
where you, you can go through a sequence of the thousand
complicated steps on graphics and it can take you back anywhere in that sequence.
Yeah, that's a long history.
With really beautiful algorithm, I mean, yeah, it's...
Oh, that's interesting.
I didn't think about what algorithm.
It must be some kind of a fishing representation.
It's really, yeah, I know.
I mean, there's a lot of really subtle Nobel Prize class
like creation of intellectual property in there.
And with patents, you get a limited time to,
I mean, eventually, the idea of patents is that you publish
so that it's not a trans-secret.
That said, you've said that I currently use Ubuntu Linux on a standalone laptop.
It has no internet connection.
I occasionally carry flash memory drives between the machine and the max
that I use for network surfing and graphics, but I trust my family jewels only to Linux.
Why do you love Linux? The version of Linux that I use is stable, I can have to upgrade one
of these days, but to a newer version of Ubuntu. Yeah, I'll stick with Ubuntu, but right now I'm going to have to upgrade one of these days, but do a newer version of a Bonto.
Yeah, I'll stick with a Bonto, but right now I'm running something that doesn't support a lot
of the new software. The last day, I don't remember the number of like 14. Anyway, it's quite,
like 14 or anyway, it's quite and I'm going to get a new computer. I'm getting new solid state memory instead of a hard disk.
Yeah, the basics.
Well, let me ask you, thinking on the topic of tech,
when thinking about beautiful typography,
what is your favorite letter, number, or symbol?
I know, I know.
Ridiculous question.
But is there something?
I'll show you there.
Or look at the last page.
At the very end of the index. Look at the last page.
At the very end of the index.
What is that? There's a book by Dr. Seuss called On Beyond Zebra, and he gave a name to that.
Did you say Dr. Seuss gave a name to that?
Dr. Seuss, this is a S-E-U-S-S-E.
He wrote children's books in the 50s 40s and 50s. Wait, you talk about cat in the hat?
Cat in the hat, yeah. That's it, yeah. I like how you hit the spot. Yeah, Dr. Suis did not come to the Soviet Union, but since you...
Oh, actually, I think he did actually a little bit when we were...
That was a book, maybe Katana Had or Green Eggs in Ham, I think was used to learn English.
or green eggs in ham, I think was used to learn English. Oh, okay.
So I think it made it in that way.
I think it was my, okay, I didn't like those as much,
it has Bartholomew Cubans, but I used to know Bartholomew Cubans
by heart when I was young.
So what the heck is this symbol we're looking at?
That's so much going on.
He has a name for it at the end of
his book on beyond zebra. Who made it? He did. He did. So there's it looks like a bunch of vines.
Is that symbol existent? By the way, he made a movie in the early 50s. I don't remember the name of the movie now,
you probably find it easy enough,
but it features dozens and dozens of pianos
all playing together at the same time.
And but all the scenery is sort of based on the kind
of artwork that was in his books and the fantasy
big, you know, based of
Sousland or so. And I saw the movie only once or twice, but it's
but it's quite like to see it again.
That's that's really fascinating that you gave them, they
gave them shout out here. Okay. Is there some elegant basic symbol that you're attracted to?
Some give something that gives you pleasure,
that something used a lot?
Pi. Pi, of course.
I try to use Pi as often as I can when I need a random example,
because it doesn't have any known characters. And when I need a random example,
because it doesn't have any known characters. So for instance, I don't have it here to show you,
but do you know the game called Masu, M-A-S-Y-U?
No.
It's a great recreation.
I mean, Sudoku is easier to understand,
but Masu is more addictive.
You have black and white stones like a gold board.
And you have to draw a path that goes straight through
a white stone and makes the right angle turn out the black stone.
And it turns out to be really a nice puzzle
because it doesn't involve numbers.
But it's visual, but it's 3D pleasant to play with.
So I wanted to use it as example
in art of computer programming.
And I have exercised on how to
design cool Masu puzzles and you can find it on Wikipedia certainly as an example,
M-A-S-Y-U. And so I decided I would take PIE the actual image of it, and I had pixels.
And I would put a stone wherever it belongs in the letter pi, in the Greek letter pi.
And the problem was find a way to make some of the stones white, some of the stones black,
so that there's a unique solution to the mosfet puzzle.
That was a good test case for my algorithm on how to design mosfet puzzles
because I insist in advance that the stones
had to be placed in exactly the positions
that make a letter pi, make a huge letter.
Oh, that, all right.
That's cool.
And so, you know, and it turned out there was a unique way to do that.
And so Pi is a source of examples where I can prove that I'm starting with something
that isn't canned.
And most recently I was writing about something called graceful graphs. Graceful graphs is the following.
You have a graph that has M edges to it. And you attach numbers to every vertex in the following way. So every time you have an edge between vertices, you take the difference
between those numbers. And that difference is, it's got to be, tell you what edge it is. So,
one edge, two numbers will be one apart. There'll be another edge where the numbers are two apart.
And so, great computer problem. Can you find a graceful way to label a graph?
So I started with a graph that I use
for an organic graph,
not a mathematically symmetric graph or anything.
And I take the 49 states of the United States,
the edges go from one state to the next state. So for example, California,
be next to Oregon, Nevada, Arizona. Okay. And I include District District of Columbia,
so I have 49, I can't get it. Alaska and Hawaii in there because they on touch. You have to be able to drive from one to the other.
So is there a graceful labeling of the United States?
Each state gets a number.
And then if California is number 30 and Oregon is number 11,
that edge is going to be number 19,
the difference between those.
Okay. So is there a way to do this for for all the states and at
And so I was I was thinking of having a contest
I for people to get it as graceful as they could
But my friend Tom Rookiki
Actually solved the problem by proving that I mean I was able to get it down
Within seven or something like that. He was able to get it down within seven or something like the eight but he was able to get a perfect solution. The actual solution or to prove that
a solution exists. More precisely I had figured a hard way to put labels on so that all the
all the edges were labeled somewhere between one and a hundred and seventeen but there were some
some gaps in there.
Because I should really have gone from one to 105
or whatever the number is.
So I give myself a lot of slack.
He did it without any slack whatsoever,
perfect graceful labeling.
And so I call out the contest
because the problem has already settled them too easy in sense because Tom was able to do it in an afternoon. So I call out the contest because problems already
sell them too easy in the sense because Tom was able to do it
in an afternoon.
Sorry, he did the algorithm or for this particular for the
United States.
For the United States.
This problem is this problem is incredibly hard.
I mean, for the general general is good.
But it's like it's like coloring.
But it was very lucky that we worked for the United States.
Sure. I think, but I mean, the theory is still very incomplete. But, but anyway,
then Tom came back a couple of days later and he had been able to not only find a graceful labeling,
but he, but the label of Washington was 31. The label of Idaho was 41, following the digits of pi.
Yeah.
Going across the topic, the United States, he has the digits of pi.
Does he do it on purpose?
He was able to still get a graceful labeling with that extra thing.
Wow.
Wow.
It's it's
a miracle. Okay. But I like to use pie in my book. You see, and this is
all roads lead to pie. Yeah, somehow, somehow often hidden in the middle of the most
difficult problems.
Can I ask you about productivity?
Productivity.
Yeah, you said that, quote, my scheduling principle
is to do the thing I hate most on my to-do list.
By week's end, I'm very happy.
Can you explain this process to a productive life?
Oh, I see. Well, but all the time I'm working on and what I want, what I don't want to do,
but still I'm glad to have all those unpleasant tasks finished.
Yes. Is that something you would advise to others? other. Well, I, yeah, I, I, I don't know how to say it.
Well, during the pandemic, I feel my productivity actually went down by half.
Because I have to, um, I have to communicate by writing, which is slow. I have to,
I mean, I, I don't like to send out a bad sentence. So I go through and reread what I've written and edit and fix it.
So everything takes a lot longer when I'm communicating
by text messages instead of just together with somebody
in the room.
And it's also slower because the libraries are closed and stuff. But there's
another thing about scheduling that I learned from my mother that I should probably tell you,
and that is different from what people in robotics feel do, which is called planning.
So she had this principle that was see something that needs to be done and do it. Instead of saying,
I'm going to do this first and do this first. Just do it. Oh, yeah, pick this up.
But you're at any one moment, there's a set of tasks that you can do. And you're saying a good
heuristic is to do the the one you want to do least. Right. The one I haven't got any good reasons.
That'll never be able to do it any better than I am now.
There are some things that I know if I do something else first, I'll be able to do that one better.
But there's some that are going to be harder because, you know, I've forgotten some of the groundwork that went into it or something like that.
So I just finished a pretty tough part of the book.
And so now I'm doing the parts that are more fun.
But the other thing is as I'm writing the book,
of course I want the reader to think that I'm happy all the time
I'm writing the book.
It's upbeat.
I can have humor.
I can say this is cool, you know, well, and
this, I have to, I have to disguise the fact that it was painful in any way to come up
with this.
The road to that excitement is painful. Yeah. It's laden with pain. Okay. Is there, you've
given some advice to people before, but can you, can you, you give me too, too much credit,
but anyway, this is my turn to say things that I believe, but I want to preface it by
saying, I also believe that other people do, how do these things much better than I do so I can only tell you my my side of it.
So can I ask you to give advice to young people today to high school students to college students whether they're geeks or the other kind about how to live a life that it can be proud of, how to have a successful career,
how to have a successful life.
It's always the same as I've said before, I guess, not to do something because it's trendy,
but it's something that you personally feel that you were called to do rather than somebody
else expects you to do.
How do you know you're called to do something?
You try it and it works or it doesn't work.
You learn about yourself.
Life is a binary search.
You try something and you find out, oh yeah, I have a background that helped me with
this. Or maybe I could do this if I worked a little bit harder, but you try something else and you say,
I have really no intuition for this and it looks like it doesn't have my name on it.
Was there advice along the way that you got about what you
should and shouldn't work on or do you just try to listen to yourself? Yeah, I
probably overreact another way when something when I see everybody else doing
some way I probably I probably say that too much competition. I don't know.
But mostly I played with things that were interesting to me.
And then later on I found, oh, actually the most important thing I learned was how to
be interested in almost anything.
I mean, not to be bored.
It makes me very sad when I see kids talking to each other
and they say that was boring.
And to me, a person should feel upset if he had to admit
that he wasn't able to find something interesting.
Yeah. So it you know, skill, they say, I haven't learned how to, how to enjoy life. I have to have
somebody entertain me instead of. Right. That's really interesting. It is a skill. David Foster Wallace,
I really like the thing he says about this, which is the key to life is to be unborrable.
And I do really like you saying that it's a skill, because I think that's a really good,
that's really good advice, which is if you find something boring, that's not, I don't
believe it's because it's boring, it's because you haven't developed a deal.
I have learned how to find the beauty and how to find the fun in it.
Yeah, that's a really good point.
Yeah, I know.
Sometimes it's more difficult than others to do this.
I mean, during the COVID, lots of days when I never saw another human being,
but I still find other ways to...
It still was a pretty fun time.
Yeah, well, I came a few minutes early today
and I walked around for us to see.
I didn't know what was going on in the first city.
I saw some beautiful flowers at the nursery at Home Depot
from a few blocks away.
Yeah.
Life is amazing.
It's full of amazing things like this.
Yeah, I just sometimes I'll sit there
and just stare at a tree.
The nature is beautiful.
Let me ask you the big ridiculous question.
I don't think I asked you last time.
So I have to ask this time in case you have a good answer. What is the meaning of life?
Our existence here on earth, the whole thing. Do you have...
No, no, you can't. I will not allow you to try to escape answering the question.
You have to answer definitively because they're surely, surely Don Canuth, there must be an answer.
What is the answer? Is it 42 or four?
Yes. Well, I don't think it's an numerical. That's the, that's the, that was, that was in, in Zen and,
okay. But all right. So, took took 20 wait. It's only for me and
but I but I personally
think of my belief that that God exists, although I have no idea what that means, but I believe that there is
what that means. But I believe that there is something that goes beyond the realm of
human understanding, but that I can try to learn more about how to resonate with whatever that being would like me to do.
So you think you can have occasional glimpses of that being?
I strive for that, not that I ever think I'm going to get close to it, but it's not for me.
It's not for me. It's saying, what should I do that that being wants me to do? That's, that's, you know, I, I'm trying to ask.
What that, I mean, does that being want me to be talking to likes, Friedman right now, you know, and I said yes. Okay, but thank you. Well, thank you.
But what I'm trying to say is I'm trying to say what of all the strategies I could choose
or something which one.
I try to do it not not strategically, but I try to imagine that I'm following somebody's wishes.
Even though you're not smart enough to know what they are.
Yeah.
But I find you a little dance.
Well, I mean, this AI or whatever is probably is smart enough to help
to give me clues.
And to make the whole journey from clue to clue a fun one.
Yeah, I mean, it's as so many people have said it's the journey, not the destination.
And people live, live through crises, help each other.
All you think things come up. History repeats itself. You try to say
in the world today, is there any government that's working? I read history, I know that things were
they were there were a lot worse in many ways. There's a lot of bad things all the time.
And I read about, you know, I look at things
and people had good ideas.
And they were working on great projects.
And then I know that it didn't succeed, though, in the end.
But the new insight I've gotten, if you actually,
in that way was, I was reading, what book was I reading recently? It was by
Ken Follett and it was called The Man from St. Petersburg, but it was talking about the
prequel to World War I and Winston Churchill, according to this book, it sees that Germany has been spending all its gold reserves building
up a huge military.
And there's no question that if Germany would attack England, that England would be wiped
out.
So he wants Russia to help to attack Germany from the other side because Germany doesn't
have enough of an army to be fighting
two wars at one. Okay, now there's an anarchist in Russia who sees that wars are something that start, but actually people get killed. And so he wants to stop any alliance between England
and Russia because that would mean that, found that the people of Russia would be killed,
that wouldn't be otherwise killed. All right. And so his life's goal is to assassinate a Russian prince who is visiting England because
that will mean the Zahar will not form the alliance.
So we have this question about what should the government do?
Should it actually do something that will lead to,
is the war inevitable or is there a way to have peace?
And it struck me that if I were in a position
of responsibility for people's lives,
in most cases, I wouldn't have any confidence
that any of my decisions were good.
That these questions are too hard, probably for any human being, but certainly for me.
Well, I think coupling the not being sure that the decisions are right.
So that's actually a really good thing.
Coupled with the fact that you do have to make a decision
and carry the burden of that.
And ultimately, I have faith in human beings
in the great leaders to arise and help build a better world.
I mean, that's the hope of democracy.
The optimal.
Yeah, Ben, let's hope that we can enhance their abilities with algorithms.
We'll put that. It's such a huge honor. You've been an inspiration to me and to millions for
such a long time. Thank you for spending your really valuable time with me.
Once again, it's a huge honor. I really enjoyed this conversation.
Thanks for listening to this conversation with Donald Knuth. To support this podcast,
please check out our sponsors in the description. And now, let me leave you some words from
Don Knuth himself. Science is what we understand well enough to explain to a computer. Art is
everything else we do. Thank you.