Preparing video…

Coding the Matrix: Linear Algebra through Computer Science Applications

Learn the concepts and methods of linear algebra, and how to use them to think about computational problems arising in computer science. Coursework includes building on the concepts to write small programs and run them on real data.


Course at a Glance

About the Course

When you take a digital photo with your phone or transform the image in Photoshop, when you play a video game or watch a movie with digital effects, when you do a web search or make a phone call, you are using technologies that build upon linear algebra.  Linear algebra provides concepts that are crucial to many areas of computer science, including graphics, image processing, cryptography, machine learning, computer vision, optimization, graph algorithms, quantum computation, computational biology, information retrieval and web search. Linear algebra in turn is built on two basic elements, the matrix and the vector.  

In this class, you will learn the concepts and methods of  linear algebra, and how to use them to think about problems arising in computer science.  You will write small programs in the programming language Python to  implement basic matrix and vector functionality and algorithms, and use these to process real-world data to achieve such tasks as: two-dimensional graphics transformations, face morphing, face detection, image transformations such as blurring and edge detection, image perspective removal, classification of tumors as malignant or  benign, integer factorization, error-correcting codes, and secret-sharing.

Course Syllabus

  • The Function
  • The Field
  • The Vector
  • The Vector Space
  • The Matrix
  • The Basis
  • Dimension
  • Gaussian Elimination
  • The Inner Product
  • Orthogonalization

Recommended Background

You should be an experienced programmer.  We use a subset of Python in this course, and we start by covering the relevant features and syntax, so many students find they can get by without prior knowledge of Python.

You are not expected to have any background in linear algebra.  However, you should be prepared to read and understand some mathematical proofs. At Brown University, a similar course is taken mostly by sophomore computer science  majors who have taken at least two semesters of programming and one semester addressing proof techniques.

Suggested Readings

Coding the Matrix is an optional companion textbook.  It covers the material addressed by this course, plus additional examples and more advanced topics not covered by the course (wavelets, discrete Fourier transforms, singular value decomposition, eigenvalues, and linear programming).  The textbook is not at all necessary for taking the course; all necessary material is covered in lecture.  


  • Will I get a statement of accomplishment after completing this class?

    Yes. Students who successfully complete the class will receive a statement of accomplishment signed by the instructor.

  • What resources will I need for this class?

    You will need a computer with Python installed (version 3.x). We will provide additional Python modules for you to download.

  • What is the coolest thing I'll learn if I take this class?

    Here are some cool things: removing the perspective from an image,  a simple machine-learning algorithm applied to cancer data.