Dec 29 15 tweets 5 min read
This stone tablet from 1800-1600 BC shows that ancient Babylonians were able to approximate the square root of two with 99.9999% accuracy.

How did they do it?
First, let’s decipher the tablet itself. It is called YBC 7289 (short for the 7289th item in the Yale Babylonian Collection), and it depicts a square, its diagonal, and numbers written around them.

Here is a stylized version.
As the Pythagorean theorem implies, the diagonal’s length for a unit square is √2. Let’s focus on the symbols there!

These are numbers, written in Babylonian cuneiform numerals. They read as 1, 24, 51, and 10.
Since the Babylonians used the base 60 numeral system (also known as sexagesimal), the number 1.24 51 10 reads as 1.41421296296 in decimal.
This matches √2 up to the sixth digit, meaning a 99.9999% accuracy!
The computational accuracy is stunning. To appreciate this, pick up a pen and try to reproduce this without a calculator. It’s not that easy!

Here is how the ancient Babylonians did it.
We start by picking a number x₀ between 1 and √2. I know, this feels random, but let’s just roll with it for now. One such example is 1.2, which is going to be our first approximation.
Because of this, 2/x₀ is larger than √2.
Thus, the interval [x₀, 2/x₀] envelopes √2.

From this, it follows that the mid-point of the interval [x₀, 2/x₀] is a better approximation to √2. As you can see in the figure below, this is significantly better!

Let's define x₁ by this.
Continuing on this thread, we can define an approximating sequence by taking the midpoints of such intervals.
Here are the first few terms of the sequence. Even the third member is a surprisingly good approximation.
If we put these numbers on a scatterplot, we practically need a microscope to tell the difference from √2 after a few steps.
Were the Babylonians just lucky, or did they hit the nail right on the head?

The latter one. If you are interested in the details, check out the full version of the post here: thepalindrome.substack.com/p/how-did-the-…
If you have enjoyed this explanation, share it with your friends and give me a follow! I regularly post deep-dive explainers such as this.
One more thing. The YBC 7289 tablet is actually clay, not stone.

This is my secret engagement tactic: I plant a simple error, then let others point it out.

(Just kidding. Seriously though, I always let a silly mistake through the cracks accidentally.)

• • •

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

This Thread may be Removed Anytime!

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

Dec 22
This single line of bash code will crash your system:

:(){ : | : &};:

It is a so-called fork bomb, duplicating itself with each call, eventually draining system resources dry.

Here is how it works, character by character.
In bash, functions are defined with the syntax

foo() {
# function body
}

Using this syntax, the fork bomb first defines the function `:`, then calls itself.
Thus, we have

:() {
: | : &
}

What is happening inside the function? There are two symbols here that need explaining: `|` and `&`.
Dec 20
This is not a trick: the cosine of the imaginary number 𝑖 is (e⁻¹ + e)/2.

How on Earth does this follow from the definition of the cosine? No matter how hard you try, you cannot construct a right triangle with an angle 𝑖. What kind of sorcery is this?

First, the fundamentals.

In their original form, trigonometric functions are defined in terms of right triangles.

For an acute angle α, the sine and cosine are given by the ratio of the appropriate leg and the hypotenuse. (This is visualized below.)
Is this a proper definition? Doesn't it depend on the choice of the triangle?

Even though the sine and cosine formally depend on the sides, they remain invariant to translating, scaling, rotating, and reflecting the triangle.
Dec 16
What is common in Fourier series and the Cartesian coordinate system?

More than you think: they are (almost) the same.

Let me explain why!

In the Euclidean plane, it can be calculated using the "magnitude x magnitude x cosine" formula, also known as the geometric definition.
Now, let's project x to y!

With basic trigonometry, we can see that the inner product is related to the length of the projection.
Dec 9
This will surprise you: sine and cosine are orthogonal to each other.

What does orthogonality even mean for functions? In this thread, we'll use the superpower of abstraction to go far beyond our intuition.

We'll also revolutionize science on the way.
Our journey ahead has three milestones. We'll

1. generalize the concept of a vector,
2. show what angles really are,
3. and see what functions have to do with all this.

Here we go!

The concept of angle is intuitive as well. According to Wikipedia, an angle “is the figure formed by two rays”.

How can we define this for functions?
Dec 1
If it is raining, the sidewalk is wet.

If the sidewalk is wet, is it raining? Not necessarily. Yet, we are inclined to think so. This is a preposterously common logical fallacy called "affirming the consequent".

However, it is not totally wrong. Why? Enter the Bayes theorem.
Propositions of the form "if A, then B" are called implications.

They are written as "A → B", and they form the bulk of our scientific knowledge.

Say, "if X is a closed system, then the entropy of X cannot decrease" is the 2nd law of thermodynamics.
In the implication A → B, the proposition A is called "premise", while B is called the "conclusion".

The premise implies the conclusion, but not the other way around.

If you observe a wet sidewalk, it is not necessarily raining. Someone might have spilled a barrel of water.
Nov 16
Matrix multiplication is not easy to understand.

Even looking at the definition used to make me sweat, let alone trying to comprehend the pattern. Yet, there is a stunningly simple explanation behind it.

Let's pull back the curtain!
First, the raw definition.

This is how the product of A and B is given. Not the easiest (or most pleasant) to look at.

We are going to unwrap this.
Here is a quick visualization before the technical details.

The element in the i-th row and j-th column of AB is the dot product of A's i-th row and B's j-th column.