top | item 22416319

An Intuitive Guide to Linear Algebra (2012)

709 points| PNWChris | 6 years ago |betterexplained.com | reply

102 comments

order
[+] id_ris|6 years ago|reply
I recently finished going through MIT OCW's linear algebra class from Gilbert Strang. Without the struggle of doing the assignments, reading the text, and watching the lectures, I don't think I would have ever learned the content. While content like this and that from 3blue1brown are commendable and useful, it simply would not have lodged the ideas into my head.

Now that the ideas of things like vector spaces, norms, orthogonality, rank, basis, etc are nearly second nature, the concepts are useful as I study other branches of math which would feel impenetrable otherwise.

YMMV, and if you can learn from condensed materials go for it, but I might be too dumb for it work lol. I think the real benefit accrues to the author who had to work out how to teach these concepts to others.

[+] robpal|6 years ago|reply
My experience from a decade of doing professional maths is that there are no shortcuts. You only learn maths by doing hundreds (thousands) of exercises, both mundane and more exctiting.

Also, the concepts "mature" in the brain. I remember sleepless nights in the first year of undergrad spent on understanding the details of the proof of the Jordan decomposition and a few years later (when studying algebraic groups) it all felt trivial.

There's no shortcut to understanding maths, just a lot of time spent in solitude trying to make sense of all these abstract concepts (and they DO make sense).

[+] stoddler|6 years ago|reply
You don't learn by putting information into your head, you learn by retrieving information from your head.
[+] bakuninsbart|6 years ago|reply
I agree, and have to admit that my own knowledge of LA is sadly way too superficial. The article did give a me a big lightbulb on something I didn't understand before: Some of my friends work in quantitative sociology and economics, and use Stata for their programming needs. They basically use matrices as their exclusive data structure, and the reason for that eluded me until after reading this article.
[+] dfabulich|6 years ago|reply
> While content like this and that from 3blue1brown are commendable and useful, it simply would not have lodged the ideas into my head.

