Live data from Hacker News

Matrix Multiplication

matrixmultiplication.xyz

31–40 of 135 posts

Re: Matrix Multiplication

#31

I like the idea, but my brain is wired differently. Usually, when I do matrix multiplications, the rows on the left side transition to the columns on the right side. In the example, the 1 goes to 2, 2 to 6, 1 to 1. The animation completely confused me, because it looks like being reversed, but the result is the same. Maybe, make this a visualization option?

I do this too and this is way more intuitive in my opinion, as you can easily see which entries of the resulting matrix are linear in which rows and columns. Also, you don't need to transform the matrices in a way that is impossible to do on paper.

Re: Matrix Multiplication

#32
This is sounding increasingly like the Monad situation, where everybody has their own incompatible approach for explaining it, and none of them make any sense.

I feel like I understand Matrices _less_ now than when I started reading around here.

Re: Matrix Multiplication

#33

I like the idea, but my brain is wired differently. Usually, when I do matrix multiplications, the rows on the left side transition to the columns on the right side. In the example, the 1 goes to 2, 2 to 6, 1 to 1. The animation completely confused me, because it looks like being reversed, but the result is the same. Maybe, make this a visualization option?

Me too. This is like seeing someone write legible English starting from the right hand side of the paper.

Not wrong, but discordant with my expectations.

Re: Matrix Multiplication

#35

This is a cool example of what Bret Victor calls an "Explorable Explanation" [0]. That said, I feel that it's more important to understand how and why matrix multiplication corresponds to a composition of linear transformations than learning the actual mechanics of doing the computation. You can get good at matrix multiplication without knowing what is going on. I view that as a less valuable activity than learning a…

For understanding the mechanics of matrix multiplication, I found it useful to think in an analogy consisting of a grid of two layers of pipes; One -- the input-pipes -- coming in one direction, and the other -- the output pipes -- laid in an orthogonal direction. Then there would be "taps" in the cross-sections between the input and output pipes, representing the numbers (multiplication factors, really) in the matrix. I illustrated this in this little drawing: http://imgur.com/gallery/gBs64

The point then is that the taps (again, representing the matrix values) determine how much of each item in the input vector, that should be mixed into each item in the output vector.

This analogy has the limitation that the taps are allowed to enhance the flow, not just limit it, like physical taps would. That is, outputting more than 100% of the input :P Also, while this way of illustrating it may make some sense for matrix * vector multiplication, matrix * matrix would probably become a prohibitively cluttered image.

Re: Matrix Multiplication

#36
post #27

This is a cool example of what Bret Victor calls an "Explorable Explanation" [0]. That said, I feel that it's more important to understand how and why matrix multiplication corresponds to a composition of linear transformations than learning the actual mechanics of doing the computation. You can get good at matrix multiplication without knowing what is going on. I view that as a less valuable activity than learning a…

In particular understanding that conjugation by another matrix is just a coordinate/frame transformation is crucial. Relying to much on explicit coordinates many times obfuscates what's going on.

Is that true for non-square matrices?

Re: Matrix Multiplication

#37
post #23

Earlier quoted context omitted.

Bingo. We did matrices in high school and even through a first linear algebra course in undergrad I got more or less competent at the mechanics of matrix multiplication without ever having any sense of why anyone would want to do this or why these rules, as opposed to some other set of rules that were equally formally valid, were of any interest. I could even tell you what the eigenvectors of a matrix were but had no…

I feel very similar. Do you have any recommendations for resources to learn about why matrix multiplication is defined that way?

"All the mathematics you missed but need to know for graduate school"[1] helped me a lot (and, in fact, I had and did).

Once I had finished that, Cullen's "Matrices and linear transformations"[2] was really helpful too. But I wouldn't do Cullen if you're still, as I was, floundering with the concepts of why you're doing this in the first place. It's great once you have those concepts down.

[1]: https://www.amazon.com/All-Mathematics-You-Missed-Graduate/d...

[2]: http://store.doverpublications.com/0486663280.html

Re: Matrix Multiplication

#38
post #23

Earlier quoted context omitted.

Bingo. We did matrices in high school and even through a first linear algebra course in undergrad I got more or less competent at the mechanics of matrix multiplication without ever having any sense of why anyone would want to do this or why these rules, as opposed to some other set of rules that were equally formally valid, were of any interest. I could even tell you what the eigenvectors of a matrix were but had no…

I feel very similar. Do you have any recommendations for resources to learn about why matrix multiplication is defined that way?

Let's say you have a system with N possible states, evolving in discrete steps. At each step, the system has some probability of switching from any state to any other state. That gives you an NxN matrix of switching probabilities. For example, if the system always stays in the same state as it started, the switching probabilities are an identity matrix (1 on the diagonal and 0 everywhere else).

Now let's see what happens after two steps. If the system started out in state i, what's the probability that after two steps it will end up in state k? Well, it's the sum over all possible paths. In other words, the sum of probabilities of i->j->k for all possible j. In other words, the sum of p_{ij} times p_{jk} for j from 1 to N. But that's exactly the definition of multiplying a matrix by itself.

Now it should be easy to understand that whenever you have matrices that represent transformations of some object, composing transformations will correspond to multiplying matrices.

Re: Matrix Multiplication

#40

As a gamedev who uses matrices all the time, I don't find this animation useful at all for practical work. Instead I think of matrix multiplication as creating a list of ordered operations (scale x translate x rotate etc) which is just encoded efficiently in a table, to then be sent to other parts of the program for use. You can even remove items from the list by multiplying by their inverse.

But of course when you have encoded the scale, rotate and translate into the matrix, it isn't possible to decode it back out to your original values. This is obvious if you consider the fact the following produce identical matrices (just consider 2D for now):

1. Scale in X and Y of -1

2. Z rotation of 180

Post reply on HN