Tivadar Danka Profile picture
Nov 3 18 tweets 6 min read
Behold one of the mightiest tools in mathematics: the camel principle.

I am dead serious. Deep down, this tiny rule is the cog in many methods. Ones that you use every day.

Here is what it is, how it works, and why it is essential.
First, the story.

The old Arab passes away, leaving half of his fortune to his eldest son, third to his middle son, and ninth to his smallest.

Upon opening the stable, they realize that the old man had 17 camels.
This is a problem, as they cannot split 17 camels into 1/2, 1/3, and 1/9 without cutting some in half.

So, they turn to the wise neighbor for advice.
The wise man says "hold my camel", and solves the problem by lending one to the boys.

Now the stable has 18. The eldest son takes 9 home, while the middle and smallest son leaves with 6 and 2, as their father wished.

The wise man takes his camel back, and everybody is happy.
Thus, the camel principle is born: adding and subtracting the same quantity doesn't change the equality, but can help in the computation.

In mathematics, you cannot live without this principle.

I'll show you two examples.
The first one is the quadratic equation.

Its solution formula is one of the few things that everybody remembers from high school. Even if they are woken up in the middle of the night.

This formula is derived from the camel principle. Let me show you how!
After factoring out 𝑎 from the equation, we notice that the famous identity

(α + β)² = α² + 2αβ + β²

might help to factor the quadratic equation into a product.

To achieve that, we apply the camel principle!
After adding and subtracting the same quantity, the terms with 𝑥 factor into a product.
This leads straight to the solution formula.
There is an alternative version of the camel principle, performing a similar feat: multiplying and dividing with the same quantity.

This doesn't change the equality either.
To illustrate, let's look at derivatives, the main engine behind mathematics, physics, and optimization.

(And tons of other fields that allowed technology to get where it is now.)
How would you calculate the derivative of a composite function?

This is a quintessential question. Without this, you don't have backpropagation, gradient descent, and thus neural networks.

(At least until someone invents a clever alternative. But that'll take a while.)
You guessed right: the camel principle!

(At least, the second version, where you multiply and divide with the same quantity.)
After the camel principle is applied, the limit can be carried out termwise.
(For those with the eagle's eyes: yes, the denominator can be zero. You can epsilon-delta your way out of that, but I won't do it here.)
And thus, we have the chain rule, one massive pillar of science and technology.

This is what we use to perform backpropagation, enabling us to train our neural networks in a reasonable time.
The lesson here: tiny mathematical curios such as the camel principle are often dismissed as "lacking any applications".

However, such short-sightedness frequently leads astray.

By understanding atoms, you are able to build skyscrapers.
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.

Understanding mathematics will make you a better engineer, and I want to help you with that.

• • •

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

Keep Current with Tivadar Danka

Tivadar Danka 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 @TivadarDanka

Oct 27
Conditional probability is the single most important concept in statistics.

Why? Because without accounting for prior information, predictive models are useless.

Here is what conditional probability is, and why it is essential.
Conditional probability allows us to update our models by incorporating new observations.

By definition, P(B | A) describes the probability of an event B, given that A has occurred.
Here is an example. Suppose that among 100 people, 30 have COVID.

Based only on this information, if we inspect a random person, our best guess is a 30% chance of them having COVID.

This is not good enough.
Read 13 tweets
Oct 26
You are (probably) wrong about probability.

I'll show you. How many heads you'll get if you toss a fair coin 10 times?

If you answered 5, here is why you are wrong.

(Below is the 100 HUF coin, if you were wondering.)
You might as well try it if you have a coin in front of you.

All we can say with 100% certainty is that the number of heads will be between zero and ten.

However, that's not all to it.
For instance, the probability of landing 8 heads and 2 tails is approximately 4.39%.

What does then the 1/2 probability of heads mean?
Read 9 tweets
Oct 25
The number of atoms in the observable universe is approximately 10^80.

Randomly smashing my keyboard and reproducing this tweet has a chance of 1 in 256^280. This is infinitesimally small. Yet, if I keep trying long enough, it will happen with probability 1.

Let me explain why. Image
First things first. If we generate a random string of 5 characters, what is the probability of getting "hello"?

Assuming only ASCII characters, we have 256 options in total.

Thus, each character has a 1/256 probability of hitting the right one. Image
If we are truly random in our selections, each choice is independent of the others.

Thus, hitting every character has a probability of (1/256)^5. Image
Read 10 tweets
Oct 15
"Probability is the logic of science."

There is a deep truth behind this conventional wisdom: probability is the mathematical extension of logic, augmenting our reasoning toolkit with the concept of uncertainty.

In-depth exploration of probabilistic thinking incoming.
Our journey ahead has three stops:

1. an introduction to mathematical logic,
2. a touch of elementary set theory,
3. and finally, understanding probabilistic thinking.

First things first: mathematical logic.
In logic, we work with propositions.

A proposition is a statement that is either true or false, like

• "it's raining outside",
• "the sidewalk is wet".

These are often abbreviated as variables, such as A = "it's raining outside".
Read 30 tweets
Oct 12
The single biggest argument about statistics: is probability frequentist or Bayesian?

It's both, and I'll explain why.

Buckle up. Deep-dive thread below.
First, let's look at how probability behaves.

Probability quantitatively measures the likelihood of events, like rolling six with a dice. It's a number between zero and one. This is independent of interpretation.
In the language of mathematics, the events are formalized by sets within an event space. (The event space is also a set.)
Read 35 tweets
Oct 6
One of the coolest ideas in mathematics is the estimation of a shape's area by throwing random points at it.

Don't believe this works? Check out the animation below, where I show the method on the unit circle. (Whose area equals to π.)

Here is what's behind the magic.
Let's make this method precise!

The first step is to enclose our shape S in a square.

You can imagine this as a rectangular dartboard.
Now, we select random points from the board and count how many hit the target.

Again, you can imagine this as closing your eyes, doing a 360° spin, then launching a dart.

(Suppose that you always hit the board. Yes, I know. But in math, reality doesn't limit imagination.)
Read 16 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 on Twitter!

:(