 The next step in mathematics for data science foundations is to look at linear algebra or an extension of elementary algebra. And depending on your background, you may know this by another name and I like to think welcome to the matrix because it's also known as matrix algebra because we're dealing with matrices. Now let's go back to an example I gave in the last video about salary or salary is equal to a constant plus years plus bargaining plus hours plus error. Okay, that's a way to write it out in words. And if you want to put it in symbolic form, it's going to look like this. Now, before we get started with matrix algebra, we need to talk about a few new words. Maybe you're familiar with them already. The first is scalar. And this means a single number. And then a vector is a single row or a single column of numbers that can be treated as like a collection, that usually means a variable. And then finally, a matrix consists of many rows and columns, sort of a big rectangle of numbers. The plural of that by the way is matrices. And the thing to remember is that machines love matrices. Now let's take a look at a very simple example of this. Here is a very basic representation of matrix algebra or linear algebra, where we're showing data on two people on four variables. So over here on the left, we have the outcomes for cases one and two are people one and two, and you put them in the square brackets to indicate that it's a vector or matrix. Here on the far left, it's a vector because it's a single column of values. Next to that is a matrix that has here on the top the scores for case one, which I've written as x is x one is for variable one x two is for variable two. And the second subscript is indicated as for person one. Below that are the scores for case two the second person. And then over here in another vertical column are the regression coefficients. That's a beta there that we're using. And then finally, we've got a tiny little vector here at the end, which contains the error terms for cases one and two. Now, even though you would not do this by hand is kind of helpful to run through the procedure. So I'm going to show it to you by hand. And we're going to take two fictional people. This will be fictional person number one, we'll call her Sophie, we'll say that she's 28 years old, and we'll say that she has good bargaining skills of four on a scale of five, and that she works 50 hours a week, and that her salary is 118,000. Our second fictional person will call him Lars, and we'll say that he's 34 years old, and he has moderate bargaining skills three out of five, works 35 hours per week and has a salary of $84,000. And so if we're trying to look at salaries, we can go back to our matrix representation that we had here with our variables indicated with their Latin and sometimes Greek symbols. And we're going to replace those variables with actual numbers. So we can get the salary for Sophie, our first person. So let me plug in the numbers here. And let's start with the result here. Sophie salary is 118,000. And here's how these numbers all add up to get that. The first thing here is the intercept, and we just multiply that times one. So that's sort of the starting point. And then we get this number 10, which actually has to do with years over 18, she's 28. So that's 10 years over 18, we multiply each year by 1395. Next is bargaining skills, she's got a four out of five. And for each step up, you get $5,900. By the way, these are real coefficients from study of survey of salary of data scientists. And then finally hours per week. For each hour, you get $382. Now we can add those up and we can get a predicted value for her. But it's a little low, it's 30,000 low, which you may say, well, that's really messed up. Well, that's because there's like 40 variables in the equation, including she might be the owner. And if she's the owner, yeah, she's gonna make a lot more. And then we do a similar thing for the second case. But what's neat about matrix algebra or linear algebra is that you can use matrix notation. And this means the same stuff. And what we have here are these bolded variables that stand in for entire vectors or matrices. So for instance, this y a bold y stands for the vector of outcome scores. This bolded x is the entire matrix of values that each person has on each variable. This bolded beta is all of the regression coefficients. And then this bolded epsilon is the entire vector of error terms. And so it's really super compact way of representing the entire collection of data and coefficients that you use in predicting values. So in some, let's say this, first off, computers use matrices, they like to do linear algebra to solve problems. And it's conceptually simpler, because you can put it all there in this tight formation. In fact, it's a very compact notation, and allows you to manipulate entire collections of numbers pretty easily. And that's the major benefit of learning a little bit about linear or matrix algebra.