# Math preliminaries

In my opinion, machine learning is a combination of mathematics and computer science. So of course there is some math that you need to know before we start off with actually making machines learn some data to make accurate predictions! I will cover only the basics in this post and explain it in detail in my future posts.

First off, matrix operations. Most of the machine learning models work with matrices as it is more efficient (this is also because it allows parallel computing).

A matrix is defined by its rows and columns. The below matrix A has a dimension of 2 * 3 where 2 is the number of rows and 3 is the number of columns. Similarly, B has a dimension of 3*2.

For matrix addition and subtraction, the dimensions of the matrices must be equal.

For matrix multiplication, the number of columns for the first matrix should be equal to the number of rows for the second matrix. So if I am multiplying matrix A (dimension m*n) by matrix B (dimension n*k), the result is an m*k matrix. I visualise an inverted L to remember which numbers to multiply.

Second, graphing of linear equations. This is important for concepts like linear classification which I will cover in my next post. Given a line represented by y = 2x + 2, I can graph it by substituting the values of x and obtain the corresponding value of y. So, when

x =0, y = 2*0 + 2 = 2 giving the point (0, 2)

x =2, y = 2*2 + 2 = 6 giving the point (2, 6)

x =3, y = 2*3 + 2 = 8 giving the point (3, 8)

If I plot these points on the x and y axes and join them, I obtain the following graph. It is observed that if I draw a line at x = 2 to meet my line and I project that line to the y axis, y = 6.