Start course
1h 45m

To design effective machine learning, you’ll need a firm grasp of the mathematics that support it. This course is part one of the module on maths for machine learning. It will introduce you to the mathematics of machine learning, before jumping into common functions and useful algebra, the quadratic model, and logarithms and exponents. After this, we’ll move onto linear regression, calculus, and notation, including how to provide a general analysis using notation.

Part two of this module can be found here and covers linear regression in multiple dimensions, interpreting data structures from the geometrical perspective of linear regression, vector subtraction, visualized vectors, matrices, and multidimensional linear regression.

If you have any feedback relating to this course, please contact us at


- Right, so let's put a little bit of notation to all of this. So, let's go back to the graph we had earlier of F of X, and let's just sort of zoom in to a little bit of it. Maybe between, you know, the input of two and the input of three. So, if we have X squared then two would give us. Let's say here would be four and three, the point three here. Let's say we just, you know, put here a nine. So, you know, we're making one unit change in this case X and we're getting a big difference in F of X. Of course, you know, as a side point, the thing we're dealing with here is A and changing A, and changing L. And that's sort of what we're mostly interested in, but we'll just do it in general. Call it X and F of X. Right, so, what I wanna know is. I wanna form a way of trying to answer the question: how fast is the output changing? Now, you know, give me some kind of answer to that question. So, that's what I'm gonna do. So, let's try and define this, and, so, yeah. At this point here, two in the X and four in the Y. What's that? Well, let's say that. Well, you know, that's F of two anywhere. Put F of 2 on there, all right. And three, nine, that's F of three. Okay. So, okay, there's the heights. The height is F of two, and the other one the height is F of three. And watch this. So, we know what the height is. So, the height now there and the actual height between them. This is height between them is gonna be F of three minus F of two. So, what is F of three minus of F of two tell us? Well, it's nine minus four, right? Which is five. It tells us how much we've shifted. So, that's the change. So, the change is five, right? So, we've gone up by five, but how far have we stepped? We stepped here from two to three. So, we've stepped by one unit. So, you know, so, this is two and that's three, and the difference here is one. So, if we divide that by three minus two, you know. Suppose we had only stepped 2.5. You know, if we're always dividing by how far we're moving horizontally then we get a rate, the pace at which we're going up. So, if I look at 2.5 here. So, if I put 2.5 into this F of 2.5. 2.5 here. Well, what's 2.5 squared? I'm gonna guess it's 60, six, 2.2 something, but we'll have a look. So, 2.5 times 2.5. 6.25, there we go. So, this is 6.25. And that's, obviously, four. So, four. So, 6.25 minus four is 2.25, so in this intermediate case, we've got 6.25 minus four then we divide by. Well, 2.5 minus two. And what does that give us. It gives us 2.25 minus. Divided by, sorry, not .5. And that tells us actually the rate we're moving at is 4.5. Right, so, it's important to divide. It's important to divide by the size of the step you're making because, you know, if we're trying to compare, suppose you're trying to compare rates, and I wanna know how fast we're moving up here and how fast we're moving down here. Well, if I'm stepping by different amounts, I'm just gonna go further up this line even though maybe my rate isn't changing. So, let me just show you what I mean by that. So, you know, so, if I had a straight line, right? And I go from here to here, well, obviously, I make a big jump. You know, I make a big jump up. And if I go from here to here, I make a very small jump up. And it's not, you know. Nothing miraculous has happened. This one is big and that one is small. It hasn't. It's not that we're getting steeper. It's just that I've moved horizontally less, right? I haven't actually. You know, I've climbed less terrain. Whereas, so, the rate isn't changing here. This, you know, so, this is like an artifact in the fact that, you know, and artifact, a consequence to the fact that I've made a different size step. See, if I divide this height by how much I've traveled with the width or the horizontal motion there, and I divide that through, well, it's gonna give me a rate, and what I'd find out here is that, you know, actually, the. So, we do it. So, we think of it in terms of just one step. You'd find that the actual. That this slope in terms of, you know, straight same step sizes, say, is always the same 'cause it's a straight line. So, the slope isn't changing. It's the same everywhere.

About the Author

Michael began programming as a young child, and after freelancing as a teenager, he joined and ran a web start-up during university. Around studying physics and after graduating, he worked as an IT contractor: first in telecoms in 2011 on a cloud digital transformation project; then variously as an interim CTO, Technical Project Manager, Technical Architect and Developer for agile start-ups and multinationals.

His academic work on Machine Learning and Quantum Computation furthered an interest he now pursues as QA's Principal Technologist for Machine Learning. Joining QA in 2015, he authors and teaches programmes on computer science, mathematics and artificial intelligence; and co-owns the data science curriculum at QA.