Code360 powered by Coding Ninjas X Naukri.com. Code360 powered by Coding Ninjas X Naukri.com
Table of contents
1.
Introduction
2.
Matrix and Types
2.1.
Types of Matrix
3.
Properties and Operations on Matrices
3.1.
Order of Matrix
3.2.
Transpose of a Matrix
3.2.1.
Properties of Transpose of a Matrix
3.2.2.
Types of Matrices involving Transpose
3.3.
Adjoint of a Matrix
3.3.1.
Properties of Adjoint
3.4.
Arithmetic Operations on Matrices
3.4.1.
Addition of Matrices
3.4.2.
Subtraction of Matrices
3.4.3.
Multiplication of Matrices
3.4.4.
Division of Matrices
4.
FAQs
5.
Key Takeaways
Last Updated: Mar 27, 2024

Matrix

Author Naman Kukreja
1 upvote
Leveraging ChatGPT - GenAI as a Microsoft Data Expert
Speaker
Prerita Agarwal
Data Specialist @
23 Jul, 2024 @ 01:30 PM

Introduction

You have the arrays feature to store data in any row or column. Arrays can store data very efficiently, but imagine a case where you want to keep more than one array of the same size and access them together. Still, it is very difficult to manage so many arrays, so how can we solve this problem?

We can solve this problem using matrices as they are a collection of arrays of the same size. We will discuss the matrix in detail while moving further in the blog, so let's go on with our topic without wasting any time.

Matrix and Types

You can understand matrix as the set or collection of numbers arranged in vertical and horizontal lines. The vertical lines are called columns, and the horizontal lines are known as rows.

The values or numbers entered in the matrix are entries or elements. 

It is represented inside a pair of square brackets []. 

It can be referred to as the set of arrays. The matrix with n number of rows and m number of columns is called the n x m matrix. We use capital alphabets to represent the matrix with its element denoted in its subscript by small numbers.

In the above image, we represented a 3 x 3 matrix. The total number of elements in the matrix is the number of elements in each row multiplied by the number of rows or the number of rows multiplied by the number of columns.

Types of Matrix

There are many types of matrices available we will discuss them here briefly.

  1. Empty Matrix: As the name suggests, it is an empty matrix. i.e., the matrix with no rows and no columns.
  2. Column Matrix: The matrix which contains only one column and more than one number of rows is called the column matrix.
  3. Row Matrix: The matrix which contains only one row and more than one number of columns is called the row matrix.
  4. Square Matrix: The matrix which contains the same number of rows and columns is called a square matrix.
  5.  Diagonal Matrix: The matrix that contains only elements in its principal diagonal and all the other elements other than zero is called a diagonal matrix.
  6. Scalar Matrix: The matrix with all the principal diagonal elements equal is called the scalar matrix.
  7. Identity Matrix: The matrix with all principal diagonal elements as one and all the remaining elements as zero is called identity matrix or unit matrix.
  8. Triangular Matrix: The matrix that only has elements in triangular formation either above or below the principal diagonal is the triangular matrix.
  9. Submatrix: Although it is not a matrix type, we should know it. After removing a particular row or column from the matrix, it is part of the primary matrix that we get.
Get the tech career you deserve, faster!
Connect with our expert counsellors to understand how to hack your way to success
User rating 4.7/5
1:1 doubt support
95% placement record
Akash Pal
Senior Software Engineer
326% Hike After Job Bootcamp
Himanshu Gusain
Programmer Analyst
32 LPA After Job Bootcamp
After Job
Bootcamp

Properties and Operations on Matrices

There are many properties that we can perform on matrices we are going to discuss them one by one here:

Order of Matrix

We define the order in terms of rows and columns.

Order = No of rows x No of columns.

Transpose of a Matrix

We represent the transpose of a matrix A as AT in this columns replace all the rows and rows replace the columns. The m x n matrix will be converted into the n x m matrix. For example, we have shown the matrix A and its transpose in the image below.

Properties of Transpose of a Matrix

  • (AT)T = A
  • (A+B)T = AT + BT
  • (AB)T = BTAT

Types of Matrices involving Transpose

