10-K Diver Profile picture
Jul 22, 2022 29 tweets 10 min read Read on X
1/

Folks, today is July 22'nd. 22/7. Pi Approximation Day.

We all learned in school that 22/7 is a good approximation for pi.

But who came up with it? And how?

It happened ~2300 years ago. In ancient Greece.

Here's the story: 👇👇
2/

Before getting to pi, we should first understand the meaning of 2 geometry words: "perimeter" and "area".

Take a piece of paper. Draw any closed shape on it.

The "perimeter" of this shape is the *distance* the tip of your pen traveled as it traced out the shape.
3/

By contrast, the "area" of a closed shape is how much *space* the shape takes up on our piece of paper.

In other words, "perimeter" measures a shape's *boundary*. "Area" measures its *interior*.
4/

Even centuries ago, "area" and "perimeter" were vital concepts.

For example, if you had a farm and wanted to estimate how much crop it would yield, you'd calculate the farm's *area*.

But if you wanted to build a fence around the farm, you'd calculate its *perimeter*.
5/

So, for ages, mathematicians have been trying to devise formulas for the areas and perimeters of various shapes.

They quickly discovered one thing:

If a shape's boundary only has straight LINES, it's EASY to calculate its area and perimeter.

But CURVES are HARD.
6/

A circle, of course, is one of the most natural and symmetric curved shapes.

So, mathematicians tried for centuries to crack its area and perimeter.

Finally, ~2400 years ago, a Greek mathematician made some headway. His name was Eudoxus.
7/

Eudoxus discovered that he could cut up a circle into slivers, and then re-arrange these slivers into a "rectangle-like" shape.

This helped Eudoxus derive an equation connecting a circle's area (A), its circumference/perimeter (C), and its radius (r):

A = C * r / 2
8/

In the illustration above, we initially cut up the circle into 12 slivers.

But Eudoxus realized he could go much further.

He could cut up the circle into 24, or 48, or 96, or 1 million slivers!
9/

The more slivers Eudoxus used, the "closer" his final shape got to this "mythical" rectangle -- with width C/2 and height r.

But no matter how many slivers, the shape's area always equaled the circle's area A.

After all, the slivers came from cutting up the circle.
10/

Eudoxus realized there's only one way to reconcile this:

The circle's area has to be *exactly* (C/2) * r.

Thus, A = (C/2) * r.

This was a landmark moment for math. For the first time, an infinite "cutting up" process was used to reason about a finite thing like a circle.
11/

Notice we've said nothing about pi so far.

All we know so far is: A = (C/2) * r.

We don't yet know that A = pi * (r^2) or that C = 2 * pi * r.

It took another great Greek mathematician -- Euclid -- to piece that together.
12/

Euclid started with a simple observation.

When we scale a shape by a factor of x, its *area* scales by a factor of "x squared".

For example, doubling the side of a square doesn't just double its area. It quadruples it.

This holds for ALL shapes: triangles, hexagons, etc.
13/

Euclid applied this observation to "regular polygons" inside circles.

To get such "regular polygons":

- We take a circle,
- We put N evenly spaced points on its boundary, and
- We connect the dots.

Like so:
14/

Suppose Euclid had 2 circles -- with radii r1 and r2.

Euclid would then draw 2 regular N-gons: one inside each circle.

Then, by the "scaling of similar shapes" property:

( Area of 1'st N-gon ) / ( Area of 2'nd N-gon )
= ( r1 / r2 ) ^ 2

And this ratio doesn't depend on N.
15/

Just like Eudoxus, Euclid realized he could take N as high as he liked.

The higher his N, the closer his N-gon areas got to their respective circles' areas.

But the N-gon areas always had the same *ratio*: (r1/r2)^2.

So, the circles' areas HAD to be in that same ratio!
16/

What this means is:

If we have 2 circles with radii r1 and r2, their areas MUST be in the ratio (r1 / r2) ^ 2.

In other words, the area of a circle is proportional to the *square* of its radius.

And this *proportionality* constant is what we call "pi".
17/

