pikuma Profile picture
Apr 14 25 tweets 10 min read Twitter logo Read on Twitter
I remember reading about determinants in high school. The name was scary and not much context was given. 😦

For a long time, a determinant was just a value I had to blindly compute using a formula.

Here's what I would like to know about determinants when I first started... 🧵 twitter.com/i/web/status/1…
The word "determinant" appears when we are learning about matrices.

And since we want to build some *intuition*, let's look at a simple 2x2 matrix first.

We learn that the determinant of a 2x2 matrix is:

| a b |
| c d | = a*d - b*c

But where does that come from? Determinant of a 2x2 matrix
Alright, let's go back in time!

Seki Kōwa was a Japanese mathematician from the Edo period. He had Samurai origins but was adopted into the noble Seki family, subject of the shōgun.

As a kid, he had great potential with numbers. He was often called "Japan's Newton". Seki Kōwa Japanese mathemat...
Seki Kōwa was involved in feudal accounting and also surveying reliable maps for his employer's land.

In 1684, his job required him to start looking at *linear systems*.

A linear system is a set of *linear* equations that need to be true together (as a system). A linear system of two equa...
Oh, and just to make sure we are all on the same page, linear equations are equations that represent functions with solutions that form a line in the Euclidean plane.

We put these equations in a system when they all need to hold true at the same time. Two lines plotted in the ca...
In the example above... a, b, c, d, e, and f are known numbers (usually ∈ ℝ).

What we are really interested in is finding the values of (x) and (y) that satisfy that system, making the equality true, together. Coefficients of the system ...
This was how Seki Kōwa approached this problem:

We'll try finding the value of x first.

From algebra, we know that we can multiply both sides of the equation by the same value and the equality is still true.

Therefore, we're going to multiply the entire first equation by d. Multiplying all terms of th...
And now, we are going to also multiply the entire second equation by b.

Look... I know this looks weird and random, but keep in mind that the main reason we are doing this is because we are trying to cancel the "y" terms out from the final solution so we can find "x". Multiplying all terms of th...
And here is the magic!

We will *subtract* both equations, which will hopefully cancel the "y" terms out.

We get the result: adx-cbx = de-bf Subtracting both equations ...
Now that we canceled the y term out and we have only x left, let's go ahead and find our x.

Using simple algebra, if we factor x out on the left side, and then divide everything by (ad-cb), we find our x. Finding the value of x
Cool... do you see how x is written as a fraction?

Here comes the most important part of this post...

Do you agree that we might have an issue if the denominator (bottom part) of this fraction is *zero*?

Therefore, (ad*cb) "DETERMINES" something about our system!!! The denominator *determines...
Let me repeat that again!

That denominator of this fraction is the "DETERMINANT" that *determines* if we might have a problem when solving our system.

Therefore, it is a #determinant of that system. The determinant of a 2x2 sy...
Let's write this down:

1. If the denominator is different than zero, we have no problem (and the system has a unique solution).

2. If the denominator is zero, we'll have a problem finding a solution for that system.

