 Our next step in mathematics for data science foundations is systems of linear equations. And maybe you're familiar with this, but maybe you're not. And the idea here is there are times when you actually have many unknowns, and you're trying to solve for all of them simultaneously. And what makes this really tricky is a lot of these are interlocked. Specifically that means x depends on why but at the same time y depends on x. What's funny about this is it's actually pretty easy to solve these by hand. And you can also use linear matrix algebra to do it. So let's take a little example here of sales. Let's imagine that you've got a company and you've sold 1000 iPhone cases so they're not running around naked like in this picture. And that some of the cases sold for $20 and other sold for $5. You made a total of $5,900. And so the question is how many were sold at each price. Now hopefully you were keeping your records. But you can also calculate it from this little bit of information. And to show you I'm going to do it by hand. Now we're going to start with this. We know that sales, the two price points x and y add up to 1000 total cases sold. And for revenue, we know that if you multiply a certain number times $20 and another number times $5 that it all adds up to $5,900. Between the two of those we can figure out the rest. Let's start with sales. Now what I'm going to do is I'm going to try to isolate the values. And I'm going to do that by putting in this minus y on both sides. And then I can take that and I can subtract it. So I'm left with x is equal to 1000 minus y normally solve for y but I solve for x you'll see why in just a second. Then we go to revenue. And we know from earlier that our sales of these two price points add up to $5,900 total. Well, what we're going to do is we're going to take this x that's right here and we're going to replace it with the equation we just got, which is 1000 minus y. Then we multiply that through and we get 20,000 minus 20 y plus 5 y equals 5900. Well, we can subtract these two because they're on the same thing. So 20 y and we get 15 y and then we subtract 20,000 from both sides. So there it is right there on the left. And that disappears and then I get it over on the right side. And I do the math there and I get minus $14,100. Well, then I divide both sides by negative $15. And when we do that we get y is equal to 940. Okay, so that's one of our values for sales. So let's go back to sales we have x plus y equals 1000. We take the value that we just got 940 we stick that into the equation. And then we can solve for x just subtract 940 from each side. There we go, we get x is equal to 60. So let's put it all together just to recap what happened. What this tells us is that 60 cases were sold at $20 each. And that 940 cases were sold at $5 each. Now, what's interesting about this is you can also do this graphically, we're going to draw it. So I'm going to graph the two equations. Here are the original ones we had this one predict sales this one gives price. The problem is these really aren't in the canonical form for creating grass that needs to be y equals something else. So we're going to solve both of these for y. We subtract x from both sides there it is on the left we subtract that and then we have y is equal to minus x plus 1000. That's something that we can graph. Then we do the same thing for price. Let's divide by five all the way through that gets rid of that. And then we've got this 4x and then let's subtract 4x from each side. And what we're left with is minus 4x plus 1180. That's also something that we can graph. So here's the first line this indicates cases sold. It originally said x plus y equals 1000, but we rearranged it to y is equal to minus x plus 1000. And so that's the line we have here. And then we have another line which indicates earnings. And this one was originally written as $20 times x plus $5 times y equals $5900 total. We rearrange that to y equals minus 4x plus 1180. That's the equation for the line. And then the solution is right here at the intersection. There's our intersection and it's at 60 on the number of cases sold at $20 and 940 on the number of cases sold at $5. And that also represents the solution of these joint equations. And so it's a graphical way of solving a system of linear equations. So in some systems of linear equations allow us to balance several unknowns and find the unique solution. And in many cases, it's easy to solve by hand. It's really easy with linear algebra when you use software to do it at the same time.