Hacker Newsnew | past | comments | ask | show | jobs | submit | srean's commentslogin

And Colin Wright had one all along inside a milk bottle.

That's just the sad truth of the maximum -- use it or lose it. It can be quite disheartening. The good part is that it becomes easier to pick it up next time around. Happened to me so many times.

Thanks for the notes. This is marvellous. I do not work on, or have interest in cryptography algorithms, but this is such an interesting read.

Kelby Ludwig is such a talented explainer, it upsets me.

In 2D there's an alternative. One can rotate purely synthetically, by that I mean with compass and straight edge. This avoids getting into transcendentals.

Of course I am not suggesting building synthetic graphics engines :) but the synthetic approach is sufficient to show that the operation is linear.


> Even the "why does matrix multiplication look that way" is incredibly deep but practically impossible to motivate from other considerations. You just start with "well that's the way it is" and grind away

In my experience it need not be like that at all.

One can start by defining and demonstrating linear transformations. Perhaps from graphics -- translation, rotation, reflection etc. Show the students that these follow the definition of a linear transformation. That rotating a sum is same as summing the rotated(s).

[One may also mention that all differentiable functions (from vector to vector) are locally linear.]

Then you define adding two linear transformations using vector addition. Next you can define scaling a linear transformation. The point being that the combination can be expressed as linear transformations themself. No need to represent the vectors as R^d, geometric arrows and parallelogram rule would suffice.

Finally, one demonstrates composition of linear transformations and the fact that the result itself is a linear transformation.

The beautiful reveal is that this addition and composition of linear transformations behave almost the same as addition and multiplication of real numbers.

The addition asociates and commutes. The multiplication associates but doesn't necessarily commute. Most strikingly, the operations distributes. It's almost like algebra of real numbers !

Now, when you impose a coordinate system or choose a basis, the students can discover that matrix multiplication rule for themselves over a couple of days of playing with it -- Look, rather than maintaining this long list of linear transformations, I can store it as a single linear transformation in the chosen basis.


> Perhaps from graphics -- translation, rotation, reflection

Maybe ... but the fact that you included translation in the list of linear operations seems like a big red flag. Translation feels very linear but it is emphatically not [1]. This is not intended to be a personal jab; just that the intuitions of linear algebra are not easy to internalize.

Adding linear transformations is similarly scary territory. You can multiply rotations to your heart's content but adding two rotations gives you a pretty funky object that does not have any obvious intuition in graphics.

[1] I wouldn't jump into projective or affine spaces until you have the linear algebra tools to deal with them in a sane way, so this strikes me as a bit scary to approach it this way.


Mea culpa about translation.

For a moment I was thinking in homogeneous coordinates - that's not the right thing to do in the introductory phase.

Thanks for catching the error and making an important point. I am letting my original comment stand unedited so that your point stands.

About rotations though, one need not let the cat out of the bag and explain what addition of rotation is *.

One simply defines addition of two linear operators as the addition of the vectors that each would have individually produced. This can be demonstrated geometrically with arrows, without fixing coordinates.

* In 2D it's a scaled rotation.


To me the fact that translation in n dimensions is nonlinear but it becomes linear if you embed your system in n+1 dimensions is one of the coolest results from linear algebra, and it's why you need 4x4 matrices to express the full set of transformations possible in 3-space.

Can you elaborate on your point that translation is not linear? The OP agrees with you, so clearly your point is correct, but I personally just don't understand it. Isn't it true that translation is linear within the coordinate space of your model, even if the final distance traveled within a projected camera view is not?

edit to add: (I think your point relates only to the projection system, and not a pure, unprojected model; I just want to make sure I understand because it seems like an important point)


No, with projective geometry or affine geometry you can make translation into a linear operation. But in ordinary Euclidean space translation is not a linear operation.

Most obvious case that it fails is that it doesn't map zero to itself, and you can see the contradiction there:

    T(0 + 0) = T(0) = t
    T(0) + T(0) = t + t = 2 * t

All linear operators map origin to origin. But translation applied to the origin will shift it. So translation cannot be linear.

Let's take another approach.

Take a point p that's sum of vectors a and b, that is

p = a + b.

Now, if translation was a linear transformation, then translating p (say along x-axis by 1 unit) is equivalent to applying same translation to a and b separately and then summing them. But the latter ends up translating by twice the amount. Or in other words

p +t ≠ (a +t) + (b +t) = p + 2t.

So translation is not a linear operators in this vector space.


If anybody is aware of materials that teach linear algebra via graphics as suggested here, I would be interested to hear about them. As someone who learns best through practical application, maths have been by far among my greatest weak points, despite having written software for upwards of a decade. It’s limiting in some scenarios and pure imposter syndrome fuel.


This series by Grant was very useful to review and learn and see the implications. Highly recommended.

codingthematrix.com

>The beautiful reveal is that this addition and composition of linear transformations behave almost the same as addition and multiplication of real numbers.

This is only beautiful if you already understand monoids, magmas and abelian half groups (semigroups) and how they form groups. Also, we do not talk of linear transformations, we talk of group homomorphisms.

I don't know about anyone else, but I was taught linear algebra this way in the first semester and it felt like stumbling in a dark room and then having the lights turned on in the last week as if that was going to be payback for all the toe stubbing.


It can be beautiful with less.

All that needs to be demonstrated is that for real numbers + associates and commutes. That * associates and commutes. And most satisfyingly, these two operations interact through the distribution property.

Of course, it's more revealing and interesting if one has some exposure to groups and fields.

Do people encounter linear algebra in their course work before that ?

