20 videos · Jun 22, 2026
The video from ASAP Science presents a fun and catchy way to remember the first 100 digits of pi, starting with 3.14159 and continuing with a rhythmic recitation of the digits. It emphasizes the mathematical relationship of circumference to diameter while engaging viewers with a lively performance. The creators encourage viewers to learn the digits, share their knowledge, and subscribe for more science content released weekly. Links to download the song are provided in the description for those interested in studying or sharing it with friends. Overall, the video combines education with entertainment, making math enjoyable.
and now ASAP science presents 100 digits of pi 3.14159 this is PI followed by 2 6 5 3 5 8 9 circumference over diameter 7 9 and 3 2 3 OMG can't you see 8 4 6 2 6 4 3 and now we're on a 338 at 32 now we're blue o new 7950 and then a 288 and 41 and so much fun now a run that's a 1 6 9 3 9 a threesome 51 halfway done now don't be late 209 where's the wine 7 4 it's on the floor the 9 / 4 5 9 jim tweto we got it go 7 8 we can't wait 1 6 4 o sixty-day we're almost near the end keep going 6 each oh we're getting through Oh 8 9 and 10 then 542 11 7 Oh in 67 we're done was that one where the random digit so that you can break your hands thank you guys for watching if you want to get the song we'll put links for iTunes and anywhere else in the description that you can check out study it brag to your friends okay and make sure you subscribe to this channel for new science weekly videos every Thursday and we'll see you next week yeah
Pi Network has made a significant advancement by integrating Pi as a selectable currency in Open Pay, marking a shift from theoretical concepts to practical application. This development suggests that Pi is moving towards real-world usability, allowing users to spend it like traditional currencies on everyday transactions. The community is eagerly anticipating an upcoming announcement from the Pi core team, which could reveal major utility developments, partnerships, or a detailed roadmap for the ecosystem's future. Additionally, the introduction of a verified and unverified app classification system within the Pi browser aims to enhance user security and trust, ensuring that only vetted applications can handle real Pi transactions. As the network grows, the emphasis on user education and security becomes crucial, highlighting the responsibility users have in managing their assets in a decentralized environment.
Pi is showing up on Open Pay as a selectable currency, not a rumor, not a leaked screenshot from a Telegram group. Pioneers are logging into Open Pay right now and seeing pure Pi listed as an actual payment option. Let that sink in for a moment. This is not a concept.
This is not a white paper promise. This is Pi sitting inside a real payment interface, ready to be used in a real transaction. And if you understand what that actually means for the broader utility story of Pi Network, then you already know why this is one of the most significant developments to come out of the ecosystem in recent months. Let me walk you through everything the Open Pay development, the verified and unverified app classification system, the Uber Eats style vision that pioneers are now openly discussing, and the very real question that is sitting on everybody's mind right now.
What is Pi core team actually preparing to announce? And are we about to hear something worth hearing? According to multiple community observers and pioneers who have shared screenshots across social platforms, pure Pi Pi is now appearing as a selectable currency option inside Open Pay. This is not an unofficial integration.
This is not a third-party workaround. The currency is listed, it is selectable, and pioneers across the globe are watching it very closely. Now, why does this matter? Online, transactions using Pi Network have long been described as one of the core features expected to develop as the ecosystem matures.
The idea has always been that Pi would eventually move beyond the mining phase and become something people actually spend, something that functions the way real money functions in a digital economy. The Open Pay appearance is a direct signal that this transition is no longer theoretical. It is beginning to take shape in real infrastructure. And here is where the analysis gets interesting.
When you connect this development to the broader conversation about credit card integration with Pi network where users can link credit cards to their Pi accounts and make transactions more seamlessly. You start to see a payment ecosystem beginning to form. Not a finished product, but a framework that is actively being built. If Pi becomes connected to credit card infrastructure, the daily use case for Pi expands dramatically.
You are no longer just holding Pi in a wallet waiting for an exchange listing. You are spending Pi on groceries, on subscriptions, on food delivery. You are using Pi the way people use dollars, euros, or Naira right now. Now, imagine this scenario and I want you to really think about this one.
You open Uber Eats. You go to checkout and right there next to your saved card and your PayPal, you see an option that says pay with Pi. Your favorite Jollof rice spot is on the app. Your order is ready and Pi is sitting in your wallet right now.
How many orders do you think get placed the moment that option appears? How many pioneers across Nigeria, across the Philippines, across Vietnam, across the United States suddenly have a reason to spend Pi on something they were already going to buy anyway? According to community discussions that are circulating right now, this exact concept is what pioneers are imagining when they talk about real world Pi utility. The vision is not complicated.
It does not require a PhD in blockchain architecture to understand. It is simply this Pi goes where the people are and the people are on Uber Eats, on Amazon, on everyday commerce platforms. The moment Pi appears there as a real payment option, the volume of transactions circulating through the Pi ecosystem becomes enormous and that is the goal. That has always been the goal.
The open pay listing is one step in that direction. Now, let us talk about what is coming in less than 7 days because the Pi core team is approaching what the community is treating as is major announcement window and the questions being asked right now are sharp, direct, and completely fair. Is the Pi core team ready? Are we ready?
Should expectations go up, or should they come down? These are not negative questions. These are the questions that every serious pioneer needs to be asking right now, because the community has waited, and I mean really waited. There are pioneers out there, deeply committed, long-term believers, who have already set a personal deadline of 2029 to 2030.
If Pi does not deliver something genuinely substantial by then, they are done. Seven years of building, seven years of patience, and some are already calculating whether a total of 14 years is what it is going to take. Seven years to build the foundation, seven years to establish the ecosystem, and yes, someone already did the math, 22 divided by seven. Pi is everywhere, even in arithmetic.
So, what is this upcoming announcement going to bring? Is it going to be another extended technical presentation full of terminology that only developers fully understand? Or is it going to be something that the average pioneer can look at and say, that is it. That is the moment I was waiting for.
Possible outcomes from what I am seeing discussed across the community. A major utility announcement that confirms real-world Pi usage in a specific sector. A detailed roadmap with hard timelines and measurable milestones. A partnership reveals that places Pi inside existing commercial infrastructure.
Or, on the less exciting end, a series of smaller ecosystem updates and developer-facing improvements that are meaningful, but do not move the crowd. My read on this is that the pressure is genuinely high right now. The open pay appearance, the credit card integration discussions, and the verified app structure are not random. They are all moving in the same direction, and the announcement, whatever it turns out to be, is landing at a moment when the ecosystem has more visible momentum than it has had in a long time.
Let us now talk about the verified and unverified app classification system inside Pi browser because this is something the community needs to understand deeply and I do not think it is getting enough focused attention. According to clarity shared through community channels and referenced from Pi core team guidance, Pi network has now formally defined two categories of applications within the Pi browser ecosystem. The first category is verified apps. These are mainnet applications that have been fully reviewed and approved by the Pi core team.
They operate using real Pi. They are vetted. They have passed whatever internal standards the Pi core team has established for ecosystem integration. When you use a verified app, you are operating in a production environment with real assets and real transactions.
The second category is unverified apps. These are applications still in development. They have not completed the full vetting process. They may be experimental.
They may be incomplete and critically, they carry an elevated risk level that every pioneer needs to take seriously. According to guidance highlighted within the community, unverified apps can be removed from the Pi browser ecosystem if violations are reported or if they fail to meet the standards the Pi core team has set. This is not a soft warning. This is a live enforcement mechanism and the single most important security instruction that comes with this classification system is this, never share your passphrase with any external application.
Not with an unverified app, not with anyone claiming to represent a Pi service, not under any circumstances. Your passphrase is your complete access to your Pi wallet. Once it is compromised, there is no recovery. There is no customer support call that brings your Pi back.
This classification system is not just a housekeeping exercise. It is a trust architecture. It is Pi network saying to the world, we are building a structured ecosystem and we are putting user safety at the center of that structure. From a web 3 perspective, this kind of layered trust system is exactly what serious blockchain ecosystems need as they scale.
When a network is small, informal trust mechanisms work, but when a network has the kind of global user base that Pi has built, formal classification becomes essential. Developers need to know what standards they must meet. Users need to know what level of risk they are taking when they open a specific application. The verified category creates a stable foundation for transactions and services.
Developers who want their app in that space have a clear benchmark to hit. This drives quality upward. Meanwhile, the unverified category acts as an innovation sandbox, where new ideas can exist, develop and eventually graduate to full verification. This keeps the ecosystem alive and growing without letting experimental work destabilize the core.
Pi coin, as the native asset of the mainnet environment, sits at the center of the verified layer. Real Pi moves through verified apps. Real value is exchanged and the categorization system protects that value layer by ensuring that only approved applications have access to it in a fully operational capacity. The bigger picture here is one of progressive decentralization, a term that describes how blockchain networks move from centrally managed infrastructure toward increasingly distributed community governed systems over time.
Pi network is at a stage where the balance between openness and security is being actively managed. The verified and unverified app structure is evidence of that management. It reflects a network that is growing in size, complexity, and real-world function and is building the frameworks needed to support that growth responsibly. User education is a core part of this.
In decentralized environments, users carry significant responsibility for their own security. There is no bank that reverses a fraudulent transaction. There is no centralized authority that freezes a bad actor's account. Security in Web3 is personal, and Pi Network's warnings about unverified apps are directly aligned with that reality.
This is Pi Network preparing its community not just to hold Pi, but to use Pi safely in a maturing ecosystem. That is everything for today's breakdown. I want to hear from you. Drop your expectations for the Pi core team announcement in the comments right now.
What do you think is coming? What do you need to see to call this a genuinely bullish moment for Pi? If this video gave you value, please like it right now and subscribe to Crypto World Channel so you never miss a breakdown like this one. Every piece of analysis I publish is designed to help you understand what is actually happening in the Pi ecosystem, not just the headlines, but the structure, the implications, and the strategy behind it.
I genuinely appreciate every single one of you who watches this channel and supports this content. Go check out the other videos on this channel. There is a lot more Pi Network analysis waiting for you, and every video is built with the same level of depth you just watched. Thank you for being here.
Stay informed. Stay sharp, and I will see you in the next one. This video does not constitute financial advice or recommendations, and should not be treated as such. Please seek independent financial guidance from a qualified and regulated professional before engaging in any investment or financial activities.
In this video, ASAP Science presents a fun and musical way to learn 400 digits of pi, starting with the first 300 digits and then adding another 100. The presentation combines catchy tunes and playful lyrics to make memorizing the digits enjoyable and engaging. Viewers are encouraged to share the video with friends who love math and science, and there's a call to action for them to comment if they want to see more digits in the future. Additionally, the video promotes merchandise related to pi and the channel, inviting support from viewers. Overall, it's an entertaining approach to learning a mathematical constant while fostering community engagement.
And now, ASAP Science presents 400 digits of pi. To start, let's review the first 300. 3.14159, this is pi followed by 2653589, circumference over diameter, 79 then 323, OMG, can't you see? 8462643, and now we're on a spree.
38 and 32, now we're blue. Oh, who knew? 7950 and then a two. >> [music] >> 88 and 41, so much fun, now we're run.
971693993751. Halfway done. 58, now don't be late. 209, where's the wine?
74, it's on the floor. The 94459, 230, we got to go. 78, we can't wait. 1640628, we're almost near the end, keep going.
62, we're [music] getting through. 089999, 8628034, there's only a few more. 32 then 53 421170 and 67 We're done. Was that fun?
Learning random digits so that you can brag to your friends. Are you ready for more? Well, here's another hundred digits. >> [singing] >> 80865 >> [music] >> 13282 >> [singing] >> 306 64708, if you go slow, >> [music] >> 9384, [singing] then you will score.
46095, now let's dive. 505 [music] and two more pi. Eight blue flying [singing] bats over two golf cats 23 shoes, 172 [singing] screws [music] Five well-dressed small dogs working 35-hour jobs >> Oh, this song is so [music] absurd, just rhyming here random words. Nine four oh eight one, can you taste your tongue?
Two eight four eight one, it [music] just can't be done. One one seven four five oh now close that door, get those numbers in your brain and keep them forevermore. Two eight four one oh two seven oh let's make [music] a stew, one nine three eight five two one one oh five five five nine now our final run. Six four four six two two nine four eight look at you, nine five oh nine three oh three eight one nine and wow now let's learn one hundred more.
[singing and music] >> Six four four two eight eight oh went on a big blind date and ordered some plates full of food. Nine seven five six six oh wearing their brand new kicks [music] in five different shades of a blue. Nine hundred thirty three oh climbed up a tree to see for miles and forty six clowns. One thing you won't forget is two eight four seven oh next and more than five friends is a crowd.
Six four eight the scientist to wait till two three three are in queue. [singing and music] Seven eight six seven and hey there's no line cutting for you. Now the most important rhyme just take a look right at the time. Eighty three one six five next look at you flex two seven one two if this is boring that's on you.
Oh one eight oh nine oh one the race you have almost won with four hundred fifty six men. Four eight five six six nine they're all waiting in a line to clap thirty four of their hands. Six oh three four eight six now go pick up ten big sixty four we start five little fires. Four three [music] two six six four let's let's for the final show.
Eight two one three three nine two six oh seven hundred twenty six oh two four nine one four one two seven five nine oh we'll make this song grow. Can you really fit more in that brain of yours? It's time to find out. Three seven two four we want more more.
5870, get in the [music] flow. 066, the devil plays tricks, but 063, he can't fool me. 155 and 88, [music] let's beat this up, the time is late. With 17 and 48, we'll [music] go to town and learn to skate.
>> When 81 met 52, the sun was there, the sky was blue. 0920, the grass said, "Whoa." [music] Now 962, we're at the zoo. 82, look at this cute shrew. It's holding silver 925, it's sterling.
Throw it down the drain, it's swirling. 40, now watch this plant [music] grow. Its leaves are reaching upward. 917, silly plants don't go to heaven.
15, [music] go get your sunscreen. With 36 or more in SPF, or else your skin will be a mess. >> 43, we're in the deep sea. There's 67 [music] creatures lurking round.
I'm actually counting 892, this song won't end unless you do. 590360, and then round it out with 011, this new song you've never learned to tie. 33, [music] what would you eat? Five bits of cheese?
305 with honey from these small beehives. >> 48 and 82, we're rich in on a big horseshoe. 046 and 65, we're put away in the archive. 121 and 38 [music] can't help themselves, but 20 plates and 41 and 46 are working on their DJ mix.
95194 and 1, the digits we have almost sung. With 511, our final rhyme will end this year at 609. How so fly >> [singing] >> to a pi. Another one down.
Don't forget you can check out our pi merch and other merch at asapsience.com/shop. If you've ever wanted to support our channel and help us continue making science videos, it's a simple way you can do that. And if you want me to continue the tradition of 100 new digits every year, make sure you leave a comment that says pi 5.0. That'll be a pretty special milestone, I think.
If you keep watching, I'll keep making them, so make sure you send this to all your science-loving, math-loving, pie-loving friends. Otherwise, as always, thanks for watching and we'll see you next time. Peace.
The video discusses the historical methods of calculating pi, highlighting the tedious polygonal approach used for over 2,000 years, which involved inscribing and circumscribing shapes around circles to approximate pi's value. Archimedes made significant advancements in this method, achieving a precision of pi between 3.1408 and 3.1429. However, the introduction of Isaac Newton's binomial theorem in the 17th century revolutionized the calculation of pi by allowing for infinite series, which made the process much faster and more efficient. Newton's innovative approach demonstrated that mathematical patterns could be extended beyond their traditional boundaries, leading to new ways of understanding and calculating constants like pi. The video emphasizes the beauty and universality of mathematics, as seen through the development of these concepts across different cultures and eras.
this video is about the ridiculous way we used to calculate pi for 2 000 years the most successful method was painstakingly slow and tedious but then isaac newton came along and changed the game you could say he speed ran pie and i'm going to show you how he did it but first pie with pizzas cut the crust off a pizza and lay it across identical pizzas and you'll find that it goes across three and a bit pizzas this is pi the circumference of a circle is roughly 3.14 times its diameter but pi is also related to a circle's area area is just pi r squared but why is it pi r squared well cut a pizza into really thin slices and then form these slices into a rectangle now the area of this rectangle is just length times width the length of the rectangle is half the circumference because there's half the crust on one side and half on the other so the length is pi r and then the width is just the length of a piece of pizza which is the radius of the original circle so area is pi r times r area is pi r squared so the area of a unit circle then is just pi keep that in mind because it'll come in handy later so what was the ridiculous way we used to calculate pi well it's sort of the most obvious way it's easy to show that pi must be between three and four take a circle and draw a hexagon inside it with sides of length one a regular hexagon can be divided into six equilateral triangles so the diameter of the circle is two now the perimeter of the hexagon is six and the circumference of the circle must be larger than this so pi must be greater than six over two so pi is greater than three now draw a square around the circle the perimeter of the square is eight which is bigger than the circle's circumference so pi must be less than eight over two so pi is less than four this was actually known for thousands of years and then in 250 bc archimedes improved on the method so first he starts with the hexagon just like you did and then he bisects the hexagon to uh dodecagon so that's a 12-sided regular 12-sided shape and he calculates its perimeter the ratio of that perimeter to the diameter will be less than pi he does the same thing for a circumscribed 12-gun and finds an upper bound for pi the calculations now become a lot more tricky because he has to extract square roots and square roots of square roots and and turn all these into fractions but uh he works out the 12 gone and then the 24 gone uh 48 gone and and by the time he gets to the 96 con he sort of had enough but he gets in the end he gets pi to between 3.1408 and 3.1429 so for for for over 2000 years ago that's not too bad yeah that seems like all the precision you need in pi right so this goes way beyond precision for any practical purpose this is now a matter of uh flexing your muscles you know this is this is uh showing off just how much mathematical power you have that you can work out a constant like pi to very high precision so for the next 2 000 years this is how everyone carried on bisecting polygons to dizzying heights as pi passed through chinese indian persian and arab mathematicians each contributed to these bounds along archimedes line and in the late 16th century frenchman francois viet doubled a dozen more times than archimedes computing the perimeter of a polygon with 393 216 sides only to be outdone at the turn of the 17th century by the dutch ludov van kerlen he spent 25 years on the effort computing to high accuracy the perimeter of a polygon with two to the 62 sides that is four quintillion 611 quadrillion 686 trillion 18 billion 427 million 387 904 sides what was the reward for all of that hard work just 35 correct decimal places of pi he had these digits inscribed on his tombstone 20 years later his record was surpassed by christoph greenberger who got 38 correct decimal places but he was the last to do it like this pretty much yeah because shortly thereafter we get sir isaac newton on the scene and once newton introduces his method nobody is bisecting n-gons ever again the year was 1666 and newton was just 23 years old he was quarantining at home due to an outbreak of bubonic plague newton was playing around with simple expressions like one plus x all squared you can multiply it out and get one plus two x plus x squared or what about one plus x all cubed well again you can multiply out all the terms and get one plus three x plus three x squared plus x cubed and you could do the same for one plus x to the four or one plus x to the five and so on but newton knew there was a pattern that allowed him to skip all the tedious arithmetic and go straight to the answer if you look at the numbers in these equations the coefficients on x and x squared and so on well they're actually just the numbers in pascal's triangle the power that one plus x was raised to corresponds to the row of the triangle right and pascal's triangle is really easy to make it's something that's been known from ancient greeks and indians and chinese persians a lot of different cultures discovered this all you do is whenever you have a row you just add the two neighbors and that gives you the value of the row below it so that's a really quick easy thing you can compute you know the coefficients for one plus x to the 10 in a second instead of sitting there doing all the algebra the thing that fascinated me when i started looking at those old documents was how even like i don't speak those languages i don't know those number systems and yet it is obvious it is clear as day that they are all writing down the same thing which today in the western world we call pascal's triangle that's the beauty of mathematics it transcends culture it transcends time it transcends humanity it's going to be around well after we're gone and and ancient civilizations alien civilizations will know pascal's triangle over time people worked out a general formula for the numbers in pascal's triangle so you can calculate the numbers in any row without having to calculate all the rows before it for any expression 1 plus x to the n it is equal to 1 plus n times x plus n times n minus 1 x squared on 2 factorial plus n times n minus 1 times n minus 2 times x cubed on 3 factorial and so on and that's the binomial theorem so binomial because there's only two terms one in x bi is two there's two nomials and uh theorem is that this is a theorem that you can rigorously prove that this formula is exactly what you'll what you'll see as the coefficients in pascal's triangle so all of this was known in newton's day already yeah exactly everybody knew this everybody saw this formula and yet nobody thought to do with it the thing that newton did with it which is to break the formula the standard binomial theorem insists that you apply it only when n is a positive integer which makes sense right this whole thing is about working out one plus x times itself a certain number of times but newton says screw that just apply the theorem i mean math is about finding patterns and then extending them and trying to find out where they break so he tries one plus x to the negative one so that's one over one plus x what happens if i just blindly plug in n equals negative 1 for the right hand side of the formula and what you get is the terms alternate back and forth plus 1 minus 1 plus 1 minus 1 and so on forever so that's one minus x the next term will be a plus x squared the next term will be a minus x cubed plus x to the fourth minus x to the fifth so it's just alternating series with plus plus and minus signs as the coefficients so it becomes an infinite series yeah that's right if you don't have a positive integer the binomial theorem newton's binomial theorem will give you an infinite sum but how do you understand that like for all positive integers it was just a finite set of terms and now we've got an infinite set of terms yeah so what happens is if you have a positive integer you remember that formula the coefficient looks like n times n minus 1 times n minus 2 and so on when you get to n minus n if n is a positive integer you will eventually get there and n minus n is 0. so that coefficient and all the coefficients after it are all zero and that's why it's just a finite sum it's a finite triangle but once you get outside of the triangle with positive integers you never hit n minus n because n is not a positive integer so you get this infinite series so i think the big question is does this actually work does newton's infinite series actually give you the value of one over one plus x x x right and it might be nonsense there's lots of math formulas that break completely when you do this right there's we have rules for a reason but uh we should always know the extent to which the rules have a chance of working farther if you take that whole series and you multiply it by one plus x and you multiply all that out you'll see all the terms cancel except that leading one and so that big series times one plus x is one in other words that big series is one over one plus x that's how newton justified to himself that it makes sense to apply the formula where it where it shouldn't be applicable so newton is convinced the binomial theorem works even for negative values of n which means there's more to pascal's triangle above the zeroth row you could add a zero and a one that add to make that first one and then that row would continue minus one plus one minus one plus one all the way out to infinity and you know outside the standard triangle the implied value everywhere is zero and this fits with that the alternating plus and minus ones add to make zero everywhere in the row beneath them and you can extend the pattern for all negative integers either using the binomial theorem or just looking at what numbers would add together to make the numbers underneath and here's something amazing if you ignore the negative signs for a minute these are the exact same numbers arranged in the same pattern as in the main triangle the whole thing has just been rotated on its side but newton doesn't stop with the integers next he tries fractional powers like 1 plus x to the half so now what does it mean you take 1 plus x to the one half well that's the same thing as square root of 1 plus x and he wants to understand does that have the same expansion putting n equals a half into the binomial theorem he gets an infinite series that makes me think that we could actually go into pascal's triangle blow it up and add fractions in between the rows that we're familiar with exactly there's even a continuum of pascal's triangles between zero and one there's this you know a continuum of numbers that you could put in for powers you can think of each fraction like a half a quarter a third as existing in its own plane where in each plane pairs of numbers add to make the number beneath them n doesn't have to be a positive integer anymore doesn't have to be a positive integer it doesn't have to be a negative integer it doesn't have to be an integer so now we're going to take n to be a half and he works this thing out and then he could do all kinds of things for example he could work out the square root of 3 very quickly and efficiently because the square root of 3 we can write 3 as 4 minus 1 and if we pull out a 4 then we get a square root of 4 which is just 2 times the square root of 1 minus a quarter if you put in minus a quarter for x in this series you'll get a very rapidly converging series expansion that will quickly give you square root of three to high accuracy now newton is particularly interested in n equals a half because the equation for a unit circle is x squared plus y squared equals one and if you solve for y well the top part of the circle is equal to 1 minus x squared to the half this is basically the same expression he's been looking at he just has to replace x by minus x squared which adds in some minus signs and doubles the power of x on each term but now he's got an equation for a circle where each term is just a rational number times x raised to some power now we have two different ways of representing the same thing and whenever you have something like that magic is about to happen fireworks about is about to go off but how does he use this to calculate pi well luckily for us he had just invented calculus or what he called the theory of flexions he realizes that if you integrate under that curve as x goes from zero to one you're getting the area under the curve which is a quarter circle and he knows that the area of a unit circle is exactly pi r squared except r is one so the area is pi and we want just a quarter so the area is pi over four on the other side he has this nice series and he knows how to integrate x2 some power you just increase each power of x by one and divide by the new power and now you have an infinite series of terms which just involve simple arithmetic with fractions you put in x equals one and you can calculate pi to an arbitrarily high precision but newton goes even further adding one final tweak a not good math paper has zero ideas it's just pushing through things that everybody already knows but nobody bothered to do then there are good math papers that have like one new idea that's like really shockingly new newton's on new idea number four at this point and he's about to have new idea number five a new idea number five is instead of integrating from zero to one he's going to integrate just from zero to a half you know when you have an infinite series you want the terms to decrease in size as fast as possible that way you don't have to calculate as many of them to get a pretty good answer and newton sees if he integrates not from 0 to one but from zero to a half then when he subs in a half for x each term will shrink in size by an additional factor of x squared which in this case is a quarter but if you only integrate to a half what is the area under the curve that you're computing well it is this part of a circle which you can break into a 30 degree sector of the circle which has an area of pi on twelve plus a right triangle with a base of a half and a height of root three on two so that integral should come out to this expression and rearranging for pi you get the following now if you evaluate only the first five terms you get pi equals 3.14161 that's off by just two parts in a hundred thousand and to match the computational power of van curlin's four quintillion sided polygon you would only need to compute 50 terms in newton's series what before it took years now would take only days so no one was bisecting polygons to find pie ever again why would you yeah do you do all that work and somebody comes along and beats you in a second it's sort of like uh you know once once someone builds a crane and then somebody else is still climbing up on a ladder to put a brick on a house like that's just not how you build houses anymore we have new technology are you out of your mind you're gonna you know we're gonna build a hundred story house you're gonna build a five-story thing that's gonna fall over you see it in new york city you see literally where technology came along there's like rows and rows of five-story buildings and all of a sudden here's a 20-story and here's a 30-story and here's a 90-story so it's all about who has the technology for me this is a story about how the obvious way of doing things is not always the best way and that it's often a good idea to play around with patterns and push them beyond the bounds where you expect them to work because a little bit of insight in mathematics can go a very long way hey this video was sponsored by brilliant a website with interactive courses and quizzes that let you dive deep into the topics like the ones i've shown in this video calculus neural networks programming in python they've got you covered now i sometimes get asked why i don't get into the nitty gritty detail or solve numerical problems in my videos and the answer is because i don't think a video is the best way to learn those skills the best way is to engage yourself in problem solving like you can on brilliant i love the way they scaffold you through a topic building your understanding and your confidence as you go and as someone with a phd in science education i can say this is the only real way to learn you have to be a little uncomfortable to gain understanding when i do these quizzes i find that my brain is really working so i can guarantee that whatever level of education you're at brilliant will have something for you it's the perfect compliment to watching fun educational videos and for viewers of this channel brilliant are offering 20 off an annual subscription to the first 314 or pi hundred people to sign up just go to brilliant.org veritasium i will put that link down in the description so i want to thank brilliant for supporting veritasium and i want to thank you for watching
The video from ASAP Science presents a fun and engaging way to learn the first 300 digits of pi through a catchy song. It starts with the well-known digits 3.14159 and continues with a rhythmic recitation of the subsequent numbers, encouraging viewers to memorize them. The video emphasizes the importance of pi in mathematics, specifically its relationship to the circumference and diameter of a circle. Additionally, it promotes merchandise related to pi and invites viewers to support the channel. The creators express gratitude for the audience's support and encourage comments for future content, specifically suggesting viewers leave "pyong 4.0" if they want to see more digits next year.
[Music] and now ASAP science presents 300 digits of pi to start let's review the first 3.14159 this is pi followed by 26535 89 circumference over diameter 7 9 then 323 OMG can't you see 846 2643 and now we're on a spre 38 at 32 now we're blue oh who knew 7,950 and then a do 88 and 41 so much fun now run 97169 3993 751 halfway done 58 now don't be late 209 where's the wine 74 it's on the floor the 94 459 230 we got to go 78 we can't wait 16406 28 we're almost near the end keep going 62 we're getting through 08 999 time 862 8034 there's only a few more 8 2 then 53 42 11 70 and 67 we're done was that fun learning random digit so that you can break to your friends are you ready for more well here's another 100 digits [Music] 98214 many 80865 all high five 13 282 look at you 36 bag of tricks 647 oh if you you go slow 9384 then you will score [Music] 46095 now let's dive 505 into more pie eight blue flying bats over two gold cats 23 shoes 172 screws five well-dressed small dogs working 35-hour jobs oh this song is so absurd just rhyming here random 9481 can you taste your tongue 28481 it just can't be done 17450 now close that door get those numbers in your brain and keep them forever more 28 412 70 let's make a stew 1 193 85 2 1 1 5559 now final run 644 622 948 look at you 95930 3819 and W now let's learn 100 more 6 44288 all went on a big line didn't order 10 plates full of food 97 566 are wearing their vend kicks in five different shades of a blue 933 you climb up a tree to See For Miles and 46 Cloud one thing you won't forget is 2847 next and more than five friends is a CR 648 the sign says to wait till 233 R in Q 7867 and hey there's no line cutting for you now the most important rhide just take a look right at the time 8365 next look at you Flex 2712 if this is boring that's on you oh one I know I'm one the race you have almost won with 456 B 485 669 they're all waiting in a light to clap 34 of their hands 603 486 now go pick up 10 big 64 we start five little fir 4 32664 let's spit for the final show 8 2133 936 726 2491 3.0 we've got P merch to celebrate Pi 3.0 you can check out all the different designs and products on our website ASAP science.com sshop I'll link it in the description and on screen if you've ever wanted to support our Channel or help us continue making Science Education online this is a way you can do that we are super grateful for any and all your support it honestly means a lot thank you so much for watching now if you want us to continue the tradition next year with another 100 digits make sure you leave a comment below that says pyong 4.0 in the meantime you have one year to memorize these 300 digits make sure you like And subscribe and we'll see you ASAP for some more science peace
The video features a musical presentation of the digits of pi, starting with the first 100 digits and then continuing with another 100. It creatively combines numbers with catchy rhymes and melodies to make learning pi enjoyable and memorable. The host encourages viewers to remember these digits and suggests that if there is enough interest, they may continue this as an annual tradition, potentially expanding to 300 digits next year. The overall aim is to engage the audience in a fun way while educating them about pi.
[Music] and now ASAP science presents 200 digits of piie to start let's review the first 100 3.14159 this is pi followed by 26535 89 circumference over diameter 7 9 then 323 OMG can't you see 846 2643 and now we're on a spre 38 at 32 now we're blue oh who knew 7,950 and then a two 88 and 41 so much fun now run 97169 3993 751 halfway done 58 now don't be late 209 where's the wine 74 it's on the floor the 94 459 230 we got to go 78 we can't wait 16406 28 we're almost near the end keep going 62 we're getting through 08 99 time 862 8034 there's only a few more 8 2 then 53 42 11 70 and 67 we're done was that fun learning random digit so that you can break to your friends are you ready for more well here's another 100 digits [Music] 98214 many 80865 all high five 13 282 look at you 36 bag of tricks 647 oh if you you go slow 9384 then you will score [Music] 46095 now let's dive 505 into more pie eight blue flying bats over two gold cats 23 shoes 172 screws five well-dressed small dogs working 35-hour jobs oh this song is so absurd just rhyming here random 9481 can you taste your tongue 28481 it just can't be done 17450 now close that door get those numbers in your brain and keep them forever more 28 412 70 let's make a stew 1 193 85 2 1 1 5559 now final run 644 622 948 look at you 95493 3819 and W the P song 2.0 thank you so much for watching I've also been debating making the Pi Song sequels a bit of a tradition so if you want to see next year 300 digits of pi leave a comment below that says pong 3.0 if there's enough traction maybe this can be a yearly tradition where we're learning another 100 digits every single year peace
The video explores the history of the mathematical constant pi, tracing its understanding from ancient civilizations to modern times. It begins by explaining how early cultures, such as the Babylonians and Egyptians, estimated pi, with the Babylonians achieving a surprisingly accurate approximation of 3.125. The narrative then shifts to Archimedes, who used polygons to refine pi's value, and discusses the contributions of mathematicians from China, India, and Persia, particularly the introduction of decimal notation and algebra, which revolutionized calculations. The video highlights the transition from geometric methods to infinite series for calculating pi, showcasing how this shift marked a significant advancement in mathematics during the Scientific Revolution and Enlightenment. Ultimately, it emphasizes the collaborative and cumulative nature of mathematical discovery across cultures and eras.
this video is brought to you by Squarespace whether you need a domain website or online store make it with Squarespace take any circle measure its circumference and its diameter the ratio of these two numbers is a mathematical constant we call pi while this definition is simple pi has been studied for thousands of years and history of our understanding not just of the value of pi but also what it means forms a history of all of mathematics it takes us from the Middle East to Europe to China to India and even America it's a history which involves revolutions murder and the infinite [Music] maths is as old as civilization older even there's evidence of counting going back thirty thousand years and two of the very earliest civilizations the ancient Egyptians and Babylonians both investigated pi around 4000 years ago the Babylonians estimated PI to be 3 and 1/8 or 3.125 now that's the first of a few estimates you're gonna hear in this video so for reference remember that the first few digits of pi are 3.1415926 there are more that means that the Babylonian estimate of Pi is accurate to 1% of its true value which is kind of astonishing when you remember that this is a time in human history when iron was first being used and the last mammoths went extinct the ancient Egyptians on the other hand estimated PI slightly less accurately as 3.16 but how do you even estimate the value of pi you have to count it by definition measure a curved surface which is super tricky to do accurately well one way of doing it is to cheat and actually use a square compare a square and a circle well it's quite a little bit like a circle but that was much like a circle as a Pentagon which has one more side than a square and a Pentagon doesn't look quite as much like a circle as a hexagon which has one more side again and a hexagon doesn't look quite as much like a circle as a heptagon and so on you can think of a circle as a regular polygon just want with an extremely large number of sides so many sides in fact that each individual one is infinitesimally small meaning that the circle looks round this was exactly the thinking that legendary ancient Greek mathematician Archimedes used when estimating pi around 220 BC in fact it was probably the very last thing he ever did to approximate pi he reasoned why not measure the perimeter of a square adding up the lengths of all of its edges and then dividing that number by the squares diameter but what is the diameter of a square is it the length of its diagonal or the length of one of its edges why not both said Archimedes draw one square with its corners just touching the perimeter of a circle another square with its faces just touching the perimeter of that same circle add up the lengths of the sides of each square divided by their effective diameters and you have two estimates for the value of pi the true value of which lie somewhere between those two numbers but here's the really clever part because the difference between those two values is pretty big if you're using squares because a square isn't much like a circle but replace those squares with Pentagon's and you shrink the difference between those two numbers meaning that there's a smaller range of values that PI could be your estimation just got more accurate and if you replace those Pentagon's with hexagons you'll get an even more accurate estimates keep increasing the number of faces on the shape that you're drawing inside and outside the circle and your estimate will get more and more accurate as long as you have the time and patience to draw said shapes there is a reason why this thing was called the method of exhaustion Archimedes got up to a 96 sided shape which incidentally is called an a neocon Turki hexagon I really hope I said that right giving an estimate of Pi between three point one four zero eight and three point one four to nine so accurate to two decimal places as I mentioned earlier this was likely his final contribution to science because into 1/2 BC he was killed by Roman soldiers who invaded his hometown Zaira Q's he was apparently performing this calculation at the time allegedly his final words were don't disturb my circles European progress in the study of pi died with Archimedes for well over a thousand years fortunately however there was plenty of the world which was not in Europe a mathematicians here were also interested in PI in particular three mathematical superpowers of the first millennium ad were China India and Persia ideas when these three nations were soon to change the world first off Chinese mathematicians used a method of exhaustion similar to our comedians but instead of considering the parameters of shapes they considered their areas and this dude no I'm not going to try and pronounce his name because I'll only get it wrong used to polygon with 3072 sides to obtain pi to five decimal places 200 years later a father-and-son team used a polygon with over 12,000 sides to extend that record to six decimal places and that was a world record which stood for 800 years the problem was it was just difficult to do these calculations they weren't especially hard to understand it was just awkward to write down what you were doing to physically do the calculation and this was something that would only be resolved by the introduction of two world changing ideas from India and Persia say that you want to do a calculation you know that you and your friends together weigh a hundred and twenty-five kilos and you also know that you weigh 70 kilos the question is how much does your friend weigh mathematically we'd write this as X plus 70 equals 125 where X is your friends weight in kilos subtract 17 from both sides and you get the answer 55 kilos now in that simple example I just used two ideas which were revolutionary to the classical world firstly I wrote large numbers like 125 and 70 using a simple notation we take it for granted these days but the ability to write any number using just ten symbols and a place value notation where the position of a symbol in a number determines its size massively simplifies arithmetic to see what I mean try and do that calculation only using Roman numerals our modern decimal notation was first developed in India some time before 400 AD and then rapidly spread to Persia where the second key idea came from the second key idea was representing your friend's weight using some symbol X and then manipulating both sides of the equation this of course is algebra originally developed by Babylonian and ancient mathematicians but truly established by Persian mathematician and all-round very influential dude Mohammed eben Musa al-khwarizmi using decimal notation and algebra allowed for much easier calculations across all of maths and mathematicians working on calculating PI used it to turbocharge their work after the Renaissance and a renewed interest in mathematics along with crucially new tools from the east Europe was back in the game and in 1630 the most accurate estimate of Pi using the polygon method was achieved by Austrian astronomer Christiaan grind Berger who used a shape with 10 to the 40 sides yes really to calculate pi to 38 decimal places and then because mathematicians are sensible people with lives to lead they decided that was accurate enough and they'd leave it there oh wait the adoption of algebra by European mathematicians triggered a whole new way of looking at the world a change in thinking generally grouped under the title the Scientific Revolution which itself went on to inspire the Age of Enlightenment with thinkers like Rene Descartes and John Locke amongst other ideas the Enlightenment movement emphasized the value of Reason over tradition and new mathematical ideas were held up as Paragons of this they were pure reason the change in how 17th century European mathematicians calculated PI is arguably a perfect example of the shift from following what the ancients did to new rational theoretical approaches because while the ancients like Archimedes may have measured the perimeters of shapes increasingly similar to circles now European mathematicians were using a method based entirely on reason a method based on infinite series an infinite series is just an expression made up of things added together one after the other after the other after the other and so on until forever if those contributions keep getting smaller as you go on then the series converges to a particular value sometimes you can work out what that value will be using logical arguments but sometimes you just have to keep calculating term after term after term until you reach an accuracy that you're happy with the method of using infinite series to calculate pi was first used not in Europe but again in India you could kind of argue that what Archimedes did was an infinite series but the first person to write a mathematical function as an infinite series was Indian mathematician math hava of Sangamo grammar in the 14th century he wrote down expressions for the sine cosine and tangent of an angle as well as the inverse tangent quick refresher if you write the expression y equals tan of X the expansion for the tangent would tell you what y equals if you already know what X is while the expansion of the inverse tangent would tell you what X is if you already know what Y is by its definition the function tan of X precisely equals 1 when x equals 1/4 pi that means that if you have an expression for the inverse tangent then if you plug 1 into that expression and keep calculating terms you'll end up with an increasingly accurate estimate of 1/4 pi madhava did this and calculated PI to 11 digits but then his method seems to have been forgotten only to be apparently independently rediscovered in 17th century Europe by Scott James Gregory and German Gottfried Wilhelm lightness and at this point everything kicked off the new decimal notation and algebraic technique allowed for record calculations of Pi in 1699 it was calculated to 271 digits by abraham sharp who was beaten in 1706 when John machen reached a hundred digits who was in turn beaten by thomas von tete de l'année I hope that's how you say his name in 1719 with 112 digits it wasn't just the case that each of those mathematicians had more spare time than the previous one they were competing with each other using different infinite series which converged on PI faster instead of just using the inverse tangent infinite series they might use a combination of different inverse tangent values or something completely different the competition then became less about which mathematician had done the most calculations and instead which mathematician had the fastest converging infinite series development of increasingly efficient infinite series continued well into the 20th century with the technique kind of coming full circle as the current infinite series of choice was developed by Indian prodigy mathematician Srinivasa Ramanujan of course by the 20th century mechanical computers had been invented making it much easier to calculate pi you basically just used one until he got bored in 1949 Americans D F Ferguson and John wrench calculated PI to 1120 digits but they were bringing a knife to a gunfight because that very same year the first calculation of Pi by an electronic computer was done nearly doubling their record with two thousand and thirty seven digits from here the history of Pi is basically a list of increasingly powerful computers running for a long time and spitting out increasingly absurd numbers of digits at the time of recording the world record for digits of pi calculated is held by peter trib with a shade under twenty two and a half trillion digits calculated the question of course is if we know that pi is going to keep going on forever it's a transcendental number why should anybody bother calculating anymore dishes well for one thing calculating pi is actually a really good way of making sure that your brand new shiny computer is working properly calculating pi uses up a lot of mental brainpower for the computer you have an answer that you can check yours against and also if you keep going just a little bit longer than the previous person you can have a casual world record secondly pi is actually a really good random number generator if you look at the first two hundred billion digits of pi you'll find the number zero occurs almost precisely 20 billion times and the same goes for the other digits 1 through 9 that means that if you were to pick a random digit in those 200 billion there's an almost exactly 10 percent chance of it being one under almost exactly 10% chance being to and so on this makes calculating PI to a large number of digits very valuable to people that want to generate random numbers people working in cryptography for example but lastly and arguably most importantly people keep calculating more digits of pi for the same reason that why people memorize tens of thousands of digits of pi and the same reason why people climb mountains and swim oceans and invent the double luge because they can humans are weird we like to understand the world around us and as our civilization has developed we've built increasingly complex tools to help us understand the world it wasn't essential for our survival that we did that we just did it because of the way we're wired because we could pie is a thread that's gone through all of human history because it's a microcosm of how we interact with the natural world from the ancients to present day through revolutions in Thor and across the world as long as there are people there's always going to be somebody who just wanders what's the next digit long may that continue I'd like to close out this video with two quick announcements announcement the first I finally launched a website go to the very shiny and new Simon ox fist calm for a hub for everything I do online including this YouTube channel sponge in electric and the wiki cast there's a page there detailing the gear that I used to make these videos and coming soon there's also going to be a page detailing all the advice that I give out to people who are interested in applying to the universities of Oxford and Cambridge and then announcement number two if you'd like a look at my website and why wouldn't you I built it with Squarespace who very kindly sponsored this video before making this website I didn't have any experience with web development at all but it was super easy guys so easy so quick to use one of their templates customize it to look the way I want and then just fill in my stuff and then bang it's done I never have to patch or upgrade or install anything it's all taken care of brilliant also it was super easy to set up for selling merchandise which um may be happening soon you you'd like to build your own website for your next project then definitely use Squarespace for it go to Squarespace comm for a free trial and when you're ready to hit the big red button and build the website go to Squarespace com forward slash Simon Clark to get 10% off your first purchase thanks to Squarespace for sponsoring this video thank you for watching it if you enjoyed it please do give it a share pop it alike maybe leave a comment and thank you again I'll see you next time [Music]
In the video, 10-year-old Alberto impressively recites 280 digits of pi in just one minute, breaking a record for memorization speed. The video captures the moment he begins counting down and then rapidly lists the digits, showcasing his remarkable memory skills. His achievement highlights not only his dedication to memorization but also the excitement surrounding such a unique challenge. The video serves as an inspiration for viewers to explore their own memory capabilities and perhaps take on similar challenges.
10-year-old Alberto is about to name as many digits of pi as possible in 1 minute 3 2 1 3.141592653589793 2 38462 64 338 32795 2884 1 97169 3913 751 0582 097 4944 5923 07 81640 62 862 0899 86280 34825 34211 70679 82148 08651 32823 06 647 09 38446 6095 55 822 3172 53594 8128 48111 7452 841 027 093 85211 0 5559 644 622 9489 45493 0381 96 442 881 0975 6659 33 4461 28475 6482 33786 78 3165 271201 9091 456 48566 92 3460 3 48610 5 4543 266 482 he's done it he broke this record with 280 digits recall in 60 Seconds [Music]
The video explains how to calculate Pi by using a circle's diameter and circumference. It demonstrates that if the diameter is set to one unit, measuring the circumference will yield Pi, which is approximately 3.14159. The key takeaway is that this ratio of circumference to diameter remains constant for any circle, regardless of its size, confirming that Pi is a universal constant for all circles.
this is pi but how do we calculate it first we'll draw a perfect circle and then its diameter if we take the diameter to equal one unit then measuring the circumference will give us Pi in school we learned that Pi is equal to the circumference over the diameter so little take a look at the Circle again and we have a diameter of one and measuring the circumference is is is 3.14159 and so on which is equal to Pi now we can take any size circle and measure their circumference diameter ratio and we see that we always get the constant pi [Music] regardless of size Pi is going to be the constant of any Circle that exists [Music]
The video presents a fun and engaging way to memorize the digits of pi, starting with 3.14159 and continuing through a rhythmic sequence of numbers. It uses catchy phrases and a musical backdrop to help viewers remember the digits, making it an entertaining learning tool. The video emphasizes the importance of pi in mathematics, specifically its relationship between circumference and diameter. Overall, it combines education with entertainment, encouraging viewers to learn and share this knowledge with friends.
[Music] and now ASAP science presents 100 digits of pi 3.14159 this is pi followed by two six five three five eight nine circumference over diameter seven nine then three two three OMG can't you see eight four six two six four three and now we're on a spree 38 and 32. now we're blue oh who knew 7950 and then a two eighty eight and forty one so much fun now a run nine seven one six nine three nine nine three seven fifty one five eight now don't be late 209 where's the wine seven four it's on the four the nine four four five nine two three oh we gotta go seven eight we can't wait one six four oh six two eight we're almost near the end keep going 62 we're getting through oh eight nine nine and a ten eight six two eight oh three four there's only a few [Music] forty two eleven seven oh and sixty seven we're done was that man learning random digits so that you can pray to your friends
For over 2,000 years, mathematicians struggled to calculate pi using geometric methods, primarily through inscribed and circumscribed polygons. This tedious process was notably refined by Archimedes and later by Chinese mathematicians like Liu Hui, who introduced convergence acceleration techniques. However, it wasn't until Isaac Newton's groundbreaking work during the plague that the approach shifted dramatically. Newton developed a method using infinite series derived from the binomial theorem, allowing for much more efficient calculations of areas under curves, including the area of a circle, which directly relates to pi. His innovative technique laid the foundation for modern calculus, revolutionizing how mathematicians approach problems involving curves and areas.
For over 2,000 years, humanity calculated pi in what might be the most painfully slow way imaginable. Generation after generation, the smartest mathematicians on Earth repeated the same exhausting process until one young man completely shattered it. That man was Isaac Newton. And in this video, I'm going to show you exactly how he did it.
Let's start with a fact you already know. The area of a unit circle, a circle with radius one, is exactly pi. You've known that since school, but have you ever actually tried to compute it? Not plug into a formula, actually calculate the area of a circle from scratch?
If you place a unit circle on a graph, the top half traces a curve, the square root of 1 - x squared. The area trapped beneath that curve is exactly half the area of the circle. So, in principle, if you could calculate that area exactly, you'd know pi. But this curve isn't a straight line or a parabola or any shape whose area can be found with simple geometry.
The area is clearly finite. You can see it sitting right there on the graph. Yet before calculus, there was no general method for calculating an area like this exactly. And for nearly 2,000 years, mathematicians searched for a way.
So, what do you do when you can't compute an area exactly? You approximate it. The oldest trick in mathematics, you fill the shape with something simpler, something whose area you can compute. Then you see how close you get.
Take a regular hexagon and fit it inside a circle with radius one. The hexagon sits entirely inside the circle, so its area must be less than the circle's area, less than pi. And a hexagon is just six equilateral triangles, so you can compute its area exactly. Now take a slightly larger hexagon and wrap it around the outside of the circle.
The circle sits entirely inside this hexagon, so the hexagon's area must be greater than pi. Now you have two numbers you can actually calculate, and pi is trapped between them. The tighter you can make those bounds, the more precisely you know pi. Around 250 BCE, Archimedes turned this idea into a process.
He doubled the number of polygon sides from six to 12, then 12 to 24, then 48, then 96. At each step, an inner polygon and an outer polygon squeezed the circle tighter from both sides. Each doubling demanded nested square root extractions, all done by hand, all expressed as fractions. At 96 sides, he pinned pi between 3.1408 and 3.1429.
For more than 2,000 years ago, that's remarkable. But look at what Archimedes was actually doing. Each polygon is a stack of triangles. As you add more and more triangles, they become thinner and thinner slices of the circle's area.
In modern language, we'd recognize this as an early form of numerical integration. He was approximating the area under the curve, the square root of 1 - x squared, the exact area that had no algebraic solution, by brute force geometric subdivision, it worked, but it was slow, and it would stay slow for the next 2,000 years. At this point, computing pi wasn't about practical use anymore. Archimedes already had more precision than any engineer would ever need.
It had become a competition, a centuries-long competition to see who could push this one method further than anyone before them. But, the method had a fundamental problem. The convergence was painfully linear. Every additional digit demanded dramatically more computation than the last.
In 263 CE, the Chinese mathematician Liu Hui refined Archimedes' approach in a way no one in the West would match for centuries. Liu Hui wasn't just computing perimeters. He was studying the areas of inscribed polygons, and he noticed something subtle. The difference in area between successive polygons, say a 96-gon and a 192-gon, shrank by a factor of roughly 1/4 each time.
That's a converging geometric series, and if you know the ratio, you can extrapolate forward without actually computing the larger polygon. Liu Hui used this insight to achieve the accuracy of a 1,536-sided polygon using only the calculations for 96 sides. He had discovered convergence acceleration. Two centuries later, Zu Chongzhi took the polygon method to an almost inhuman extreme.
Using counting rods, physical wooden sticks arranged on a board as a decimal place value calculator, he tracked the perimeter calculations for a polygon with 24,576 sides. He pinned pi between 3.1415926 and 3.1415927. Seven correct decimal places. He also found the fraction 355 over 113, an approximation of pi so accurate.
It's correct to six decimal places. That record, seven digits, stood unchallenged for nearly 900 years. Not because no one cared, because no one could do the arithmetic. By the 1600s, European mathematicians had picked up where Zu Chongzhi left off.
But the story was always the same. More sides, more effort, diminishing returns. The Dutch mathematician Ludolph spent 25 years of his life grinding through polygons with more than four quintillion sides. The reward?
35 correct decimal places of pi. 25 years of work, 35 digits, and every future digit would cost even more. The polygon method hadn't failed. It had simply reached the limit of what any human could compute.
In 1656, the English mathematician John Wallis published a book called Arithmetica Infinitorum. Wallis wasn't interested in polygons at all. He was interested in areas under curves. He asked a deceptively simple question.
What is the area under the curve 1 - x squared raised to some power n? n? n? For whole number powers, n equals 1, 2, 3.
The integration was straightforward. You can multiply out the polynomial and compute the area directly, but for the circle, you need n = 1/2. The top of a unit circle is the square root of 1 - x squared. In other words, 1 - x squared raised to the power 1/2.
And at 1/2, Wallis's method broke down completely. He couldn't integrate a fractional exponent. So, he tried something clever. He interpolated.
For the integer cases, he could compute the areas exactly. When n = 0, the area is 1. When n = 1, it's 2/3. When n = 2, it's 8/15.
Clean fractions, getting smaller in a predictable way. Wallis arranged these values in a table and looked for the pattern between them. At n = 1/2, the case he actually needed, there was a gap. He tried to fill it by reasoning about how the known values should connect.
What he found was an infinite product. That's the Wallis product. It was a genuine result. Pi expressed as pure arithmetic, no geometry at all.
But Wallis had arrived at it through interpolation, not proof. He had guessed the pattern between known values. He hadn't derived it from a general method. Wallis had found the door to pi.
He just didn't have the key. Nine years later, a 22-year-old Isaac Newton was quarantined at his family farm during the plague. Cambridge had shut down. Newton had nothing to do but think.
He read Wallis's book cover to cover. Where Wallis had been forced to guess, Newton wanted to compute, but Newton wasn't trying to calculate pi. He didn't care about breaking Zu Chongzhi's record or Ludolph's record. He was building something far more ambitious, a general method for computing the area under any curve.
He called it the method of quadratures. Newton's starting point was a formula that had been known for centuries, the binomial theorem. For any positive integer n, it tells you how to expand 1 + x raised to the power n. 1 + x squared is 1 + 2x + x squared.
1 + x cubed is 1 + 3x + 3x squared + x cubed. The coefficients follow a predictable pattern, and mathematicians had long ago worked out a general formula. 1 + x to the power n = 1 + nx + n * n - 1 over 2! * x squared + n * n - 1 * n - 2 over 3!
* x cubed and so on. For any power n, you read off the coefficients using a sequence of falling factors, each divided by the next factorial. When n is a positive integer, this produces a finite polynomial. The expansion eventually stops.
But Wallace's problem required n = 1/2, and the theorem was only defined for whole numbers. Newton looked at the formula and noticed something. The expression for the coefficients, n * n - 1 * n - 2 divided by successive factorials, doesn't contain any step that requires n to be an integer. Every operation is just multiplication and division.
There's no reason it shouldn't work for any number. So, he plugged in n = 1/2. Instead of a finite polynomial, the formula produced a series that never stopped, term after term, stretching on forever. 1 + x to the power 1/2 = 1 + 1/2 x - 1/8 x² + 1/16 x³ and on and on.
Why does it terminate for integers, but not for fractions? When n is a positive integer, say three, the following factors go 3 * 2 * 1 * 0. Once you hit that zero, every coefficient after it is zero, too. The expansion stops.
But, when n is 1/2, the factors go 1/2 * -1/2 * -3/2 * -5/2. You never hit zero. The series never terminates. Newton had turned a finite formula into an infinite one.
That's exactly what he needed. An infinite series is only useful if it actually converges to the right answer. This could easily be nonsense. Newton checked.
He tried n = -1. 1 + x to the power -1 is just 1 over 1 + x. Plugging -1 into the formula gives an alternating series. 1 - x + x² - x³ and so on.
Multiply the entire series by 1 + x. Every term cancels, except the leading one. The series * 1 + x = 1. So, the series really does equal 1 over 1 + x.
That was Newton's justification. The formula works beyond its original domain. Now, he turned to the case he actually cared about, n = 1/2. 1 + x to the power 1/2 is the square root of 1 + x, and the binomial series gives an infinite expansion.
The square root of 1 + x = 1 + 1/2 x - 1/8 x squared + 1/16 x cubed - 5 over 128 x to the fourth, and so on. This wasn't just abstract. Newton could now compute things like the square root of 1.01 with extraordinary efficiency. Just plug in x = 0.01, and the series converges almost instantly.
Then, Newton saw the connection that changed everything. The equation of a unit circle is x squared + y squared = 1. Solve for y, and the top half of the circle is the square root of 1 - x squared. That's 1 - x squared raised to the power 1/2.
This is exactly the kind of expression Newton now knew how to expand. Replace x with negative x squared in his series, and the semicircle dissolves into an infinite polynomial. 1 - 1/2 x squared - 1/8 x to the fourth - 1/16 x to the sixth - 5 over 128 x to the eighth, and on forever. On the left, a geometric shape, a continuous curve drawn in space.
On the right, an infinite polynomial, pure algebra. Geometry had just become analysis. Now, Newton had the tools. He just invented calculus, what he called the theory of fluxions, and he could integrate polynomials term by term.
But, Newton wasn't just a mathematician. He was a strategist. He didn't want just any formula for pi. He wanted one that converged it fast.
So, instead of working with the unit circle, he made a clever move. He shifted to a smaller circle, a circle with half the radius. When Newton wrote down its equation and solved for the upper half, something remarkable appeared. The curve could be written as the square root of x * 1 - x.
And that expression can be split into two parts. The square root of x multiplied by the square root of 1 - x. Now, the important part wasn't the square root of x, it was the square root of 1 - x. Because that was exactly the kind of expression Newton had just learned how to expand into an infinite series.
So, he expanded it, then multiplied every term by the square root of x. The result was a clean infinite series made entirely of simple powers of x, and those were easy to integrate. So easy, in fact, that Newton could integrate the entire series term by term. Then, he chose a very specific interval from zero to 1/4.
Why 1/4? Because it creates a very specific geometric situation. Draw a line from the center of the circle to the point on the circumference where X equals 1/4. The radius is 1/2.
The horizontal distance is 1/4. And the resulting triangle is a 30-60-90 triangle. That geometry turns out to be extremely useful. The area under the curve from 0 to 1/4 is equal to a 60° sector of the circle minus the area of the triangle.
The sector is 1/6 of the full circle. Its area is pi over 24. The triangle has area root 3 over 32. Now comes the payoff.
When Newton evaluates his integrated series at X equals 1/4, every term contains a power of 1/4. 1/4 squared is 1/16. 1/4 cubed is 1/64. Each term becomes dramatically smaller than the last.
The series collapses towards zero at an exponential rate. Now set the geometric area equal to the series. Rearrange the equation for pi. And suddenly, you have a formula that converges with ferocious speed.
Using just five terms of this series, Newton got pi equals 3.14161. Zu Chongzhi used 24,576 sides and counting rods to reach seven places, a record that stood for nine centuries. The Leibniz series, perhaps the most elegant formula for pi ever discovered, needs 5 billion terms to reach just 10 correct digits. Newton needed 22 terms for 15.
What once took a lifetime now took an afternoon. Newton's reaction to all of this? Embarrassment. In a letter to Henry Oldenburg, the secretary of the Royal Society, Newton wrote about the calculations he'd done a decade earlier during the plague.
I am ashamed to tell you to how many digits I carried these computations, having no other business at the time. He was embarrassed because to him the digits of pi were just exhaust, the trivial arithmetic output of a far more important machine. Newton hadn't set out to calculate pi. He had built a universal method for computing the area under any curve.
Pi was simply what came out when he tested it on a circle.
The video discusses the Basel problem, which involves summing the inverses of square numbers and was famously solved by Euler, revealing that the sum approaches pi squared divided by six. The presenter explores the surprising appearance of pi in this context and emphasizes its connection to circles and geometry. Using a lighthouse analogy, the video illustrates how the apparent brightness of light sources decreases according to the inverse square law, which relates to the arrangement of these light sources. The discussion leads to a clever transformation of light sources that maintains total brightness while simplifying the problem, ultimately connecting the solution back to geometric principles and reinforcing the deep interconnections within mathematics.
Take 1 plus 1/4 plus 1/9 plus 1/16 and so on, where you're adding the inverses of the next square number. What does this sum approach as you keep adding on more and more terms? Now, this is a challenge that remained unsolved for 90 years after it was initially posed until finally, it was Euler who found the answer super surprisingly to be pi squared divided by six. I mean, isn't that crazy?
What is pi doing here? And why is it squared? We don't usually see it squared. In honor of Euler, whose hometown was Basel, this infinite sum is often referred to as the Basel problem.
But, the proof that I'd like to show you is very different from the one that Euler had. I've said in a previous video that whenever you see pi show up, there will be some connection to circles. And there are those who like to say that pi is not fundamentally about circles and insisting on connecting equations like these ones with a geometrical intuition stems from a stubborn insistence on only understanding pi in the context where we first discovered it. it.
it. And that's all well and good, but whatever your own perspective holds as fundamental, the fact is pi is very much tied to circles. So, if you see it show up, there will be a path somewhere in the massive interconnected web of mathematics leading you back to circles and geometry. The question is just how long and convoluted that path might be.
And in the case of the Basel problem, it's a lot shorter than you might first think. And it all starts with light. Here's the basic idea. Imagine standing at the origin of a positive number line and putting a little lighthouse on all of the positive integers, 1 2 3 4 and so on.
on. on. That first lighthouse has some apparent brightness from your point of view, some amount of energy that your eye is receiving from the light per unit time. And let's just call that a brightness of one.
For reasons I'll explain shortly, the apparent brightness of the second lighthouse is 1/4 as much as the first and the apparent brightness of the third is 1/9 as much as the first and then 1/16 and so on. And you can probably see why this is useful for the Basel problem. It gives us a physical representation of what's being asked. Since the brightness received from the whole infinite line of light houses is going to be 1 plus 1/4 plus 1/9 plus 1/16 and so on.
So, the result that we are aiming to show is that this total brightness is equal to pi squared by six times the brightness of that first lighthouse. And at first, that might seem useless. I mean, we're just re-asking the same original question. But, the progress comes from a new question that this framing raises.
Are there ways that we can rearrange these light houses that don't change the total brightness for the observer? And if so, can you show this to be equivalent to a setup that's somehow easier to compute? To start, let's be clear about what we mean when we reference apparent brightness to an observer. Imagine a little screen, which maybe represents the retina of your eye or a digital camera sensor, something like that.
You could ask, what proportion of the rays coming out of the source hit that screen? Or phrased differently, what is the angle between the ray hitting the bottom of that screen and the ray hitting the top? Or rather, since we should be thinking of these lights as being in three dimensions, it might be more accurate to ask, what is the angle the light covers in both directions perpendicular to the source? In spherical geometry, you sometimes talk about the solid angle of a shape, which is the proportion of a sphere it covers as viewed from a given point.
You see, the first of two places this story where thinking of screens is going to be useful is in understanding the inverse square law, which is a distinctly three-dimensional phenomenon. Think of all of the rays of light hitting a screen one unit away from the source. As you double the distance, those rays will now cover an area with twice the width and twice the height. So, it would take four copies of that original screen to receive the same rays at that distance.
And so, each individual one receives 1/4 as much light. This is the sense in which I mean a light would appear 1/4 as bright two times the distance away. Likewise, when you're three times farther away, you would need nine copies of that original screen to receive the same rays. So, each individual screen only receives 1/9 as much light.
And this pattern continues. Because the area hit by a light increases by the square of the distance, the brightness of that light decreases by the inverse square of that distance. And as I'm sure many of you know, this inverse square law is not at all special to light. It pops up whenever you have some kind of quantity that spreads out evenly from a point source, whether that's sound or heat or radio signal, things like that.
And remember, it's because of this inverse square law that an infinite array of evenly spaced light houses physically implements the Basel problem. But again, what we need if we're going to make any progress here is to understand how we can manipulate setups with light sources like this without changing the total brightness for the observer. And the key building block is an especially nice way to transform a single lighthouse into two. Think of an observer at the origin of the XY plane and a single lighthouse sitting out somewhere on that plane.
Now, draw a line from that lighthouse to the observer and then another line perpendicular to that one at the lighthouse. Now, place two light houses where this new line intersects the coordinate axes, which I'll go ahead and call lighthouse A over here on the left and lighthouse B on the upper side. It turns out, and you'll see why this is true in just a minute, the brightness that the observer experiences from that first lighthouse is equal to the combined brightness experienced from light houses A and B together. And I should say, by the way, that the standing assumption throughout this video is that all light houses are equivalent.
They're using the same light bulb, emanating the same power, all of that. So, in other words, assigning variables to things here, if we call the distance from the observer to lighthouse A little A A A and the distance from the observer to lighthouse B little B and the distance to the first lighthouse H, H, H, we have the relation 1 over A squared plus 1 over B squared equals 1 over H squared. This is the much less well-known inverse Pythagorean theorem, which some of you may recognize from Mathologer's most recent and I'll say most excellent video on the many cousins of the Pythagorean theorem. Pretty cool relation, don't you think?
And if you're a mathematician at heart, you might be asking right now how you prove it. And there are some straightforward ways where you express the triangle's area in two separate ways and apply the usual Pythagorean theorem, but there is another quite pretty method that I'd like to briefly outline here that falls much more nicely into our story line because, again, it uses intuitions of light and screens. Imagine scaling down the whole right triangle into a tinier version and think of this miniature hypotenuse as a screen receiving light from the first lighthouse. If you reshape that screen to be the combination of the two legs of the miniature triangle like this, well, it still receives the same amount of light, right?
I mean, the rays of light hitting one of those two legs are precisely the same as the rays that hit the hypotenuse. Then the key is that the amount of light from the first lighthouse that hits this left side, the limited angle of rays that end up hitting that screen, is exactly the same as the amount of light over here coming from lighthouse A, which hits that side. It'll be the same angle of rays. And symmetrically, the amount of light from the first lighthouse hitting the bottom portion of our screen is the same as the amount of light hitting that portion from lighthouse B.
Why, you might ask? Well, it's a matter of similar triangles. This animation already gives you a strong hint for how it works and we've also left a link in the description to a simple GeoGebra applet for those of you who want to think this through in a slightly more interactive environment. And in playing with that, one important fact here that you'll be able to see is that the similar triangles only apply in the limiting case for a very tiny screen.
[Music] All right, buckle up now cuz here's where things get good. We've got this inverse Pythagorean theorem, right? And that's going to let us transform a single lighthouse into two others without changing the brightness experienced by the observer. With that in hand and no small amount of cleverness, we can use this to build up the infinite array that we need.
Picture yourself at the edge of a circular lake directly opposite a lighthouse. We're going to want it to be the case that the distance between you and the lighthouse along the border of the lake is one. So, we'll say the lake has a circumference of two. Now, the apparent brightness is 1 divided by the diameter squared.
And in this case, the diameter is that circumference two divided by pi. So, the apparent brightness works out to be pi squared divided by four. Now, for our first transformation, draw a new circle twice as big, so circumference four, and draw a tangent line to the top of the small circle. Then replace the original lighthouse with two new ones where this tangent line intersects the larger circle.
An important fact from geometry that we'll be using over and over here is that if you take the diameter of a circle and form a triangle with any point on the circle, the angle at that new point will always be 90°. The significance of that in our diagram here is that it means the inverse Pythagorean theorem applies, and the brightness from those two new lighthouses equals the brightness from the first one, namely pi squared divided by four. As the next step, draw a new circle twice as big as the last with a circumference eight. Now, for each lighthouse, take a line from that lighthouse through the top of the smaller circle, which is the center of the larger circle, and consider the two points where that intersects with the larger circle.
Again, since this line is a diameter of that large circle, then the lines from those two new points to the observer are going to form a right angle. Likewise, by looking at this right triangle here, whose hypotenuse is the diameter of the smaller circle, you can see that the line from the observer to that original lighthouse is at a right angle with the new long line that we drew. Good news, right? Because that means we can apply the inverse Pythagorean theorem, and that means that the apparent brightness from the original lighthouse is the same as the combined brightness from the two newer ones.
And of course, you can do that same thing over on the other side, drawing a line through the top of the smaller circle, and getting two new lighthouses on the larger circle. And even nicer, these four lighthouses are all going to be evenly spaced around the lake. Why? Well, the lines from those lighthouses to the center are at 90° angles with each other.
So, since things are symmetric left to right, that means that the distances along the circumference are one, two, two, two, and one. All right, you might see where this is going, but I want to walk through this for just one more step. You draw a circle twice as big, so circumference of 16 now, and for each lighthouse, you draw a line from that lighthouse through the top of the smaller circle, which is the center of the bigger circle, and then create two new lighthouses where that line intersects with the larger circle. Just as before, because the long line is a diameter of the big circle, those two new lighthouses make a right angle with the observer, right?
And just as before, the line from the observer to the original lighthouse is perpendicular to the long line, and those are the two facts that justify us in using the inverse Pythagorean theorem. But what might not be as clear is that when you do this for all of the lighthouses to get eight new ones on the big lake, those eight new lighthouses are going to be evenly spaced. This is the final bit of geometry proofiness before the final thrust. To see this, remember that if you draw lines from two adjacent lighthouses on the small lake to the center, they make a 90° angle.
If instead, you draw lines to a point anywhere on the circumference of the circle that's not between them, the very useful inscribed angle theorem from geometry tells us that this will be exactly half of the angle that they make with the center, in this case, 45°. But when we position that new point at the top of the lake, these are the two lines which define the position of the new lighthouses on the larger lake. What that means then is that when you draw lines from those eight new lighthouses into the center, they divide the circle evenly into 45° angle pieces, and that means the eight lighthouses are evenly spaced around the circumference with a distance of two between each one of them. And now, just imagine this thing playing on at every step, doubling the size of each circle, and transforming each lighthouse into two new ones along a line drawn through the center of the larger circle.
At every step, the apparent brightness to the observer remains the same, pi squared over four, and at every step, the lighthouses remain evenly spaced with a distance two between each one of them on the circumference. And in the limit, what we're getting here is a flat horizontal line with an infinite number of lighthouses evenly spaced in both directions. And because the apparent brightness was pi squared over four the entire way, that will also be true in this limiting case. And this gives us a pretty awesome infinite series, the sum of the inverse squares, one over n squared, where n covers all of the odd integers, 1 3 5 and so on, but also -1 -3 -5 off in the leftward direction.
Adding all of those up is going to give us pi squared over four. That's amazing, and it's the core of what I want to show you. And just take a step back and think about how unreal this seems. The sum of simple fractions that at first sight have nothing to do with geometry, nothing to do with circles at all, apparently, gives us this result that's related to pi.
pi. pi. Except now, you can actually see what it has to do with geometry. The number line is kind of like a limit of ever-growing circles, and as you sum across that number line, making sure to sum all the way to infinity on either side, it's sort of like you're adding up along the boundary of an infinitely large circle in a very loose, but very fun way of speaking.
But wait, you might say, this is not the sum that you promised us at the start of the video. And uh well, you're right. We do have a little bit of thinking left. First things first, let's just restrict the sum to only being the positive odd numbers, which gives us pi squared divided by eight.
Now, the only difference between this and the sum that we're looking for, that goes over all the positive integers, odd and even, is that it's missing the sum of the reciprocals of even numbers, what I'm coloring in red up here. Now, you can think of that missing series as a scaled copy of the total series that we want, where each lighthouse moves to being twice as far away from the origin. One gets shifted to two, two gets shifted to four, three gets shifted to six, and so on. And because that involves doubling the distance for every lighthouse, it means that the apparent brightness would be decreased by a factor of four.
And that's also relatively straightforward algebra. Going from the sum over all the integers to the sum over the even integers involves multiplying by 1/4. And what that means is that going from all the integers to the odd ones would be multiplying by 3/4, since the evens plus the odds have to give us the whole thing. So, if we just flip that around, that means going from the sum over the odd numbers to the sum over all positive integers requires multiplying by 4/3.
So, taking that pi squared over eight, multiplying by 4/3, bada boom, bada bing, we've got ourselves a solution to the Basel problem. Now, this video that you just watched was primarily written and animated by one of the new 3Blue1Brown team members, Ben Hambrecht, an addition made possible thanks to you guys through Patreon. [Music]
In this video, the creator discusses the significance of Pi, particularly on Pi Day, while addressing some misconceptions about the number. They reference a YouTube channel called V Hart, known for blending math and art, and mention her annual anti-Pi videos. The creator argues that while Pi is often celebrated for its infinite nature, it is simply a number that represents the ratio of a circle's circumference to its diameter. They emphasize that Pi is unique and special, not just because of its infinite digits, but because it stands alone in mathematical significance, unlike other irrational numbers. The video concludes by critiquing the idea that Pi contains every possible sequence of numbers, asserting that this notion stems from the randomness of its digits.
this video is going to be a little more educational than usual okay so there's this Channel that I used to really like watching called VR heart heart and I say used to because she doesn't really post that often anymore she makes videos that combine two of my favorite subjects math and art you like math yes okay I like math so V Hart I don't know her real name made videos about math and triangles and transgenderism and I'm going to be honest I've kind of Forgotten everything she's talked about hex something that was one of her things but every year she's made anti- Pie videos Pie is in the math pie remember we're talking about math not the okay so she posts them every year on Pi Day which is today it's Pi Day if you didn't know that let me just tell you something interesting about Pi in 1949 we started using computers to find pi and we kept getting closer and closer as technology advanced and we never found the true value of pi to this day all those pie to a million places websites nope not pie yeah we've got really really close to Pi and yet we're nowhere near as close cuz it's infinite but I mean it's close enough where you physically can't measure that accurate in the real world but it's not the true value of pi the true value of pi goes on forever and we haven't really gotten to the end of that okay so back to veart there's a high chance she made a 2016 anti-py video today right now so go check it out Link in the description if she's made one so I guess this is a rebuttal video about why pie is actually awesome oh and I'm going to be reuting her 2014 video because the 2015 one was kind of stupid ah March 14th that's just an arbitrary number on a calendar we created yeah man shut up and I actually wanted to make this video back in 2015 but I didn't instead I just made this comic because last year was # ultimate P day so I've actually waited a year now so I'm excited to talk about it let's do it I hope I'm not breaking any copyright laws by this Pi Day I'm mad about how people worship Pi for being infinite for going on forever first of all Pi is not infinite well yeah it is but that's not why it's awesome every number is technically infinite you take the number four and you add a 0 Z the four is still the same but in theory you can add a zero forever making it technically infinite and that's just what pi is it's just a number it's not Infinity no one's saying that it is I know it's not about its magnitude it's about all those digits infinite digits going on forever ever but first of all it doesn't go anywhere yeah no it doesn't that that doesn't make it not awesome it's right there on the number line between three and four it's just a number like I said y equals Pi is just a straight horizontal line you take the derivative of Pi you get zero it's a number it's just a number man just a number Pi is a number not a process yeah okay we agree but that doesn't make it not awesome the speed of light is just a number it's about what what that super specific number represents secondly yeah so it's got infinite digits so what 1/3 has infinite digits yeah but Pi is random numbers that go on forever and there's no pattern that's what's so cool do you know what the trillionth digit of pi is no no you don't it's random digits with no pattern but I know the trillionth digit of 1/3 spoiler alert it's three there is exactly as many digits in 1/3 as in pi as in 99.999 repeating yeah the digits of pi are random but the number as a whole isn't random at all which is another cool thing it is the ratio of the diameter of a circle to its circumference multiply the diameter by pi you get the circumference are you forgetting that there's an infinite number of rational numbers for any two fractions you can find another fraction that's between them again and again and again there's never any fractions that are right next to each other on the number line yes irrational numbers are technically everywhere take the 1 millionth digit of pi change it to a three and you get entirely new irrational number it's not Pi anymore I mean this was never pi to begin with but you can't use this to get the circumference anymore nuh-uh not good but it's this highly specific irrational number that this special ratio occurs not this one not this one this one it's why we made this specific irrational number its own symbol well okay we actually used a Greek letter so it's not totally made up so I don't know why anyone would make a fuss about the grand Infinities and Forevers of a boring little number like pi it's not boring the only thing even a little weird about Pi is that you do get an irrational number by taking such a simple ratio of such a simple geometric object yes thank you it's so weird right surely that never happens with other simple ratios of other simple geometric objects oh wait they're in everything what no okay if you take one of the sides of a square and multiply it by this number you get the length of its diagonal between the corners okay so this is the ratio of a side of a square and its diagonal and it's just random numbers that go on forever kind of like Pi so why don't we celebrate this number why don't we have a special symbol for it like Pi well actually we do it's called radical two look you just take this number you square it you get two just plain old boring two that's not special you can't Square pi and get something like 10 you square Pi it's still irrational look at this triangle same deal right this number goes on forever but wait it can be written down as radical 3 over two just like what you did in the video now this one for pent on we do use a symbol for it it's a Greek symbol called Fi Fi Fi that's really close to Pi I wonder if that's on purpose now fi is approximately this number kind of like PI right totally 100% irrational I think we got ourselves another Pi but wait we can rewrite it like this hey side note this number is considered the golden ratio and has to do when we talk about that swirly like seashell thing and it can actually be found in art so that's pretty cool okay back to Pi you can't rewrite Pi like any of these numbers pi high is its own number it stands by itself Above the Rest it's not radical 2 not rad 3 over two but just plain old 3.1415 that's why Pi is so awesome there's a picture going around on the internet that's like Pi contains the day you were born and the day you'll die we give the numbers the letters and every possible conversation you ever had and every conversation you didn't have you see now that's just stupid that's just the nature of having random numbers go on forever I could do the same thing on random generator.org.uk [Music] celebrating it because it's called pie and I think that's what happened to pie people were like ah this boring math term has a funny name let's celebrate it on our meaningless calendars
In this whimsical video, the character Pi celebrates "Pi Day" as if it were their birthday, emphasizing the importance of self-empowerment and enjoying personal interests. Pi goes on a fun outing, including grocery shopping and indulging in tacos, before encountering a rival who challenges them to a chess match. The narrative takes a humorous turn as Pi assembles a quirky team of mathematical constants and figures to face off against the rival, leading to a chaotic and playful battle. Ultimately, Pi learns the value of friendship and teamwork, despite the initial conflict, and ends on a positive note with new friends and shared experiences. The video blends math concepts with lighthearted storytelling, making it both entertaining and educational.
five more minutes hi I'm piie and today is my birthday well it's not really but it is p day so I treat it like my birthday my birthday is my day and I do what I like I don't let anyone else control me I tend to get pretty wild first I hit up the grocery store I pick up some saltine crackers usually a bit of cheese oh and some food for my lizard getting low on that I then take a trip to my favorite taco place to get a special meal really treat myself it tastes really good if you squeeze the lime on it after that I take a small walk where I run into a powerful being who has some sort of beef with me wait what you me you tried to steal my day pie day and for that you must pay can we just settle this with a game of chess and be on our way what why would we never mind you assemble your team and I assemble mine we settle this in an hour a team chess is a two-player game stop trying to make it chess you're being irrational okay that was EXP extremely clever I've never heard that before we don't need to fight buddy yay for friendship I was kidding I'm going to personally murder you ah shs okay I've assembled you guys to be my team my best friends in the world who are you I'm flattered pie I really am but I don't think we've ever talked that's why you're my best friends yes yes yes yes yes I'm so excited this will be be be legendary what is this creature you don't remember him we never met him come on time's up Mr pie the the other Pie has been zero help what are we doing we're going to war Only the Strong Will Survive yes what but first Pi is an irrational constant equal to the circumference of any Circle divided by the diameter of the same Circle this applies to every single Circle as long as it's not a square Pi is equal to 3.141592653589 take it come [Music] on3 on3 on3 6939 hi passing notes in class well no it why don't you read it out so everyone can hear it's time it's literally time I've met your team already so you can meet mine oh my rubber it can't be Oilers constant representing exponential growth wow Square < tk2 friend of Pythagoras in her right isoceles triangle you're the ratio of the hypotenuse to the legs and to you're just pi multiplied by two boo well you're just a stupid golf ball hey did you just insult my best friend GB you can't call me that you guys for got someone this is I the imaginary number that's literally nothing shush we have a numers Advantage Ambush hey there want to come over to my apartment and eat some overcooked pasta I have an IQ of 156 I have one of 157 no you don't I prefer those violent ways of fighting let's play chess that's awesome I'm great at chess oh what that's what I wanted to do and it's my birthday should we do something not our problem yeah okay I think that's checkm [Music] ow that kind of hurt again again this is supposed to hurt it does it does hurt yay [Applause] you're going to tell everyone that I did that right [Music] mhm so did you guys beat your math thing too uhhuh that stupid thing didn't have a chance against my natural strength he's lying shut up shut up shut up shut up shut up shut up hey you guys why are you standing there help [Music] [Applause] me me me ow there's only enough room for one pie say your goodbyes this is gross come on what's in this stuff okay drop it down guys what no get me out of here here it's it's my [Music] birthday wow zero great job you make it look easy thanks banana apple it's nice to see you again the feelings Mutual sorry about your birthday pie getting ruined and all that no that was great I mean the fight really sucked and uh so did the classroom part the team introduction wasn't fun at all either but I made four new friends three new friends okay do you guys like tacos yeah yay World besties keep telling yourself that oh well that's awesome pie eating my family hey thanks for inviting me to your awesome fight by the way it's not like I'm literally a black belt and Taekwondo or anything whatever I'll just eat some pie then we'll be even invite me next time [Applause] please thank you for doing this for me basketball of course you know we should play more often you guys are total nerd DS chest H what comes around goes around snowball yeah yeah who oh what's going on oh oh it's the imaginary number screw you snowball my go
In this video, the presenter explores the architecture of Pi, a minimalist and well-designed project that has gained popularity. The discussion focuses on two main components: the agent core, which includes the agentic loop that processes user interactions, and the session management system that handles memory and conversation history. The agentic loop involves initializing context, transforming it, and making calls to a large language model, while the session management allows users to easily navigate and export conversation sessions stored in a structured format. The presenter emphasizes the custom coding behind Pi's architecture, highlighting its straightforward yet sophisticated design. Overall, the video serves as an educational resource for those interested in understanding or creating similar projects.
Good morning everyone. How's it going today? Today I bring you a new format right here. I'm going to be recording with my iPad and we're going to be going over the entire uh architecture of Pi.
Uh Pi of course has been taking the world by storm and it's actually very minimalist and it's very beautifully architected and designed. So, [snorts] we're going to be taking a look at how it works actually so that you can think about probably creating your own. It's a very educational uh project if you're wanting to to go about it or if you're just interested in understanding what's really happening behind the scenes and why Pi uh is so well designed, this video is also for you. >> [snorts] >> So, we're going to be talking about mainly two things.
So, we're going to be talking first of all about the agent core uh which is basically just the uh agentic loop that runs behind the scenes and this one here can also be called via RPC or in a programmatic way via the SDK. And then we're going to be taking a look at the Pi interactive way which is the actual uh functionalities that are added via the terminal user interface, okay? So, without any further ado, let's actually get started with the Pi core. All right.
So, let's start off with Pi core. And in order to start with Pi core, I think that it is very very important to understand that the main part of Pi as um as a design is just its agent core, okay? In other words, it's it's agent loop. Let's just call it loop instead.
Agent loop. And [snorts] this is going to be very straightforward. It is essentially all the steps that are going to happen every time that you start a conversation with Pi. So, let's suppose that you start a conversation with Pi and you're going to go right here and the first step that's going to happen after you open Pi for the first time and send the first message, is it's going to initialize its context.
Okay? Now, what does this mean? This means that it's going to put together a bunch of different things. First, it's going to put together its system prompt.
And this system prompt is hard-coded into Pi. You can, of course, update it by creating your own system.md in your workspace, but in this case, uh most more uh more often it is going to be loading the pre-written system prompt. I'll probably leave a link in the the description if you want to take a look at it. It is very very minimalist.
Don't Don't try to uh make it more minimalist. It's already like a few lines of code. Uh a few lines of instructions. After that, it's going to append all the agents.
.md files that you have, both in home and also in your current working directory. Okay? So, of course, be sure to not add too many .in .agents uh agents.md files, because that will just bloat your system prompt. Actually, I think I made a mistake.
This is not .agents, just agents.md file. Um after that, it is going to append all the skill all the skills descriptions. Okay? Descriptions.
So, all the skills that you have loaded into your agent, it is going to load the descriptions and it is going to do the same thing with the tools. So, all the tool descriptions are also going to go into the initialized context. Okay? And there you go.
And then after that, it is going to append your message history. Like this. And your current message. Right here.
So, this if this is a new conversation, then there is not going to be any message history. If this is an ongoing conversation, there is going to be a message history. And if the conversation was compacted, this can be uh replaced by the summary of your previous uh message history, okay? Uh so, there you go.
That is the initialization context. The second step that happens every single time is the step called the transformation, the transformation of the context, okay? And what this means is that it is going to take a look at the context that was just created, and it is going to figure out whether or not it needs to compact that context. If it needs to compact, then it is going to compact it and add it right here instead of the message history, okay?
Uh compacting basically means that it takes all of the messages that are right there in the history and summarize them with the LLM, of course, as well. Uh the third step is going to be actually doing the large language model call. So, it's going to call your large language model to whichever provider that you have selected. It can be uh OpenAI's GPT 5.5, it can be Anthropic's models, it can be Kimi, it can be Minimax, whatever you want.
And then, your model is going to return uh tool call if it wants to make a tool call. For example, it wants to update a file, uh read a file, search the internet, etc. Um and then, it your tool is going to naturally return a response to your large language model. And then, the large language model may decide to make another tool call, and then so forth back and so forth.
It can do uh hundreds of tool calls if you're really doing something very complicated, or just a couple if you're just searching the web, for example. And then, once the agent decides, or your large language model decides, that it does not need uh tool call, it will just reply, and it will give you a response. And there you go. That is essentially everything that happens whenever you send a message to Pi, okay?
And that is kind of the core or the agentic loop. It may sound very easy and like it's just a few things that just a very straightforward um diagram, [clears throat] but in reality this is quite a complicated thing and in Pi it is coded from scratch. There is no additional library helping Pi um build the whole thing right here. Uh and for the record, there are libraries that do this for you that have this agentic loop preloaded, so you just have to run the uh import the agent loop and use it.
Uh some examples are for example, OpenAI uh agents SDK. You also have Vercel's um AI SDK and all of this. But in this case, this one right here is completely custom, okay? So, that's with the agentic loop of Pi.
And that's the first thing. Uh the second thing that we're going to take a look at is the sessions and memory. Okay, and the next thing to understand right here is the memory. Let's just call it like this, memory and sessions.
Cuz [snorts] this is one of my favorite parts of Pi actually, which is that it is extremely easy and straightforward to export your sessions, to navigate them, to go to a previous step in the session, to fork it, etc. It is very, very straightforward and very, very well designed. So, first of all, where are the sessions stored? The sessions are stored in your home directory inside your dot Pi uh directory inside agent and inside sessions, okay?
And inside here, you're going to see a bunch of different directories and they're going to be uh mapped into each one of your working directories. So, for example, let's suppose that you were working in an application called dashboard. And it's going to be a dashboard directory. Then, let's suppose that you were working in an application called weather app.
Weather app. There's going to be that directory right here, etc. So, here's going to be a list of directories. And then, inside each directory, you're going to have each session um with their ID, etc.
And it's going to be stored in JSONL. And what this basically means is that it is going to be just a very straightforward um um um a very straightforward uh file with the message here like that. It's kind of like exactly like a JSON, but instead of having an actual JSON object, it is going to be just a document with a bunch of JSON-like objects and one object in each line. And this, of course, makes it very easy and very straightforward to document this because that means that whenever there is a new message in your conversation, all it has to do is append it in the last line.
And this, of course, these objects, of course, include the role, the message, etc. And there you go. It is extremely straightforward, and as you can see, it all it stores all of your sessions by the location where you started to work on them. And then, but and then, every message is just its own JSON object.
This is, of course, easier to update than if you actually had an array, then you would have to update just a single part of the the whole thing. JSONL is just much more convenient. Uh so, that is the thing about sessions. Let me actually go into the I'm going to show you that in just a moment in the in the actual Pi command line to show you how this actually works.
But, uh before we do that, let me show you something that is uh very very fun, which is the fact that these sessions right here are stored in not in a list, okay? So, it's not a list of sessions. So, not a list, but it's actually a tree of sessions. In other words, uh you probably have seen that in order to navigate in Pi uh to a previous command or a previous prompt that you gave, you do \{{}slash} tree.
And the reason for that is that all of these messages right here, uh they have, of course, the role, the message, and they also have a property called parent. And they also have their ID, okay? So, this one right here, the parent will refer the the fact that this message um uh bifurcated probably from a previous message. So, right here, we can have the role, the the all of its information, and here he would have the parent.
And this parent will be uh 1 1 1. And this one right here is going to have an ID of 1 1 1. So, now, uh Pi knows that this message comes before this one. But, maybe you bifurcated from this one into another message, so you will have another you fork the conversation.
So, here, you will have all of your conversation history, and here, you will have another parent 1 1 1. And they that basically just creates a tree structure uh immediately from a single file like this. So, now, you have uh two different messages that come from the same uh parent message, and that creates two different forked um conversations. It is just a beautiful design, and I have seen many AI agents trying to migrate into this new uh tree design rather than just a simple uh list one message after the other system.
So, that is the thing that you're going to be seeing much more often in the coming um agents that are coming out. So, now that we have seen this in the actual uh map right here, let's actually show you what it looks like in the screen. All right, so let's go right here into my command line and as you can see, I have this very nice uh session where I just talked to the agent about creating some videos, etc. and I had my whole video workflow that I made it right here.
And uh let me show you what happens when you go right here and you do \{{}slash} tree. As you can see, you have a bunch of different messages and here what we're actually doing is we're going um vertically, we're navigating through this list of messages in this JSONL file. As you can see, a bunch of messages are actually tool calls and a message can be also a user message, an assistant message, etc. >> [snorts] >> And what's going to happen right here, let's pose that I want to go right here to this message right here.
I can tell it to summarize the previous part of the conversation and now this is going to create a new message in my JSONL file and it is going to uh set it as a parent or as a child uh message of the message that was tried before this one before I bifurcated, but the other messages are still in the same um in the same uh in the same directory. So, in the same list of JSON JSONL file JSONL messages. Uh so, there you go. Here is um and if I go right back into tree, you can see that here we have a bifurcation and you have the summary and the whole thing that I can just take over.
Uh let me show you what this looks like in the actual um um um in the actual pi pi directory. So, as I told you, you go to pi agent and inside of here you're going to sessions. And let me just show you inside of here you have all the the sessions in the different directories that I have run Pi. So, I have inside users Alejandro agent skills video tool.
This is one directory. Of course, this is not the exact name of the directory. It is like the path to that in a more standardized way and you I can access any of this. So, for example, I suppose that I go into this one right here.
Let's go that I suppose that I go here and as you can see I have two sessions right here. So, I can just open for example, the last one. Which is going to be this one and as you can see it is just a list of JSON L files with all of my conversation right here. And as you can see every JSON L file is starts and ends with this curly braces and just shows the whole thing of what happened.
Actually, let me show this to you in Let me show this to you in code in VS code. There you go. Now I open the same thing on VS code and as you can see every single line is a single message and as you can see each one contains the type of message which can be a message, its ID, its parent ID as I was telling you to create the tree structure, the timestamp and the actual message right here. So, there you go.
That is how sessions work. Now, let's actually take a look at the next part of the Pi core setting which is the tools. All right. So, let's talk now very quickly about the tools that it has and actually the as you probably know Pi is a very minimalist agent and the tools is the tool list that it has is very minimal as well.
So, it actually only has four tools. Um the first one is the read tool. Then it has a bash tool and [snorts] then it has an edit tool, and a write tool. And that's all it has.
There is no more than that. Um that's uh you can, of course, add additional tools to Pi if you want. You can ask Pi to create a new tool. You can install packages to for it to uh add new tools, but just out of the box, it comes with these four tools.
Um I would myself add a web search. That's the only tool that I always install uh when I use Pi. So, that would be my real minimalist setup. But, just by having this, you already have a great minimalist setup, but actually.
Uh it does, however, let me just uh mention something very quickly uh that it's not often mentioned. The fact that, yes, you have four tools, but there are two additional tools that are grep and find. And these additional tools are uh essentially the same thing or things that you can already do with bash, but these additional tools are by default uh disabled because they are supposed to be enabled only when you want to use Pi on read-only mode, right? So, you do not you probably don't want to give it access to bash.
So, if you're going to be running Pi uh with \{{}slash}\{{}slash} tools, sorry, \{{}dash}\{{}dash} tools, and here you pass as an argument uh what tools you want to use, you can mention that you only want, for example, read, grep, and find, and that is going to give you a spy system that will only be that will be read-only. And this is, of course, very useful if you're running Pi programmatically. So, for example, if you're going running Pi through RPC, that is going to be very useful because uh you probably don't want Pi to edit your files if you're just automating a few workflows. Um so, that is for the tools.
It's very straightforward. Uh let's now take a very very quick look on extensions. All right, so let's talk very quickly about extensions and you probably know already uh what these are if you have used Pi, but in case you haven't, extensions are these packages or things that you can add to Pi to modify its behavior because of of course it is a very minimalist setup. It comes with only four tools by default.
It does not come with either MCP support or with web search or anything like that. So, extensions are kind of these ready-to-use packages that you can just install install on top of Pi and Pi will have all of these features out of the box. And it's very, very cool. Let me tell you some of the things that you can do with extensions.
So, just going to add here extensions. Like this. And some of the things that you can do with extensions are for example registering your tools. You can subscribe to events.
And this is very important because that something that I forgot to mention before is that every part of this entire um workflow that happens every time that you have a conversation actually is triggering some events and these events can be something like tool call, like uh agent response, like user message, etc. And these are events that happen during the workflow. So, you can subscribe to events so that these extensions or these packages perform particular actions at a particular time of the agent loop. You they can also register commands.
They can add keyboard shortcuts for example. Add CLI flags as well. They can also update the system prompt. Or even render custom messages.
And these are extensions that you can code yourself. They are coded in TypeScript and it's very, very straightforward because Pi naturally allows you to, since it is very modular, you can literally just add an additional extension, plug it to whatever you want to plug it, and it will modify the behavior of Pi. Uh, it's very straightforward and of course if you're interested in extensions, feel free to take a look at all of the extensions in the packages uh part of the website. Now of course beware that these packages are naturally loading and executing code in your system, so you probably don't want to install packages from third-party sources that you do not trust.
Uh, or if you you you uh want to use them, at least uh run them through a Pi agent, so have Pi explore the code of that particular package to make sure that it is safe. Uh, so that is one thing. Now let's talk about uh skills and the system prompt in Pi. All right, so let's talk very, very quickly about the system prompt.
It is very, very straightforward. So the system prompt it's very straightforward. There is just a very simple, I can leave a link to the description if you want to actually read it, but it's very short, it's about 20 lines long. And basically all that it does is it tells the agent, "You're a helpful assistant.
You are Pi, a helpful assistant." Uh, then all the appended sections because you can also append your own system prompt to it just by creating your own append-load-system.md file. So you can do append- load-system.md file in your uh in your .pi directory and this will append this one right here to the right after the you are Pi part of the the the part of the prompt. After that, it lists the skills. And to list the skills, it uses a very nice markup language like this.
So, skills and skills like this. And inside of each, there is the skill with its description, its name, and what it does, etc. And this is very useful, and it's very important to leave it in markup files because this is actually going to be parsed by the terminal user interface later on. I'm going to be talking about the GUI in a bit, but this is very very useful, and this is very very important.
Right after that, it includes the current date and the working the current working directory. And that's basically what the system prompt is in Pi. And something important as well that you should keep keep in mind is that you can, of course, override it if you create your own system.md file in .pi. And same thing, you can also override it if you run Pi with the flag --system-prompt.
And then just pass your system prompt like this, okay? So, those are ways to override the system prompt, and but this is how it is created by default, okay? So, that has been basically the Pi core, and I hope that with this information, you have pretty much all you need to create your own version of Pi. Let's now think about how you can how Pi core interacts with the interactive part of Pi, which is the actual part that we see in the terminal user interface, and how you can connect it to other user interfaces, okay?
So, let's take a look at that. All right. So, now that we have pretty much covered everything related to Pi core. Of course, there is always a way to go a little bit deeper into this, but I figured that this is a good place to stop.
We can take a look at Pi Interactive, which is another package completely. It's not in the Pi Core package, and this one right here is the actual let's call it the coding agent, right? Because this one right here is just an agent in itself, just the agent. And this one [snorts] right here is going to be the actual coding agent.
So, let's talk about the entry point on the CLI. So, when you create new session, you log into the CLI, what actually happens? Let's call it CLI entry point. So, this happens in two different files.
The first one is in client.ts, and the second one is on main. ts, okay? And on client.ts, what happens, let me just show this to you. And on client.ts, what happens is that it receives the Pi command.
It does a bunch of other things like setting the process title, etc., and then it calls main like this, okay? And here on main is where the fun part hap- the fun part happens. As the arguments are passed parsed, it resolves the configuration, so it figures out where the custom working directory is and everything like that. It loads the extensions as well, cuz it's of course remember that this is very modular.
Then after that, it creates the agent session, okay? So, it's not until now that we actually start the agent session, which initializes actually the Pi Core element or the Pi [snorts] Core component. And it runs in the selected mode, so it runs it can be either interactive, of course. It can be doing RPC as well, and it can be doing just print to stdio, which is if you just run Pi like this in the in the command line, and um and just type your prompt like that, okay?
So, that is the entry point. Let's talk a little bit about this particularly on the terminal user interface because that is also a very interesting thing. All right, so uh the terminal user interface is actually very straightforward. You have probably already seen it on uh I mean, you can see that it is very, very modular.
You have your input right here. You have your messages on top, and then you have a bunch of information in the nice little uh bar at the bottom, and it's pretty pretty useful, actually, pretty fun, and very, very minimalist, and it does not um um um it does not flicker, which is great, and uh yeah, everything works very well in in a very minimalist way. And the reason for it is that it is first of all, it is completely custom built, so it does not use textual or anything like that. It is completely custom.
And then something else is that it is component-based, okay? Component- based. And then about that, you have to consider that each component basically is respon- is responsible for its own rendering, for its own inputs, and also can be updated updated dynamically. So, yeah, there that is something to consider.
Uh it can, of course, uh subscribe to a bunch of different events that are released by the agent core, but uh it is completely custom built, uh and that does not mean that you cannot add your own uh graphical user interface on top, or your own TUI on top, but uh this one right here, the one that comes out of the box, is completely custom for Pi. Um now let's talk about the compaction or the way that Pi deals with compactions because I find that that is very interesting. All right. So, now let's talk very quickly about the way that Pi deals with compaction because many different agents deal with this in different ways and I figured that the way that Pi does it is actually not only very minimalist, but also very simple and very intuitive.
So, I have seen some agents, for example, uh try to measure how long your context is by taking the number of characters in the entire context and dividing that by four to figure out how many tokens approximately are there. Uh now that, of course, I've seen some agents do that, especially at the beginning when you don't have a response from the LLM yet and that seems to work. However, Pi does not do that at all. It just relies on the feedback that the response from the LLM gives you.
Okay, it just assumes that by on the start you're not going to send a super long message anyways. So, what happens is that this uh that Pi calls this function called check compaction. Check compaction. Like that.
And it calls it on two different occasions. The first one is when an agent ends. That is to say when the agent finishes her turn and it gives you the uh actual uh response from a tool call or whatever and also before the prompt. So, before the prompt.
So, if you have uh so, that is before you actually start sending a message. That's the other moment when you when this checks for compaction. And the reason, of course, naturally to check for compaction is that you do not want your context to be too long so that when the agent is going to reply, it is going to just overload the context window. Uh and you of course don't want to overload the context window from the start either.
So, what happens right here is that once the agent responds, it measures how many tokens are in your response. And some agents, some LLM, sorry, some LLM providers actually return to you in the response the context, okay? So, the context tokens. So, if those are present, then it just takes them directly from there.
If they are not present, however, it calculates the context by adding together the following things. So, usually whenever an LLM gives you a response, you get a usage Let me just go right here. A usage parameter that includes the usage input to mention that mentions how many tokens you input, then includes the usage.output mentions how many tokens were generated by the LLM. And on top of that, it usually mentions the cache.read and the cache.write.
And by adding all of this together, uh let me just say that here. By adding all of this together, then it calculates the context by um naturally every single time that an agent ends a turn or before the user sends a tool call or before the user Oh, sorry, or before the user sends a prompt. So, there you go. That is for compaction.
And of course, if you want to take a look at what uh the compaction actually looks like, it is also very minimalist. Let me see if I can find the actual code right here because it is very very fun, let's say. Oh, here it is. Let me switch to the computer to show you the actual compaction prompt.
And here we are. We are inside packages agent source harness compaction and inside compaction still TS. And as you can see here we have the summarization system prompt. It says, let me just grab this right here.
You are a context summarization assistant. Your task is to read a conversation between a user and an AI assistant blah blah blah. And something pretty cool is that here you have the complete system prompt that you have. So the messages above are conversation to summarize.
Create a structured context checkpoint summary that another LLM will use to continue the work. And here is the exact format. So you mention the goal, the constraints and preferences, the progress, what is done and what is in progress, what is blocked, the key decisions that the agent has made, the next steps, and the critical context. Keep each section concise, preserve exact file paths, function names, and error messages.
And it has a slightly different prompt for updating an existing already context summary summary. So, So, So, as you can see it is very very straightforward. And let me see if I can show you something fun right here. Let's see if I can just um um um see if I can just open this like this.
And let's just go back into working repository. And here I'm in a working repository. I'm just going to resume one one of this. Let's see if this works.
And there we go. Something that I can do right here is just ask it to compact the whole thing. And so we're going to see the exact compaction that it generates right here in just a moment. And there you go.
Here we have the compaction. And if you can if you want to take a look at it, just do control O to expand. And as you can see we have the exact compaction that follows the prompt that we just saw. So the goal is this, the constraints and preferences are this, the progress, what is done, what is in progress to be done, and what is blocked, the key decisions it has done, the next steps, the critical context, original request, early progress, etc.
So, there you go. That is how compaction works. Now, let's take a look, last but not least, at how the Pi interactive agent deals with skills. I think that this is very, very fun.
All right. Now, something that I wanted to mention precisely about this, and deals with skills and with custom prompts. So, custom prompts. These are two different things, and they are both dealt in a very similar way.
Now, in case you're not familiar with skills, skills are these MD files, MD markdown files that contain a lot of very clear, detailed instructions, and at the header, they have a name and a description that is loaded into the system prompt. And when it comes to custom prompts, they're basically just custom \{{}slash} commands. So, you can do just like your \{{}slash} command, and this is going to be replaced with your system prompt at the Pi interactive layer. So, this is never going to reach the actual Pi core, and that is very important.
Now, for custom prompts, it's very, very straightforward. Whenever you send a custom \{{}slash} command like this, the CLI is going to read it, and it is going to turn it into the actual prompt that you had stored in your custom prompts. So, that is very straightforward. The part that I find most interesting is how skills are managed.
So, remember we mentioned before in the system prompt that here there is a section with all the skills available, and that is, of course, the first part of the skills workflow. So, in the system prompt, let's just go again, mention the system prompt. There is a lot of things, blah blah blah. And then, at some point, there is the list of skills available, as I mentioned before.
Okay? Just like that. And [snorts] so, now your agent Pi and your LLM knows that it has uh skills to work with. Okay?
So, it is actually aware aware that it has skills. It is not aware that it has custom slash commands because they just uh reach Pi completely rendered. But, for skills, they don't reach Pi completely rendered, actually. Uh what happens is that let's suppose that you Uh so, here's the system prompt, and then the user, uh you, send your \{{}slash} scale colon, and then you mention the scale that you want.
Let's suppose that you're, I don't know, your custom workflow. Now, this right here is going to be intercepted by the interactive layer. So, uh your agent core will not see this command. It It has no idea that you call a scale like doing \{{}slash} scale colon.
Okay? You could very well do uh use another um CLI or another TUI that uses the dollar sign like Codex or uh just a slash command like a cloud code, et cetera. Okay? So, what happens is that when this command reaches the um the interactive layer of your agent, of your CLI, this is going to be um replaced by the scale like this, scale with markup tags, which will contain its name.
It will contain its description. And it will notably contain its location. And the location right here is basically just uh telling your agent where uh this skill is located. So, for example, it can be located in say Pi uh agent skills.
It can be, for example, located in \{{}dot} agents \{{}slash} skills. And this can be either in the current working directory or in your home directory. And this is going to be very important because this data is going to be sent in the message, okay? So, the AI, your LLM, does see this, okay?
But, there is a custom instruction right here in the prompt saying right here saying that if a skill is invoked use the read tool to read it. And what happens is that it will basically just after receiving the skill, it will just call the tool read, and it will read this location, and then get the response, and continue all the work. So, [snorts] the skills, at least in Pi, are not automatically um replaced at the interactive layer. Some other agents that I have seen take this command right here and immediately um paste the contents of the skill directly from here.
But, what the Pi does, at least in this interactive layer, of course, you can do this differently because this is done outside of the core uh that we saw before, uh what it does is it just sends the skill that was called with the name, the description, and its location so that Pi manually opens it with a tool call and gets the results and then just continues with the rest. Um so, there you go. I mean, I think we have covered pretty much everything related to how Pi is built. I feel like you should be ready to at least start with Pi and maybe even create your own version of Pi.
I find it very educational. I have been working on things like that before and over the past few weeks and it's very fun. So, I hope that this has been interesting. This is just a kind of a side research project that I was working on.
If you're interested in similar videos like this, feel free to let me know and of course if you have any questions, post them right here in the comments. I'll be very happy to talk about this. So, thanks a lot and I will see you in the next one.
The video discusses the concept of pi, emphasizing its status as an irrational number and its significance in mathematics. It explains that while many people recognize pi as uncomputable, this interpretation is often misunderstood. The term "computable" has a specific mathematical definition, which pi meets through various algorithms that can approximate its value to any desired precision. The video also introduces the perspective of ultrafinitism, which questions the validity of infinitely large numbers and irrational numbers like pi, arguing that they lack precision. Ultimately, the discussion highlights the importance of understanding mathematical definitions and the nuances of computability in relation to numbers like pi.
Pi is shortly the most famous non-integer. [music] People from all walks of life are at least vaguely aware of pi. And what do you think is the one thing that everybody knows about pi? In the past, I might have said the one thing is that pi has something to do with circles.
But honestly, so much of the iconography of pi that makes it onto posters and merchandise and into the public consciousness has to do with its digits, nothing to do with circles. I think the one thing everybody knows about pi is that it's irrational. Or as a layman might describe it, it goes on forever. We can't compute it.
We can't write it down. So then, explain this. A comment from is uncomputable, but it has 52 [music] downvotes. Why?
To explain the booing that impressive_mud5074 got, we need to know what computable actually means. Normal people might say, "Yeah, I know pi. It's that uncomputable number. Don't even calculators have to approximate it?
Your TI-84 Plus, for example, doesn't use the platonic pure and perfect pi, but rather uses only 13 digits after the decimal." But when math nerds say computable or uncomputable, they mean something very specific. Once we understand that, we can better understand the extremist position that this commenter is actually taking. Yes, even math has extremists. And if you want to amass downvotes on math subreddits, there's hardly a tactic more effective than being a pea in a pod with this guy.
So then, let's get on with the explanation and the all-important context. Then, if you think you need to, you can go downvote impressive-mud5074 too and show him what for. When he says that pi is uncomputable, [music] he doesn't mean the same thing that a mathematician typically means. In 1936, Alan Turing introduced computable numbers with this informal definition.
The real numbers whose expressions as a decimal are calculable by finite means. So then, pi is uncomputable since its decimal expansion is infinite and non-repeating. There's no finite process to simply produce the decimal expansion of pi. But that's not exactly what Turing meant.
His definition in full detail involves computable sequences and A machines, which would later be dubbed Turing machines. The modern definition, which is mostly equivalent, is that a number is computable if there is a finite terminating algorithm which can calculate it to any desired precision. Finite and terminating are the key words here. What would a finite algorithm for pi look like?
Well, we could just use any of the well-known infinite series for pi. These sums are, in theory, infinite, but the instructions for carrying them out as far as we need are finite. The instructions are right there. We can add up as many of the terms as we like or need, and the algorithm will stop once it's added our desired number of terms.
At this point, a counterexample may shed light on this idea. If pi actually is computable because we can approach it with an infinite series, then what the heck is an uncomputable number? We'll save that for the end, but for now, the point is pi absolutely is computable by Turing's definition, which we didn't go fully into, and by the modern definition. But but but but but what about impressive-mud5074's definition?
I suppose we need to look at the argument. The thread mud commented on basically asked for novel examples of uncomputable functions. They're like uncomputable numbers, but they're functions. Mud's irrelevant response simply said pi is uncomputable.
And then some incredibly optimistic people attempted to reason with him. OP replies and explains that pi is computable and commends mud on his boldness for answering a question without looking up anything beforehand. In response to the correction, mud explains what a transcendental number is. OP says that's not what computable means.
Mud says, yes it is, and then he gives a hint towards what he's actually talking about. He says you can approach pi, but not compute it. It's apparent that his issue with pi is that it's irrational and its decimal expansion can't be exactly computed in finite time. Then nma4r joins the fight and says, please for the sake of God just look up what computable functions mean before you reply.
Mud politely declines and provides a link to the Wikipedia page on ultrafinitism. This is like if I was debating you on the shape of the earth. You say, I don't think you understand. The earth is a sphere.
Watch a video of a ship sailing towards the horizon. And in response, I link you the Wikipedia page on idiots. But yes, it's clear mud has a philosophical contention with this discussion that prevents him from even engaging with this question of computability. He's an ultrafinitist.
It sounds cool, but in math circles, this title is a scarlet letter. And you might think, oh come on, scarlet letter. Surely our beloved math people are polite and open all ultrafinitists are idiots. So, what the heck is ultrafinitism and [music] why is this actual perspective about mathematics so unceremoniously dismissed on r/learnmath?
In short, ultrafinitists are not so quick to permit arbitrarily large numbers simply because our symbols are powerful enough to denote them. Just as a hypocrite speaks oaths and writes pledges, what meaning does it have if these promises remain empty words next to evil deeds. And what about 2 to the power of 100? This number is so great that in seconds it represents tens of quintillions of millenniums.
Is it meaningful to say such a number exists? Ultrafinitists believe we have to draw a line somewhere. There's a point at which numbers grow so high and become so large as to cast shadows of doubt over gods. This is in contrast to a finitist who's willing to permit a whole number of any extraordinary size, but to consider an infinite object like the set of whole numbers is strictly forbidden.
But our humble pi is planked in in a tsunami compared to infinity. So, on what grounds would Mud oppose this number? Well, in his Arithmetica Integra back in 1544, German monk and mathematician Michael Stifel put it well when he said, "Other considerations compel us to deny that irrational numbers are numbers at all. To wit, when we seek to give them a decimal representation, we find that they flee away perpetually, so that not one of them can be apprehended precisely in itself.
Now, that cannot be called a true number which is of such a nature that it lacks precision. Therefore, just as an infinite number is not a number, so an irrational number is not a true number, but lies hidden in a kind of cloud of infinity. Wow. There is clearly some fragment of infinity within any rational like pi.
A fragment that may be enough to enter pi among an ultra finitists lists of numerical cryptids. But again, it is a finite number and it can be computed via a finite algorithm. So really, why would an ultra finitist or Mud specifically deny the existence of pi? Or would they?
Well, in another comment chain on the same thread, Mud pokes further and receives more free tutoring from the learn math subreddit. He links to ultrafinitism and says very large numbers are uncomputable, which colloquially may sound true because of obvious physical limitations of computer memory and available time, but we're talking about the mathematical notion of computability. Now, the formal definition does appeal to a model of computation in order to formalize the meaning of algorithm. The most standard such model being the aforementioned Turing machine.
This model is defined to run on an infinite tape and can, depending on the program and input, run perpetually and never halt. All of this to say that whole numbers of any extraordinary size requiring any inconceivable amounts of computer run time to print as a binary string are still, by definition, computable. Because, simply put, the size of a number is not a relevant fact for the models of computation that are part of the definition of computability. Imagine an epic username asks Mud, with the prevalence of people here disagreeing with you, why do you claim your point and definition hold?
Mud says it's because logic says he's right. Imagine an epic username replies, "It's not a matter of logic. Hey, don't bleep. Don't bleep.
I didn't say anything." It's not a matter of logic, but definitions. What you're trying to explain is an irrational number, not uncomputable. Though, remember that uncomputable numbers are not the topic of the thread either. The topic is uncomputable functions that aren't derivative of the halting problem.
But, the topic of this video is impressive hyphen Mud 5074. So, let's continue. Mud specifies what he means by computable, that it finishes computing, and draws a comparison to the halting problem, the problem of determining if a program will halt or run forever on a given input. He basically argues that if we can say pi exists simply because we can run algorithms for arbitrarily many steps to achieve a desired level of precision, then we might as well say we can simply stop a program at any arbitrary point we like, and so all programs halt, which contradicts Turing's landmark 1936 paper that proved the halting problem is undecidable.
Whether or not a program will run on an input should be inherent to the program and the input, if there is one. An external source can't arbitrarily decide to stop the program from running and thusly conclude that the program halts. And Mud views pi similarly as having an inherent fragment of infinity. To say pi exists because we can stop an infinite procedure at any point we like for a workable approximation, in Mud's view, evades the central issue entirely, just as stopping a program manually evades the question of whether it would ever halt naturally.
But, imagine an epic username definitely reposts Mud explaining the key difference. To know if a program input pair halt, the computation has to be carried out. The program has to run. But, for the series that converge to pi, the output is already known.
The only question is how far out you want to take the computation. But, this still ignores Mud's philosophical issue with the number. We can stop our sum somewhere for an approximation, but we know that the series does not halt. They are, by their definition, infinite.
Imagine an epic username attempts to reassert the definition of computable, emphasizing the arbitrary precision. But, honestly, Mud cooks him. I choose 100% precision as the arbitrary amount. Do that.
Thanks. Of course, in the definitions, this arbitrary precision refers to an arbitrarily small positive error, which means that zero error, or 100% precision, is not covered by the definition. But, it is a pretty funny response. They continue to go back and forth.
Imagine an epic username says, "It's hard to convince a smart person, impossible to do so for an idiot." Mud replies, "I'm trying as hard as I can to convince you. Sorry." Suffice to say, no. Mud definitely does not believe in pi. Because, even though it is finite and computable by our definition, he's concerned with the actual process of computation.
And obviously, an ultra finitist is not going to admit an infinite process to define a number. Or, at least that's what Mud thinks. But, what about ultra finitists in general? I suspect they'd all agree with Mud on some level, but it's difficult to say precisely.
I'm no expert on ultra finitism, and the belief is fringe enough and not quite well developed enough to have a universally agreed upon formal foundation by its proponents. And that's part of why it's typically dismissed so quickly. For most mathematicians, there's already a pretty satisfactory foundation for maths, which does permit forms of infinity. No need to reinvent the wheel for a more constricted system that's less developed.
But for sake of example, we might as well look at another ultrafinitist. Among the most famous is certainly Doron Zeilberger. I saw him give a talk sometime ago, but he had a thick accent and I couldn't understand a word. But thankfully, he has a lot of written work.
And in his essay, "Real Analysis Is a Degenerate Case of Discrete Analysis", he says it's utter nonsense to say square root of two is irrational. And he would presumably think the same of pi. Indeed, to call it irrational presupposes that it exists. Throughout this essay, Zeilberger is discussing the true nature of our mathematical universe.
We often discuss the real number line, but Zeilberger asks us to consider the real real number line, which he says is neither real nor a line. His conception of the number system has some biggest number, a massive unspecified prime P. Additionally, between the whole numbers isn't a smooth continuum of rationals and irrationals, >> [music] >> but rather a discrete set of values that are very close together as determined by a small unspecified mesh size H. And since this conception of the real numbers only admits multiples of the small rational number H, it certainly doesn't admit pi as we know it.
And Zeilberger doesn't view this exactly as a line, but as a necklace or loop upon which something called modular arithmetic applies, but that's not relevant to the pi discussion. At the end of the day, I hope you come away from all this with an understanding of the disagreement on display. Unfortunately, Mud doesn't give a steel man of the ultrafinitist position. He doesn't engage with any depth or precision, preferring to proffer links and witticisms.
It's as if he was the one with the prevailing opinion and was simply brushing off others who are interrupting a thrilling ultrafinitist discourse. [music] But make no mistake, at least on a surface level, there are many smart people who agree with Mud and have written many interesting essays and arguments about the ultrafinitist position. But one loose end remains, which is the other side of uncomputable numbers. We've been talking about Mud and the ultrafinitists.
And they think a bunch of numbers are uncomputable, the really big ones and the really specific ones. But considering the actually common definition of computable number, it is rather difficult to think up a counterexample. Usually, algorithms are how we can deal with the messier numbers. >> [music] >> So, if an uncomputable number can't be approached by an algorithm, how could we even specify it?
How do we set our fingers upon the unreachable? One answer to that question is as unsatisfying as it is astounding. First, it's important to know there are many more real numbers than there are whole numbers. We can count the whole numbers, 1 2 What's next?
3 That's right. Good boy. Accordingly, the whole numbers are said to be countably infinite. But the real numbers, which can't be counted or listed in this fashion, comprise a much greater infinity.
Any attempt at listing all the real numbers is easily shown to be incomplete by Cantor's diagonalization argument. All of this to say, if we have a countable list of numbers, then practically every single number in existence isn't in the list. Countable infinity is tiny. Returning to the question at hand, how can we entertain the existence of uncomputable numbers if we can't even name one?
If by definition an algorithm can't even approach one. Well, certainly any computable number, since it can be defined by a finite terminating algorithm, can also be described in our natural language by describing the algorithm. Like pi is four times the limit of the alternating sum of the reciprocals of odd numbers. Now, here's the crazy part.
How many English language descriptions of numbers are there? The answer is that a very tiny countable infinity. This symbol for it is pronounced aleph null. To show this, just take our 26-letter alphabet, throw in some punctuation symbols, and enforce this order.
Then certainly the list of strings is countably infinite. There are the one-character strings, which can be ordered in their natural way, then the two-character strings, all the three-character strings, and so on, all ordered in their lexicographic or dictionary ordering. Considering all possible strings of these characters, most of them will be nonsense, but some of them will be English sentences, and some of those English sentences will be precise descriptions of particular numbers. Now, certainly the list would contain precise descriptions of every computable number, since somewhere in the list would be a description of the appropriate algorithm.
But how many of the numbers would the list miss? Well, since the list is countable, we would be missing basically all of them. And every one of those, almost every single number in the world that we missed, is uncomputable. That is disturbing.
However, our list of English strings will also contain some descriptions of uncomputable numbers. Although we've accepted for this argument that a finite terminating algorithm can be turned into natural language, the converse is certainly not true. So, let's finish with that. A natural language description of an uncomputable number, which is necessarily not something that could be turned into an algorithm for precise computation.
And since it's come up a couple of times now, let's build the number from from the halting problem. I will attempt to do this as quickly as possible and thus avoid going into a detailed description of Turing machines or any rigorous computation model. Beneath the surface, computer data is binary, zeros and ones, which are called bits. This is the language comprehensible to electronics that are built from on-off transistors.
There is electric current or there isn't. An obvious consequence of this is that if desired, we could encode any and every computer program as a finite string of bits, as well as every input that a program might take. So, here in this table, we have every possible program and every possible input. And note that we can do this because finite bit sequences are countable and can be ordered.
We can just order them by their lengths and then with in each length, order them by the size of the number the bit sequence represents. So, if programs and inputs can be bit sequences, then we can order them. So, again, here we have every possible program with every possible input. Some programs will run fine with no input.
Some programs may not be able to take a particular input and would halt immediately. And certainly, some program input pairs will run forever and never halt. Regardless, now that we have every possible program input pair, we can enumerate them or put them in order. The ordering follows this simple zigzag pattern along the diagonals.
So, this theoretical collection of every possible program and input pair is countable. [music] There's a first, second, third, fourth, fifth, and so on. Now, consider this indicator function Xn. We have an ordered list of every possible program input pair.
So, how Xn works is it equals one if the nth program input pair halts and zero if it doesn't halt. And now, here's our guy. This number is surely uncomputable. For if there was an algorithm to compute it, that algorithm would have to solve the halting problem for every program input pair.
But we know the halting problem is undecidable. It's perhaps unsurprising that our descriptions of uncomputable numbers seem a bit more like a thought experiments. Such is the abstract nature of tangling with infinity. Aristotle entertained infinity from two perspectives: actual and potential.
Describing potential infinity, he wrote, "For generally, the infinite has this mode of existence. One thing is always being taken after another, and each thing that is taken is always finite, but always different." Actual infinity, on the other hand, he deemed complete, definite, and impossible. Perhaps it's our hubris and not our sense that allows us to speak the heavens themselves into existence with the axiom of infinity. Perhaps in mud we should find a humble hero content in his finite world and his very finite intellect.
If the ultrafinitists are wrong, we ought to go on and drawing our toy and dancing with infinities in Cantor's paradise. But, if they are right, as Zealberger says, what is completely meaningless is any kind of infinite, actual or potential. If they are right, then it's all the more important that we dance, dance, dance with what little finite [music] time we have left before we are expelled as fools from paradise. >> [music] >> I could laugh so I can get