I'm not sure I understand your point. Are you just saying that this blog post isn't an adequate substitute for taking a course in linear algebra? (Of course it isn't. But who said it was?)

[+] richard78459|6 years ago|reply
3blue1brown himself has told in his videos that they are not substitute for books and working out the exercise and he recommends reading from books and his videos are for inspiration and as a supplement.
[+] qazpot|6 years ago|reply
> I think the real benefit accrues to the author who had to work out how to teach these concepts to others.

In college I learned more math when I was trying to build software for teaching math compared to when I was trying to learn math.

[+] chobytes|6 years ago|reply
Yeah, this sort of stuff is fine supplementary material... but nobody really learns anything from a blog post or some videos.
[+] nearlynameless|6 years ago|reply
While this explanation is certainly much clearer than what I remember of high school maths, I still have a pretty tough time following the formula examples.

When I see A(x) = ax, I'm not entirely sure how to read it.

Is A meant to be a function that accepts x? If so, why is the equivalent expression a * x? Is it supposed to be implied that function A also has some hidden value "a" that is going to be multiplied by the supplied value? Is this notation specific to multiplication, to this expression, or what?

Positing that something is 'intuitive' when it depends so much on additional contextual knowledge seems ever so slightly disingenuous as best, and slightly harmful at worst; it can make the reader feel as though they must be dumb for not understanding this 'intuitive' material.

I do acknowledge that this is linear algebra, and if one doesn't have a really solid grasp of notation of regular algebra it is likely to go over their heads, but the practical explanations (such as the slope rise/run example) are quite clear and relatively simple to follow; it follows that a simple explanation of the notation might be helpful too.

[+] kdtop|6 years ago|reply
I agree that this was a bit confusing. Higher up in the article, it shows that a linear function is one that doesn't change when scaled:

F(a * x) = a * F(x)

This is showing the relationship between two uses of the same function.

Then, further along, we find:

"So, what types of functions are actually linear? Plain-old scaling by a constant, or functions that look like: F(x)=ax In our roof example, a=1/3"

I think in this second situation, F(x)=ax is not a relationship but rather a DEFINITION of the function F(x).

In programming terms:

function F(x: real) : real;

begin

  Result := x * (1/3);
end;
[+] rustybolt|6 years ago|reply
The particular example might be confusing because the same letter is used twice with different capitalization. There is no direct relation between them.

> Is A meant to be a function that accepts x?

Yes.

> If so, why is the equivalent expression a * x?

Because that how A(x) is defined.

>Is it supposed to be implied that function A also has some hidden value "a" that is going to be multiplied by the supplied value?

Yes, it's an unspecified constant (a, b, c... are used to denote constants by convention), so you can really calculate A(x) for supplied values of x yet until the constant 'a' is specified.

> Is this notation specific to multiplication, to this expression, or what?

No. Functions might be defined using any expression. For example

    A(x) = b^x
is a valid function as well (again, we have an unspecified constant). Just don't expect to encounter it in an introductory course in linear algebra (since it would deal mostly with linear functions).
[+] vecter|6 years ago|reply
This is ok but nothing is as intuitive as 3B1B's series on YouTube that has been posted hundreds of times on HN [0].

Linear algebra is really about linear transformations of vector spaces, which is not captured in this blog post.

[0] https://www.youtube.com/watch?v=fNk_zzaMoSs

[+] nightcracker|6 years ago|reply
> Linear algebra is really about linear transformations of vector spaces, which is not captured in this blog post.

I... disagree. Some of linear algebra is about that. And it's probably a good way to view it that way when learning.

But some of my current work (coding theory) involves linear algebra over finite fields. We use results from linear algebra, and interpret our problem using matrices, but really at no point are we viewing what we're doing as transforming a vector space, we're just solving equations with unknowns.

[+] OrwellianChild|6 years ago|reply
3B1B does great work explaining these concepts, but I can't help but ask "why not both?" when it comes to explaining these concepts. Turns out, linear algebra is great for working with matrices, vector space, approximating non-linear systems, and more... Let's embrace multiple ways of teaching it and gaining intuitions rather than keeping score, eh?
[+] gitgudnubs|6 years ago|reply
Then you failed to comprehend the subject. The point is that a wide array of problems and models are really the same thing.
[+] adamcharnock|6 years ago|reply
I... I still really struggle with this. I'm a smart person, I've got a bachelors of engineering, I've been a professional software developer for around 14 years now, and I've built a house. But there is something about degree-level maths and beyond that I find deeply unintuitive in a way that software development isn't.

Through comments here I found 3blue1brown's (clearly much loved) videos. By the third video I was shouting, "why for the love of god would we be doing this"? Based on this reaction I suspect that the content neither has intrinsic appeal to me, nor does it have obvious use in my work, projects, or life.

Pre-degree maths though, I love. My A-level maths really changed how I saw the world, and I make use of it reasonably often (well, often enough to not forget it).

I think I'm writing this here because most other commenters seem to really grasp this subject, or feel that they grasp it better having seen these videos. I'm honestly happy for you. However, if anyone is reading this who doesn't feel like that, then know you're not alone :-)

[+] jackthetab|6 years ago|reply
> But there is something about degree-level maths and beyond that I find deeply unintuitive in a way that software development isn't.

Grok.

Over the years, I come to the conclusion that one of the stumbling blocks is the definition/concept of "application". Just like the definition of "theory" is different for a layman ("My theory is..." == "My guess is...") than from a scientist's definition ("My theory is" == "My logical framework which incorporates all of the available data is..."), so the definition of "application" is different between mathematicians and engineers.

I've noticed that math books with titles like "$HIGHER_ORDER_MATH with Applications" means "$HIGHER_ORDER_MATH with Exercises". What I'm looking for is something like "$HIGHER_ORDER_MATH with Real-World Uses".

I've known LA for decades but, like you, where would I use it in my life? The turning point for me was Andrew Ng's Deep Neural Network course.

I knew that a DNN is a program of matrix operations, but how do you get 5,000 images into a matrix? One way is to resize all the images to the same n x n size, take the first pixel of each picture and break them into their RGB components. You now have the first three rows of your input matrix. Repeat for all other pixels and voila! You have a 5,000 x n matrix that you can do linear algebra on! _That's_ an application; having me add two matrices together is an exercise.

Since that insight, I've used LA in my job in the hospitably sector with impressive success because now I know how to apply it. Math books and 3B1B show you the math. We engineers (or at least this one) need real world uses.

[+] hintymad|6 years ago|reply
This is typical for many people. You love pre-college math because you have intuitive understanding, while college-level maths offer a new level of abstraction that you may not feel familiar with from the get-go.

It's perfectly okay not to learn linear algebra, by the way, especially when you don't find any incentive to do so. Otherwise, you'll find linear algebra to be one of the most intuitive tools to model so many problems.

If you do want to learn linear algebra or any other higher math, I'd strongly recommend you focus on understanding concepts intuitively first, to the point that you find many exercises in a text book straight forward. Watching 3blue1brown is a good start, but do move forward with deeper treatment. The book I find very usual is David Lay's Linear Algebra and Its Applications: https://www.amazon.com/Linear-Algebra-Its-Applications-5th/d.... Lay sets up a really intuitive geometric framework to explain the intuition of linear transformation with sufficient rigor.

[+] obastani|6 years ago|reply
Part of the challenge with linear algebra is that a lot of the basics are somewhat dry, since they serve mostly as a way to organize computation -- e.g., a system of linear equations can be expressed as Ax <= b, where A is a matrix, b is a vector, and x is a vector of variables.

Much of what makes linear algebra interesting and powerful comes from more advanced topics, especially eigenvalues. This power comes when we are not looking at a single matrix in isolation, but when we repeatedly apply a matrix. For instance, consider the equation x_t = A^t x_0. It turns out we can rewrite this an equation by diagonalizing A -- i.e., A = P^{-1} Sigma P, where Sigma is diagonal; most, but not all, matrices can be written in this form. We call s_i the "eigenvalues" of A.

Then, the equation simplifies to x_t = P^{-1} Sigma^t P x_0, or equivalently (P x_t) = Sigma^t (P x_0). This equation is dramatically simpler, since Sigma is diagonal, so if Sigma = diag(s_1, ..., s_n), then Sigma^t = diag(s_1^t, ..., s_n^t). In other words, this transformation "disentangles" the different components of A into ones that act independently. Here, the transformation x -> P x is what is called a "change of basis".

These repeated matrix applications are common in physics, where they represent how a dynamical system evolves over time. The main difference is that in physics, the system evolves continuously, but similar transformations can be applied to solve these problems.

[+] dragontamer|6 years ago|reply
The problem with Linear Algebra specifically, is that it can be viewed from many different perspectives.

The article here focuses on an "operational" perspective, how the numbers get added or multiplied together to turn into other numbers. However, Linear Algebra is also useful in geometry, and other situations.

This "intuitive guide" to linear algebra sets you up very nicely for figuring out how to add and multiply matricies together. But it doesn't give you any intuition about a rotation (aka quaternions) in 3d space, for example. A lot of math books make the mistake of trying to teach all the perspectives at the same time, instead of focusing on just one viewpoint until the student gains mastery.

A Quaternion is "just" a 4x4 matrix that represents rotation in 3-dimension space. Because you only move 3-ways rotationally (yaw, pitch, and roll), you're "underconstrained" with regards to the 4x4 matrix. Etc. etc. A lot of geometry intuition needs to be built here to really understand Quaternion... and none of that geometry is explored in the blogpost.