It all depends on the *determinant* of that system!
Independently, in 1693 (about 10 years after Seki Kōwa's discovery), Gottfried Leibniz proposed something similar in a letter that he wrote to the French mathematician l'Hopital. Mentions of determinants fr...
Seki Kōwa and Leibniz discovered it, but it was Carl Gauss who first used the name "determinant" in 1801.

Oh, this intuition behind the determinant of 2x2 system is the same for other dimensions.

Of course, the bigger the matrix, the trickier the determinant gets. Determinant of a 3x3 matrix
Historically, this is how the word *determinant* first appeared. Of course, there are more modern interpretations of what a determinant is, depending on the context we are using them.

This tweet made me think of #gamedev applications of determinants:
For example, we use a geometrical interpretation of a determinant in our lectures on #GamePhysics.

We can realize that the determinant of a 2x2 matrix is the *area of the parallelogram* defined by the vectors of our matrix.

Once again, if that area is zero... no bueno! Determinant as the area of ...
Just to give you an example, let's look at how we used the value of a matrix #determinant in our recent Youtube video about "triangle rasterization":

📽️

We must identify and only paint the pixels that are considered to be "inside" a triangle...
For that, I spoke about an important concept called the "3D vector cross-product".

The 3D cross product gives us as a result a new vector that is *perpendicular* (90 degrees) to both vectors A and B. 3D vector cross-product
And, bear with me for a second because this cross-product conversation has *everything* to do with our talk about determinants!

So, one of the problems we had to solve when we were rasterizing our triangle was to compute the total *area* of our 2D triangle on the screen. Total area of the 2D triang...
And for that, we used an important property of the cross-product that tells us that:

"The *length* of the perpendicular 3D cross-product vector is also the signed area of the parallelogram formed by the vectors A and B."
So, we can find the area of our screen triangle by computing the cross-product of vectors A and B (edges of our triangle).

After all, the cross-product magnitude (length) is the area of the parallelogram, and the area of our triangle is 1/2 of the area of that parallelogram. Area of the triangle is hal...
It looks good, but there is just one catch here!

Vector cross-product is only really defined in 3-dimensions... but we can use a small hack to find the "2D cross-product" two vectors.

We can *imagine* that there's an arrow perpendicular to the screen, and compute its magnitude. 2D cross-product is the mag...
So, this 2D cross-product is the magnitude (length) of the z-component of the perpendicular vector between A and B.

And the z-component of A x B is given by:

(a.x*b.y) - (b.x*a.y)

Does that look familiar??? 😮

That's the formula of the determinant of a 2x2 matrix!
There we go! Everything connects together. 🙂

1. The determinant is interpreted as being the area of the parallelogram between the vectors of our matrix.

2. The cross-product magnitude is the area of the parallelogram formed between two vectors A and B.

Beautiful stuff! ❤️

• • •

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

Keep Current with pikuma

pikuma 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 @pikuma

May 12, 2022
You know I always add some #math spice into my #gamedev courses, and that usually means touching some cool linear algebra.

But something most students still struggle with is the *intuition* behind the #Determinant of a matrix.

Let's quickly look at it together...🙂

[1/18] 🧵
Since we are really interested in building some *intuition*, let's look at the determinant of a 2x2 matrix first.

When we were in high school, we learned that the determinant of a 2x2 matrix is given by:

| a b |
| c d | = a*d - b-c

But, where does that come from?

[2/18]
Seki Kōwa was a Japanese mathematician from the Edo period, and he was sometimes described as "Japan's Newton."

He had Samurai origins but was adopted into the noble Seki family, subject of the shōgun.

As a kid, it was visible that he had great potential with numbers.

[3/18] Seki Kowa
Read 20 tweets
Feb 25, 2022
Since we discussed isometric games in a previous post, let's briefly mention one of the big #devs of this style: Chis Sawyer.

Most retro gamers think Chris' first isometric game was Transport Tycoon, but his journey started 10 years before.

So, let's dive in!

[1/15] 🧵...
In 1984, Chris programmed QOGO.

QOGO was a clone of the popular arcade game #QBert that ran on the Memotech computer.

QBert is one of the most popular arcade games to carry the isometric look. If you are a retro gamer, you probably played (or at least heard of) QBert.

[2/15]
Now, we mortals usually coded for these machines using some sort of BASIC. But we have to remember that BASIC is an interpreted language, meaning every high-level BASIC command needs to be translated to low-level machine code.

And for 8-bit machines, that means *slow*!

[3/15] Memotech MTX computer
Read 15 tweets
Dec 27, 2021
This is one of my favorite folklore stories about computer #bugs!

...

In the 1980s, Jake Poznanski had a programming mentor, Sergei, who was writing software for an SM-1800, a Soviet clone of the PDP-11.

[1/10] 🧵
The computer was just installed at a railroad station near Sverdlovsk, a major USSR shipping center at the time. The new system was designed to route trains and cargo to their intended destinations, but there was a nasty bug that was causing random failures and crashes.

[2/10]
The crashes would always occur once everyone had gone home for the night, but despite extensive investigation, the computer always performed flawlessly during manual and automatic testing procedures the next day.

[3/10]
Read 11 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!

:(