So, we have our famous area and circumference (perimeter) formulas that use pi:

A = pi * (r ^ 2) and C = 2 * pi * r.

But so far, we've said nothing about how *big* pi is.

We don't know it's approximately 22/7.

Enter Archimedes -- our third great Greek mathematician.
18/

Archimedes got even more mileage out of Euclid's ideas.

His key insight: Sure, we can put a regular N-gon inside our circle. But we can ALSO put the circle itself inside a *second* regular N-gon.

That way, we'll have our circle nicely sandwiched between two N-gons!
19/

We can use this "Archimedes sandwich" to approximate pi as closely as we like.

It's how Archimedes got 22/7.

Again, the nub is in increasing our N.

As we take N higher, our outer and inner N-gons come closer -- *always* keeping the circle sandwiched between them.
20/

And as that happens, our N-gon perimeters become better and better approximations to the circle's circumference.

And that can be used to approximate pi more and more closely.

Here's how it works:
21/

The only part of this approximation scheme we haven't covered is how to calculate a_N and b_N -- the sides of our inner and outer N-gons.

Archimedes solved this brilliantly.

He developed what computer scientists today call an "iterative algorithm" to find a_N and b_N.
22/

Here's the idea.

First find a_6. This is easy enough. All it takes is some geometry involving hexagons.

Now, *use* a_6 to *calculate* a_12.

Then, *use* a_12 to *calculate* a_24.

Keep going as long as you like.

And similarly for b_6, b_12, b_24, etc.

Formulas:
23/

If you're curious how Archimedes got these formulas:

He essentially applied Pythagoras's theorem repeatedly.

Here's the math. But don't worry: you won't need it for the rest of this thread. Feel free to skip it. There will be no quiz. :-)
24/

~2300 years ago, Archimedes didn't have an easy way to calculate the square roots his formulas demanded.

It took him *months* of tedious calculations to come up with his 22/7 gem.

For that, he had to go to N=96 -- ie, inner and outer polygons containing 96 sides each!
25/

Today, we can implement Archimedes's logic in like 10 lines of Python.

Archimedes went up to 96-sided polygons. It took him months.

Our Python code goes up to ~100-million sided polygons. In milli-seconds.

How far we've come. And yet, how relevant Archimedes still is!
26/

I'll leave you with a few resources to learn more.

Prof. Steven Strogatz's outstanding book, Infinite Powers, contains some pi history.

It's also a lovely introduction to calculus -- for non-mathematicians.

(h/t @stevenstrogatz)

amazon.com/Infinite-Power…
27/

This ~18 minute video by @veritasium beautifully describes how Isaac Newton discovered a completely new method to calculate pi -- one that's far more powerful than Archimedes's.

28/

We often see headlines like:

"New research calculates pi to X trillion digits"

If you're curious about the methods these researchers use to find so many digits of pi, read this book: Pi Unleashed.

amazon.com/Pi-Unleashed-J…
29/

Thank you very much for reading all the way to the end.

If you thought this thread was long, you have no idea how long pi goes on for!

/End

• • •

Missing some Tweet in this thread? You can try to force a refresh
 

Keep Current with 10-K Diver

10-K Diver Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @10kdiver

Jan 1, 2023
1/

Get a cup of coffee.

In this thread, I'll walk you through "Gambler's Ruin".

This is a classic exercise in probability theory.

But going beyond the math, this exercise can teach us a lot about life, business, and investing.
2/

In my mind, Gambler's Ruin is the math of "David vs Goliath" ("Skill vs Size") type situations.

Here, David is a "small" player. He only has limited resources. But he's very skilled.

Pitted against David is Goliath -- a "big" player who has MORE resources but LESS skill.
3/

The battle between David and Goliath rages on for several "rounds".

Each round has a "winner" -- either David or Goliath.

David -- because of his superior skill -- has a higher probability of winning any individual round. That's David's advantage over Goliath.
Read 32 tweets
Dec 11, 2022
1/

Get a cup of coffee.

In this thread, we'll explore the question:

As investors, how often should we check stock prices?

To answer this, we'll draw on key ideas and concepts from many different fields -- probability, information theory, psychology, etc.
2/

Imagine we have a stock: ABC, Inc.

Every day that the market is open, our stock either:

- Goes UP 1%, or
- Goes DOWN 1%.

For simplicity, let's say these are the only 2 possible outcomes on any given trading day.
3/

Suppose we think ABC is a "good" investment.

That is, the company has a wide moat, good returns on capital, decent growth prospects, etc. And the stock trades at a reasonable price.

So, we buy the stock -- expecting to make a very good return on it. Say, ~15% per year.
Read 40 tweets
Oct 23, 2022
1/

Get a cup of coffee.

In this thread, I'll walk you through 2 key portfolio diversification principles:

(i) Minimizing correlations, and
(ii) Re-balancing intelligently.

You don't need Markowitz's portfolio theory or the Kelly Criterion to understand these concepts. Image
2/

Imagine we have a stock: ABC Inc. Ticker: $ABC.

The good thing about ABC is: in 4 out of 5 years (ie, with probability 80%), the stock goes UP 30%.

But the *rest* of the time -- ie, with probability 20%, or in 1 out of 5 years -- the stock goes DOWN 50%.
3/

We have no way to predict in advance which years will be good and which will be bad.

So, let's say we just buy and hold ABC stock for a long time -- like 25 years.

The question is: what return are we most likely to get from ABC over these 25 years?
Read 23 tweets
Sep 11, 2022
1/

Get a cup of coffee.

In this thread, I'll walk you through the P/E Ratio.

Why do some companies trade at 5x earnings and others trade at 50x earnings?

When I first started investing, this was hard for me to understand.

So, let me break it down for you.
2/

Imagine we have 2 companies, A and B.

Let's say both companies will earn $1 per share next year.

And both companies will also GROW their earnings at the SAME rate: 10% per year. Every year. Forever.
3/

Suppose A trades at a (forward) P/E Ratio of 10. So, each share of A costs $10.

And B trades at a P/E Ratio of 15. So, each share of B costs $15.

Which is the better long term investment: A or B?
Read 31 tweets
Sep 4, 2022
1/

Get a cup of coffee.

In this thread, I'll walk you through a fundamental business concept that may be counter-intuitive to some of you:

Just because a business has made $1 of PROFIT, it does NOT mean the business's owners have $1 of CASH to pocket.
2/

To understand why, let's start with how PROFIT is defined.

PROFIT = SALES - COSTS

That is, we take all sales (or revenues) the company made during a quarter or year.

We back out all costs incurred during this period.

That leaves us with profits.

Seems straightforward.
3/

Here's the problem:

The way a "lay person" understands words like SALES and COSTS is completely different from the way an *accountant* uses these same words.

These discrepancies can create enormous confusion.
Read 20 tweets
Aug 28, 2022
1/

Get a cup of coffee.

In this thread, I'll walk you through a framework that I call "Lindy vs Turkey".

This is a super-useful set of ideas for investors.

Time and again, these ideas have helped me think more clearly about the LONGEVITY of the companies in my portfolio. Image
2/

Imagine we're buying shares in a company -- ABC Inc.

ABC is a very simple company. It earns $1 per share every year. These earnings don't grow over time.

And ABC returns all its earnings back to its owners -- by issuing a $1/share dividend at the end of each year.
3/

Suppose we buy ABC shares for $5 a share.

That's a P/E ratio of 5.

We know we get back $1/year as a dividend.

So, for us to NOT lose money, ABC should survive AT LEAST 5 more years.

If something happens and ABC DIES before then, we'll likely lose money.
Read 32 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Don't want to be a Premium member but still want to support us?

Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal

Or Donate anonymously using crypto!

Ethereum

0xfe58350B80634f60Fa6Dc149a72b4DFbc17D341E copy

Bitcoin

3ATGMxNzCUFzxpMCHL5sWSt4DVtS8UqXpi copy

Thank you for your support!

Follow Us!

:(