For us it came after coordinate/analytical geometry where we had encountered parallelogram law. So while doing LA we had some vague awareness that there's a connection. This connection solidified later.

We also had an alternative curriculum where matrices were taught in 9th grade as a set of rules without any motivation whatsoever. "This is the rule for adding, this one's for multiplication, see you at the test"


Along the happy path yes.

But when things break and you have to understand why, or you have to fix it, or even describe the problem in some detail that someone else is able to guide you to fix it, it sure helps to have an idea of how it works.


So then my only rebuttal here is I think the original claim was overstated.

If I were a pedant I would say it depends on how much of a lifting the word "analysis" is doing there. In any case you already got my point.

In a way Feynman was also the 3b1b of his generation. He was very good at coming up with and communicating with visual metaphors. To the laypeople at the receiving end, these give a strong illusion of understanding.

That's ok if you are not going to compute or design or build anything with it. But they are very inadequate when it is time to shut up and compute.

Feynman (and I am sure) Grant Sanderson could/can operate at a virtuoso level at both the visual imagery and the compute layers. But their popularity with the masses is because of the visual imagery they could conjure up.

On the other hand for those who can already compute for themselves, the metaphors can be a big help for building intuition as long they think in the same style.


HN'er jo-m https://news.ycombinator.com/user?id=jo-m

has a project

https://trains.jo-m.ch/#/trains/list

that deserves a mandatory mention.


These used to be super important in early oceanic navigation. It is easier to maintain a constant bearing throughout the voyage. So that's the plan sailors would try to stick close to. These led to let loxodromic curves or rhumb lines.

https://en.m.wikipedia.org/wiki/Rhumb_line

Mercator maps made it easier to compute what that bearing ought to be.

https://en.m.wikipedia.org/wiki/Mercator_projection

This configuration is a mathematical gift that keeps giving. Look at it side on in a polar projection you get a logarithmic spiral. Look at it side on you get a wave packet. It's mathematics is so interesting that Erdos had to have a go at it [0]

On a meta note, today seems spherical geometry day on HN.

https://news.ycombinator.com/item?id=44956297

https://news.ycombinator.com/item?id=44939456

https://news.ycombinator.com/item?id=44938622

[0] Spiraling the Earth with C. G. J. Jacobi. Paul Erdös

https://pubs.aip.org/aapt/ajp/article-abstract/68/10/888/105...


You inspired me to submit one of my 2022 projects

https://observablehq.com/@jrus/spheredisksample

https://news.ycombinator.com/item?id=44963521

to fit the trend of the day. People may also enjoy

https://observablehq.com/@jrus/sphere-resample


In my early teens I used to try to create something like a equirectangular projection because when drawing it, it looked cool. Obviously I had no idea that it was called this. I was trying to draw reflections of a square window onto a sphere, and then I moved on to trying to cover the sphere in a checkered pattern. This is awesome to see, thank you!

An equirectangular projection just means plotting latitude and longitude in a rectangle.

Do you mean my diagonal grid that I projected back onto the sphere? I'm not sure that has a name.


Great to see you. I look forward for your comments on geometry, multivariate calculus and rotations.

Edit: fantastic graphics. You should submit the other one as an HN post too.


Except the helix curve shown in OP is NOT a loxodrome or rhumb line.

It has equal spacing on the surface between lines, a loxodrome can't have that property since by definition it must cross the meridians at the same angle at all times. That means it always gets denser near the poles.

---

Start with the curve:

x = 10 · cos(π·t/2) · sin(0.02·π·t)

y = 10 · sin(π·t/2) · sin(0.02·π·t)

z = 10 · cos(0.02·π·t)

Convert to spherical coordinates (radius R=10):

λ(t) = π/2 · t (longitude)

φ(t) = π/2 - 0.02·π·t (latitude)

Compute derivative d(λ)/d(φ):

d(λ)/dt = π/2

d(φ)/dt = -0.02·π

d(λ)/d(φ) = (π/2)/(-0.02·π) = -25 (constant)

A true rhumb line must satisfy:

d(λ)/d(φ) = tan(α) · sec(φ)

which depends on latitude φ.

Since φ(t) changes, sec(φ) changes, so no fixed α can satisfy this.

Conclusion: the curve is not a rhumb line.

this is how one should look for varying intersection angles:

https://beta.dwitter.net/d/34223


Indeed. It is one of the many well known spherical spirals / seiffert spirals.

Don't forget this post, which spawned a discussion of Rhumb lines etc. in the comments: https://news.ycombinator.com/item?id=44962767

I had missed this one ! Thanks.

It is indeed raining spherical geometry today.


To quote the storytelling quality of Erdos's abstract:

"The simple requirement that one should move on the surface of a sphere with constant speed while maintaining a constant angular velocity with respect to a fixed diameter, leads to a path whose cylindrical coordinates turn out to be given by the Jacobian elliptic functions."


Jeez Erdos. This man was so prolific he was still publishing 4 years after he died :o

Many after he passed

Indeed.

One way to fix the problem is to sample uniformly not on the latitude x longitude rectangle but the sin (latitude) x longitude rectangle.

The reason this works is because the area of a infinitesimal lat long patch on the sphere is dlong x lat x cosine (lat). Now, if we sample on the long x sin(lat) rectangle, an infinitesimal rectangle also has area dlong x dlat x d/dlat sin(lat) = dlong x dlat cos (lat).

Unfortunately, these simple fixes do not generalize to arbitrary dimensions. For that those that exploit rotational symmetry of L2 norm works best.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: