HN Books @HNBooksMonth

The best books of Hacker News.

Hacker News Comments on
Coding the Matrix: Linear Algebra through Applications to Computer Science

Philip N. Klein · 10 HN comments
HN Books has aggregated all Hacker News stories and comments that mention "Coding the Matrix: Linear Algebra through Applications to Computer Science" by Philip N. Klein.
View on Amazon [↗]
HN Books may receive an affiliate commission when you make purchases on sites after clicking through links on this page.
Amazon Summary
An engaging introduction to vectors and matrices and the algorithms that operate on them, intended for the student who knows how to program. Mathematical concepts and computational problems are motivated by applications in computer science. The reader learns by doing, writing programs to implement the mathematical concepts and using them to carry out tasks and explore the applications. Examples include: error-correcting codes, transformations in graphics, face detection, encryption and secret-sharing, integer factoring, removing perspective from an image, PageRank (Google's ranking algorithm), and cancer detection from cell features. A companion web site, provides data and support code. Most of the assignments can be auto-graded online. Over two hundred illustrations, including a selection of relevant xkcd comics. Chapters: The Function, The Field, The Vector, The Vector Space, The Matrix, The Basis, Dimension, Gaussian Elimination, The Inner Product, Special Bases, The Singular Value Decomposition, The Eigenvector, The Linear Program
HN Books Rankings

Hacker News Stories and Comments

All the comments and stories posted to Hacker News that reference this book.
Depending on your background and intentions, you might like:




I think the pacing and exercises in the above Strang book are great.

I'll second Strang. I recently re-read his Introduction to Linear Algebra and was struck with how clearly he explains things compared to most other math textbooks (which I've been reading a lot of lately).
There used to be a Coursera course called Coding the Matrix. It covered many linear algebra topics using Python. The course isn't available anymore on Coursera anymore, but you can still buy the textbook:

All of the course's video lectures are still available at:



If you want to learn linear algebra by coding in python, this is hands down the best book out there.

Coding the Matrix - Philip Klein [0]

It used to have a Coursera course, but I think it's been taken down. The website has videos of the course taught at Brown I think.

The associated website is:


The course is available here:

It is legal, not a pirated version.

That was a great course! I'm glad it's still accessible. I was not aware of this resource for courses. There was a fantastic course on probability from the University of Pennsylvania that disappeared when Coursera went through a change a few years ago. Maybe I can find that one there too. Thanks for the link.
Did you find the Upenn course on probability? I have been looking for it for a long time. The professor was absolutely brilliant.
If you haven't already studied Linear Algebra, and want to get a headstart on that, check out the "Coding The Matrix" book/videos from Brown.

Also, see the Gilbert Strang video series on Linear Algebra:

and the amazing 3blue1brown "Essence of Linear Algebra" series:

Coding the Matrix: Linear Algebra through Applications to Computer Science [0]

A hands on introduction to both Python and Linear Algebra using real world cases (ex. you are given a high res image, make a low res version to put on your website so that it could load more quickly).


The texts that I hate least (LA and I have a long and rocky relationship):

- Coding the Matrix, Klein This has a strong emphasis on LA's utility in CS, and includes concepts outside traditional LA that enrich the narrative.

- Intro to Linear Algebra, Strang Strang approaches LA from a practical less-theoretical angle, which makes it very sensible if you're an engineer but may not be as suitable if you're a mathematician.

- Linear Algebra, A Modern Intro, Poole This is a solid text that has worked out most of its bugs over the editions.

- Linear Algebra and its Applications, Lay Like Poole, this is also a solid and long running text.

The books by Klein and Strang also benefit from free videos of those courses that are available from Coursera/BrownU and MIT OCW. Klein's is also available on the Kindle.

Thanks for taking the time to write that out. I'll check them out.
Starts on Page 2 at the bottom and moves up. Half of this course was taught on Coursera in 2013.

Book on Amazon, Kindle version $3:

While I did take courses in probability, linear algebra, and lots of calculus, until recently, I forgot most of the probability and all of the linear algebra I learned in school. As for calculus, I only remembered how to take basic derivatives. In any case, I've been spending the past month brushing up on my linear algebra and probability, and it's been a struggle, but now that I'm motivated and under no time pressure to relearn the material, I find it way more fascinating than I did in college. In fact, I skipped tons of my linear algebra classes because I thought the subject was dry and dull. I also rushed through my probability and stats homework just so I could get a good grade on them. I think if you're motivated, and you can do basic math, you should be able to educate yourself in calculus, probability, and linear algebra. It'll be a struggle, but with motivation, you'll be able to pick up the concepts.

for probability and stats:

for linear algebra:

this was my college calculus textbook: I can't comment if it was good or not because by college, I had taken calculus twice so it was all a refresher

best of luck! You sound educated enough (yes, I'm judging from the couple sentences you wrote) that I think you won't have any problems acquiring math knowledge with persistence.

My favorite LA books are Linear Algebra by Friedberg/Insel[0] which is a combination of Axler style book with more computation oriented one (Terry Tao has a set of lectures based off this book). Another one I like is Modern Intro To LA by Henry Ricardo[1] which implicitly introduced me to Replacement theorem which is really overlooked in a ton of LA books. Again, this book's a rigorous mixture of both theory and computation done very well. If you've never seen higher level math before, there's Linear Algebra: Gateway to Mathematics by Robert Messer[2]. It has tons of commentary about elementary set theory and proof techniques along the way. Whenever someone mentions Axler's book, someone else brings up Treil's book. But there's a third one in the same league/group which is Linear Algebra: An Introduction to Abstract Mathematics by Robert Valenza[3]. Other favorites are Coding the Matrix by Philip Klein[4] for Python aficionados and Linear Algebra Through Geometry by Banchoff/Wermer[5] for those who like geometry.

If you are way beyond all this, you can still pick up new things from Advanced Linear Algebra by Steven Roman[6].








+1 for counting from zero
Seconding Klein's Coding the Matrix. It's a great alternative introduction and actually implementing linear algebra ideas in Python is both useful and a great aid for learning.

The auto-grader is helpful for making sure you got the right solutions.

HN Books is an independent project and is not operated by Y Combinator or
~ [email protected]
;laksdfhjdhksalkfj more things ~ Privacy Policy ~
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.