Learn Introduction
Learn Data Structure & Algorithm
Learn Numpy
Learn Pandas
Learn Matplotlib
Learn Seaborn
Learn Statistics
Matrix
Vector
Probability
Learn MATLAB
Learn Machine learning
Learn Github
Learn OpenCV
Learn Deep Learning
Learn MySQL
Learn MongoDB
Learn Web scraping
Learn Excel
Learn Power BI
Learn Tableau
Learn Docker
Learn Hadoop
A matrix is a rectangular structure of numbers or signs. We write a matrix inside the third bracket. The name
of the matrix starts from a capital letter like A, B, C, etc. You can also say that matrix is a list of the
list. It means that here you have multiple lists inside a list. Matrix has rows and columns. A matrix can have
(1 row and multiple columns) or (multiple rows and 1 column) or (multiple rows and multiple columns).
Example:
A=[1 11 111
2 22 222
3 33 333
4 44 444]
Here A matrix has 3 rows and 3 columns.
In A matrix you can see multiple list, 1st list (1,11,111), 2nd
list(2,22,222), 3rd list(3,33,333) and 4th list(4,44,444). With these lists matrix A is created.
A(ij)=[A11 A12 A13
A21 A22 222
A31 A32 A33
A41 A42 A43]
B=[1 11 111
2 22 222
3 33 333
4 44 444]
Here in A(ij), i denote row number and j denote column number. In the matrix, A12 means first row and second
column. Similarly, A33 means third row and third column. If you compare this with the B matrix then position
A33 has the value of 333.
If the matrix is the same in dimension, only then you can do sum or subtraction.
A=[1 2 3
4 5 6
7 8 9]
B=[1 4 7
2 4 8
3 4 9]
A+B=[1+1=2 2+4=6 3+7=10
4+2=65+4=9 6+8=14
7+3=10 8+4=12 9+9=18]
B-A=[1-1=0 4-2=2 7-3=4
2-4=-2 5-4=1 8-6=2
3-7=-4 4-8=-4 9-9=0]
You can only do matrix multiplication when the number of columns of the first matrix is equal to the number of
rows of the second matrix.
If the dimension of the first matrix is (2x3) and the dimensions of the second matrix are (3x3) then the
dimension after multiplication will be (2x3).(3x3)=(2x3)
A=[1 2 3
4 5 6
]
B=[1 4 7
2 4 8
3 4 9]
A*B=[1*1+2*2+3*3 1*4+2*4+3*4 1*7+2*8+3*9
4*1+5*2+6*3 4*4+5*4+6*4 4*7+5*8+6*9&]
A*B=[1*4 24 50
32 60 122]
9B=[9 36 63
18 36 72
27 36 81]