Which is fine. Focus is good. But when people approach Linear Algebra, its important to know that its "so useful" that there are too many ways of looking at Linear Algebra... too many different, yet equivalent, understandings of the subject.

[+] woah|6 years ago|reply
I used to think this, my problem was that I wasn’t doing the exercises, instead just reading articles and watching videos and trying to get some kind of theoretical understanding. Everything makes a lot more sense once you’ve slogged through a bunch of repeated exercises.
[+] gfxgirl|6 years ago|reply
100% Agreed. I've written 3D engines in shipping games and yet I can't do math for shit. I've tried watching 3blue1brown and they have pretty pictures but they don't help at me all. I feel like they're mostly appreciated by people who already understand and can't remember what it's like to not understand.

I was recently watching videos and trying to read papers on geometric algebra and getting totally and utterly lost on actually applying it.

[+] greentimer|6 years ago|reply
Higher math involves a very different way of thinking from the typical, useful things people do for a living. Exactness is important. The abstractions can run very deep. It's easy to get lost in the pure side of things without really understanding how to apply it.
[+] trevor-e|6 years ago|reply
Personally I really struggle with the syntax and notation of upper-level math courses, I need a big cheat sheet of all the terms. It's like programming where we use i, j, k for loop variables instead of something more descriptive. My brain has to do one extra layer of translation between what's written and the concept being taught and then I lose focus, but intuitively I've always been fine with math concepts. When I took linear algebra in college (and did terrible) I particularly struggled with all the syntax that was introduced. Would love some tips if anyone else has a similar problem.
[+] MrK93|6 years ago|reply
I'm currently working on a linear algebra heavy linear programming model for an optimization thesis and the general trick is, as with writing code, to improve iteration by iteration of the model. Starting with a complex mathematical model is always a bad idea, so start small and iteratively improve it. This means no use of advanced concepts unless needed. Also, nobody uses every bit of math in the everyday work. As with programming, you just need to understand the general concepts and the rest can be figured out step by step.
[+] amelius|6 years ago|reply
Try Gilbert Strang's course at MIT, it's publicly available in video format, and starts from basic principles.
[+] skybrian|6 years ago|reply
I think the point where it gets confusing is where they stop showing you how to do calculations. With programming, you are always calculating something, even if you abstracted away from it.

Geometric algebra seems more practical than most subjects but even its introductions suffer from this.

[+] photon_lines|6 years ago|reply
That's because the way that math is taught and presented makes it extremely hard to grasp and relate to, and this makes it hard for others to find the topics within it interesting. Mathematics, in it's very essence, is incredibly beautiful. The universe - yes, everything in it and everything that composes you, is in fact a form of mathematics! What does this mean?

Well, it means that understanding it means that you understand yourself! Well, not just that, but it might eventually lead to you understanding the architecture of the universe! After that? How about God? Or is God maybe a part of the architecture?

OK, so maybe I won’t try to go into the details there since opinions on it differ. Essentially, through this language though, you can master almost anything that you want! Yes, it might seem crazy, but the things that happen around you and the things which every poet and playwright and prisoner and savior ever composed can be explained through mathematics! Through it, you can also open up entirely new and utterly interesting worlds!

Let’s say that you dropped your pen this morning. To someone with no background in physics, or mathematics, this means nothing. On the other hand, to someone like me, it means quite a bit. The slight delay and movement altered the gravitational and electromagnetic field around you and echoed on into eternity. Also, it most likely changed your days structure and composition, and shifted your life into a new line (see quantum mechanics and chaos and linear dynamics) and had a profoundly large impact on everything else around you. You may have avoided a car crash, or you might have met a person who you wouldn’t have normally encountered all because of that small change. And this small change echoed on and effected everything else in turn. And this is all very mathematical, and extremely beautiful, but most people don’t know anything about it, but it does mean something to people like me: we’re all incredibly inter-connected, and our lives are ruled by chaos. Everything that you do, and everything that you say, and all the things you see and inter-related and ohh so close, but we tend not to see it and it all has to do with not understanding the fundamental mathematics!

