Have any question?    +91 9810600764      info@palin.co.in

How matrices works in python

How matrices works in python


There is a library in Python called NUMPY, and it is because of this that we are able to study data science, using Python. The uniqueness of this library is that though it is Python’s library, it has not been written in Python. Python itself is an interpreted language. It is an inherently compiled language. Numpy has been written in ‘C’ language, which is the most efficient language till date. Other libraries like csv library takes care of csv files, similarly Jason library handles Jason files. Numpy on the other hand is related to linear algebra. Whatever linear equations or calculations we will be doing with the help of Numpy. Using Numpy another library has been created which is known as “Panda’s”. whatever linear operations that Numpy can handle can also be done by Panda. So to be able to store data retrieved from any source, it will be stored in the ‘arrey’ of Numpy. Any transformation to be done with the data will be handled by Panda’s.

In any standard notation rows come first and then columns. The notation ‘R’ with a double line represents a matred family. So if we see R(double line) 3x3m it means that all the matrix belong to the fanily which have their dimensions 3×3.

A special type of Matrix which has only one column is called Vector.  All vectors are Matrices but all Matrices are not Vectors. It is also called a ‘one dimensional matrix’.

Suppose we have two matrices like the example below

The dimensions of both these matrices is 3×2. We can do addition, subtraction and multiplication in Vectors.

What is the answer of the following

The answer is this

Can we multiply the following two matrices?

2 wii be multiplied by 1 (vertical x horizontal)


If x = 0 then y cuts x axis at 5. So in the above screen m is the coefficient of x



Assuming that the black line represents the pattern most accurately. The values (red dots) were plotted from the observed data.

Looking at the above screen where both x and y axis are given we can predict the salary related to the age of the candidate. If we want to find out the salaries of four candidates having different ages, then matrix will give the result for all four candidates together and not one at a time.

Numpy remains the fastest and most popular amongst all the libraries.

If any matrix having a dimension of 2 x 3 is multiplied with an identity matrix, then the dimension of the identity matrix should be 3 x 3.

In the case of Transpose Matrix, the rows will become columns and the columns will become rows.

Let’s suppose there is a matrix 1,2,3,4,5,6,7,8,9 if we have to import Numpy as np, ‘array’ is a function of Numpy, in which arrays can be made.

These are some of the ways in which matrix function can be used to find out various results in a given situation.