If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

Main content

Intro to matrices

Take the red pill and enter the Matrix! Created by Sal Khan.

Want to join the conversation?

Video transcript

What I want to do in this video is explore the notion of a matrix outside of the context of a surprisingly good movie that involves Keanu Reeves. And it's actually the first of three. I guess we could call the three movies combined The Matrices. And there is a relationship between the movie, which is about a virtual reality constructed by super-smart computers, and the notion of what a matrix is when you study it in mathematics, or when you study it in computer science. And the connection really is that matrices are used a lot when you are simulating things or when you're constructing things in computer science, especially in, frankly, computer graphics. So the super-intelligent robots that made the matrix in the movie Matrix were probably using matrices in order to do it, if they actually did exist. Now, what is a matrix then? Well, that's a fairly simple answer. It's just a rectangular array of numbers. So for example, this right over here. If I have 1, 0, negative 7, pi, 5, and-- I don't know-- 11, this is a matrix. This is a matrix where 1, 0, negative 7, pi-- each of those are an entry in the matrix. This matrix right over here has two rows. And it has three columns. And because it has two rows and three columns, people will often say that this is a 2 by 3 matrix. Whenever they say it's something by something matrix, they're telling you that it has two rows-- so you see the two rows right over there. And they are telling you that it has three columns. You see the three columns right over there. I could give you other examples of a matrix. So I could have a 1 by 1 matrix. So I could have the matrix 1. This right over here is a 1 by 1 matrix. It has one row, one column. I could have a matrix like this-- 3, 7, and 17. What is this? Well, this has one row. This is the one row that we see here. And it has three columns. This is a 1 by 3 matrix. I could have a matrix-- and I think you see where all of this is going. Figuring out the dimensions of a matrix are not too difficult. I could have a matrix that looks like this, where it's 3, 5, 0, 0, negative 1, negative 7. This right over here has three rows. So it's three rows, and it has two columns. So we would call this a 3 by 2. Let me do that in that same color. We would call it a 3 by 2 matrix, three rows and two columns. So fair enough. You know that a matrix is just a rectangular array of numbers. You can say what its dimensions are. You know that each of these numbers that take one of these positions-- we just call those entries. But what are matrices good for? I still might not be clear what the connection is between this and this right over here. And at the most fundamental level, this is just a compact representation of a bunch of numbers. It's a way of representing information. They become very valuable in computer graphics because these numbers could represent the color intensity at a certain point. They could represent whether an object is there at a certain point. And as we develop an algebra around matrices, and when we talk about developing an algebra around matrices, we're going to talk about operations that we're going to perform on matrices that we would normally perform with numbers. So we're going to essentially define how to multiply matrices, how to add matrices. We'll learn about taking an inverse of a matrix. And by coming up with an algebra of how we manipulate these things, it'll become very useful in the future when you're trying to write a computer graphics program or you're trying to do an economic simulation or a probability simulation, to say, oh, I have this matrix that represents where different particles are in space. Or I have this matrix that represents the state of some type of a game. And I know the algebra of matrices. And I know ways of doing it very efficiently so that I can multiply a bunch of them. Or I could come run a simulation, and I can actually come up with useful results. So that's all matrices are. But as you'll see through this, we can define operations on them. And then later on, when you take a linear algebra course in college, you'll learn a lot more of the depth of how they can be applied and what you can use them to represent.