The above is only touching on one small aspect of it though, as it only deals with physics and chaos. There are entire branches of math which make the world incredibly interesting which have nothing to do with the fields I just mentioned! Hey, did you know that standing next to someone who might look slightly like your wife will cause you to behave in a similar manner in which you behave when she’s actually around you? Yes, neurons that fire together wire together, and it’s very mathematical underneath but yet so simple! How about the fact that E = mc squared isn’t really true? Yes, the formula has an extra term (square root of 1 minus v squared over c squared) which makes it possible for massless particles to have energy and deals with relativistic effects. Did you know that you can summarize most of modern classical physics in just a few equations? (Yup, you can find most of them here: https://www.feynmanlectures.caltech.edu/II_18.html ). How about balance? Did you know that if you were standing at arm’s length from someone and each of you had one percent more electrons than protons, the repelling force would be so incredible that the repulsion would be enough to lift a “weight” of the planet! Yup – math is full of fun surprises!

Now, modern math is sort of like a constant tease which shows you the shell of this beautiful program and this excitement, and you know the beauty is there, but it’s not easy to understand and grasp! For one, most of mathematics is filled with jargon and language that is incredibly information dense, and it looks like it’s been written by a schizophrenic C programmer who’s paranoid about losing his job, so the information tends to be lumped into these incredibly dense formulas which hide the beauty and truth, but the beauty and truth will always be there! You just need to have a bit of persistence and dedication. It also doesn’t help that most teachers tend to not make things nice. They puke out the same old standardized stuff regurgitated and taught to them, and so round and round it goes.

Hopefully though, we’ll get better at teaching it and conveying it’s structure as we learn better ways of not making things cumbersome and uninteresting to other people! Wow, I need to stop writing – sorry for the large wall of text, but I hope you get what I mean!

[+] diffeomorphism|6 years ago|reply
This seems to be "what are matrices and how do you work with them" and not linear algebra. I mean that can be useful sometimes but seems more like something you would teach in a numerics course instead.

Actually, I think this way of explaining and motivating things (linear map==matrix) will get really, really confusing once you try to understand changes of bases or eigenvalue decomposition. A linear map is something that takes vectors and spits out vectors while preserving the vector structure (i.e. addition and scalar multiplication on the input give you addition and scalar multiplication of the output).

[+] formalsystem|6 years ago|reply
Viewing Linear Algebra as the study of linear operators instead of matrices makes everything so much simpler.

Of course AB != BA

Composition makes sense

Inverse makes sense

This is the book that helped me get it http://linear.axler.net/

[+] swiley|6 years ago|reply
I really like "matrices are the coordinate form of linear transforms." In the LA class I took the professor made a pretty big deal out of that, first by defining "lexicographic matrix basis" so he could write out matrices as vectors and then talking about mapping between the three different ideas.

There's still stuff he said that I'm unpacking today... that was a dense class.

[+] zelly|6 years ago|reply
This is a great book. I also recommend Halmos "Finite Dimensional Vector Spaces". The typical way linear algebra is introduced does not present a matrix as a linear transformation first and foremost.
[+] andrepd|6 years ago|reply
Goes to show how different people have different tastes. I find this type of exposition very confusing and very unenlightening. Give me a Landau-style "minimalistic"/"focused" explanation any day. Not to mention, it tries so hard to simplify things to a simple analogy (the spreadsheet thing) that it ends up being plain misleading. In other words: "Make things as simple as then can be, but no simpler."
[+] sushisource|6 years ago|reply
I love explainers like this, but it frankly makes me a little angry that the vast majority of the math teachers I had in highschool and college taught in the awful way described in the setup to the piece.

Why is that? Has anyone studied it, or is there even a solid anecdotal explanation? The best one I can imagine is many of these professors simply don't care much for teaching and are more focused on their research, which is still infuriating but at least an explanation.

I ended up with an undergrad in applied math, though I'm a software engineer now. I like math, but I feel like I never got to be all that great at it. I suspect I would've enjoyed it more and achieved more with explanations like these.

[+] RickS|6 years ago|reply
Already this is so helpful, as someone with only a partial high school math background. The visual "pouring" analogy alone made it worth the read.
[+] the_watcher|6 years ago|reply
I remember taking Advanced Algebra Honors in 10th grade. It was basically Algebra II with a few (seemingly teacher-selected based on the experience of students who had a different teacher) advanced topics thrown in. One of them was matrices, and I was completely stumped by them. I now encounter them all the time, and wish I'd been able to wrap my head around them when I was younger.
[+] bobblywobbles|6 years ago|reply
Thank you for writing this up, or reposting.

I agree that it is better to understand math, and computer science, intuitively first. Learning the basics instead of learning how to think in them forces memorization and is frankly in a time gone by.

If only I could've been taught this way when I was younger, then I'd actually be any good at any advanced math.

[+] ukj|6 years ago|reply
The only way to test if you've 'understood' something is to apply it to real-world problems.

If it works - then you understood it. If it doesn't - then you didn't.

"Understanding" without way of external verification seems no different to dopamine-chasing.

Measuring on output and all that...

[+] matteuan|6 years ago|reply
The only way to test is if you talk with an expert and he says you have understood. There are many things in linear algebra that you can use in practice even when you didn't really understand them. This is the reason why self-studying certain topics is very hard, you still need (good) teachers to give you constant feedback.
[+] PNWChris|6 years ago|reply
OP Here:

I just wanted to give some context to how I found this page, and why I thought it would be good to post.

I may be putting myself on the spot here: I never took a linear algebra course in undergrad. It was a heavily encouraged option, of course, but I felt I understood the basic rules enough to not really need formal study. I opted to study other areas, partially motivated by a fear I wouldn't do well and would hurt my GPA (my god was I vain, I feel I could do so much more studying full-time with my current world-view).

As time has gone on, and ML and quantum computing have simply blown up since I graduated in 2014, I quickly realized the magnitude of my mistake. I have frantically self-studied for years to try to make up the gaps in my mathematical understanding, and linear algebra has come up time and time again. I can do the processes, but they never clicked, I had no intuition.

I want to help others in my position cut to the chase, and study the highest yield, most intuition giving resources.

I actually developed the mental model shared in this guide on my own, and was positively delighted to find to this while thinking over a comment I was drafting on here. This page lays things out so clearly. The component steps are intuitive and I can commit them to memory/recall what they mean without needing to dig up my notes to self!

===

I find this page gives an excellent foundation, and goes great with these resources:

* A web site which clearly shows how to do matrix multiplication in a way that's easy to recall, it makes the procedure like riding a bike:

http://matrixmultiplication.xyz/

Huge thanks to Jeremy Howard of fast.ai for mentioning this in one of his lectures, this tool is how I finally got matrix multiplication to click

* A paper named "An Introduction to Quantum Computing" (bear with me, it's superbly well written and very approachable):

https://arxiv.org/abs/0708.0261

Page 3 of that paper lays out matrix multiplication (e.g.: applying a "transformation matrix" in the spatial parlance of 3blue1brown's videos) as a traversal of a directed graph. A very useful understanding, and shows how generalizable the tools of linear algebra really are in my opinion.

* The essence of linear algebra, by 3blue1brown (fantastic for a geometric/"transformation of space" view of linear alg):

https://www.youtube.com/playlist?list=PLZHQObOWTQDPD3MizzM2x...

[+] bgroat|6 years ago|reply
I love betterexplained.

Does this guy have a patreon?

[+] rayalez|6 years ago|reply
Are there resources like this for Calculus/Prob/Stats?