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

Matrix for deep learning, machine learning & data science

What is matrix?

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.

Types of matrix:

  • Row matrix:
    That matrix which has only one row is called a row matrix.
    A=[1,2,3,4]
  • Column matrix:
    That matrix which has only one column is called a column matrix
    A=[1
        2
        3
        4]
  • Square matrix:
    That matrix which has an equal number of rows and columns is called a square matrix.
    A=[1 11 111
          2 22 222
          3 33 333
          4 44 444]
  • Diagonal matrix:
    A diagonal matrix, all the elements are zero except the diagonal elements.
    A=[1 0 0
          0 2 0
          0 0 3]
  • Scaler matrix:
    It is a diagonal matrix where all the diagonal elements are equal but not zero and all the other elements are zero.
    A=[3 0 0
          0 3 0
          0 0 3]
  • Identity matrix:
    It is a diagonal matrix where all the diagonal elements are 1 and other elements are zero.
    A=[1 0 0
          0 1 0
          0 0 1]
  • Zero matrix:
    Here all the elements are zero.
    A=[0 0 0
          0 0 0
          0 0 0]
  • One matrix:
    Here all the values are one.
    A=[1 1 1
          1 1 1
          1 1 1]
  • Transpose matrix:
    It is a matrix that is formed by converting all the given rows into columns and all the columns into rows.
    A=[1 2 3
          4 5 6
          7 8 9]
    A(transpose)=[1 4 7
                            2 5 8
                            3 6 9]
  • How to find a particular value in particular position of a matrix?

    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.

    How to do matrix sum and subtraction?

    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]

    How to do matrix multiplication?

    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]

    CodersAim is created for learning and training a self learner to become a professional from beginner. While using CodersAim, you agree to have read and accepted our terms of use, privacy policy, Contact Us

    © Copyright All rights reserved www.CodersAim.com. Developed by CodersAim.