We have discussed the type of matrices above, but here we will discuss more matrices that involve transpose.

  1. Symmetric Matrix: There are two conditions for a matrix to be symmetric. First, it should be a square matrix. Second, its transpose should equal the primary matrix (AT) = A.
  2. Skew- Symmetric Matrix: A matrix is skew-symmetric if it is a square matrix and its transpose is equal to the negative of the original matrix (AT) = -A.
  3. Orthogonal Matrix: A matrix is said to be orthogonal if it satisfies the condition AAT = ATA = 1.
  4. Involuntary Matrix: A matrix is involuntary if it satisfies the following condition A2 = 1.
  5. Idempotent Matrix: A matrix is Idempotent if it satisfies the following condition A2 = A.

Adjoint of a Matrix

The adjoint of the Matrix A refers to the transpose of the cofactors of the matrix A.

The above image shows the Transpose of matrix cofactors. Cofactors are nothing but the coefficient of each term. In this case, we have only constant, so they are identical. It is represented by Adj A.

Properties of Adjoint

  • A(Adj A) = (Adj A) A = |A| In
  • Adj(AB) = (Adj B).(Adj A)
  • Adj(kA) = kn-1 Adj(A)
  • adj(adj(A))=|A|^(n-2)  *  A
  • adj(I) = I
  • If A = [L,M,N] then adj(A) = [MN, LN, LM]
  • |Adj A|= |A|n-1
  • |adj(adj(A))|= |A|^(n-1)^2

The above properties n represent the number of rows and columns as we take the case of a square matrix.

Arithmetic Operations on Matrices

Addition of Matrices

In sum, we add all the elements with the same position. And store the answer in the resulting matrix. The two matrices that have to be added should be of the same size then the resultant matrix of addition will also be of the same size. Otherwise, they will not add together.

Let's understand addition with the help of the example.

In the above example, as you can see that we have taken two matrices with the name A and B respectively, and then we perform an addition operation on both of them.

Properties of Addition

  1. Commutative Law: A + B = B + A.
  2. Additive Identity: A + 0 = 0 + A = A.
  3. Associative Law: A + (B + C) = (A + B) + C.
  4. Additive Inverse: A + (-A) = (-A) + A = 0.

Subtraction of Matrices

It is pretty similar to the above example. Still, the only difference is instead of addition. We are performing subtraction rest all the conditions are the same, like the matrices size that will be subtracted should be the same.

Multiplication of Matrices

The matrix multiplication is the dot product of the two matrices. We multiply each row element with each column element and add them. The number of columns of the first matrix should equal the number of rows of the second matrix to multiply. Otherwise, they will not multiply.

Let’s understand this with an example to understand the topic clearly.

Properties of multiplication

  1. Non-commutative: AB ≠ BA
  2. Left Distributive: A(B + C) = AB + AC
  3. Scalar: k(AB)=(kA)B (where k is scalar)
  4. Transpose: (AB)T=ATBT
  5. Associative: A(BC) = (AB)C
  6. Right Distributive: (A + B)C = AC + BC
  7. Identity: IA=AI=A

Division of Matrices

The division of a matrix is comparatively more complex than the rest of arithmetic operations. We have to perform specific operations for the division.

  • Find the inverse of the divisor. 
  • Then multiply the dividend matrix with the inverse matrix.

We find inverse by dividing the adjoint of a matrix with its determinant.

Let's understand this with an example:

Properties of Inverse

  • We can inverse only a non-singular square matrix.
  • (AB)-1 = B-1A-1 
  • (A-1)-1 = A 

FAQs

1. What is the difference between a matrix and an array?

They both are the same to much extent only difference is being matrix stores more than one array together.

2. Can we multiply two matrices with different sizes?

Yes, we can multiply two different sizes of matrices, but they must follow the condition that the number of columns of the first matrix should be equal to the number of rows of the second column.

3. Are unit matrix and identity are same?

Yes, they both are the same.

4. What is the relation between scalar and unit matrix?

The unit matrix can be a scalar matrix, whereas a scalar matrix cannot be a unit matrix.

Key Takeaways

In this article, we have extensively discussed the matrix, its different types, properties, features, and operations that we can perform on matrix with the properties of operations and all this with examples to understand better.

We hope that this blog has helped you enhance your knowledge regarding matrix and if you would like to learn more, check out our articles on Code studio. Do upvote our blog to help other ninjas grow.

 “Happy Coding!”

Live masterclass