# Matrix Archives

A matrix represents a collection of numbers arranged in an order of rows and columns. It is necessary to enclose the elements of a matrix in parentheses or brackets.

A matrix with 9 elements is shown below.

This Matrix [M] has 3 rows and 3 columns. Each element of matrix [M] can be referred to by its row and column number. For example, a_{23} = 6.

### Recent Articles on Matrix

- Rotate Matrix Elements
- Inplace rotate square matrix by 90 degrees | Set 1
- Rotate a matrix by 90 degree without using any extra space | Set 2
- Rotate a Matrix by 180 degree
- Rotate each ring of matrix anticlockwise by K elements
- Turn an image by 90 degree
- Check if all rows of a matrix are circular rotations of each other
- Sort the given matrix
- Find the row with maximum number of 1s
- Find median in row wise sorted matrix
- Matrix Multiplication | Recursive
- Program to multiply two matrices
- Program for scalar multiplication of a matrix
- Program to print Lower triangular and Upper triangular matrix of an array
- Find distinct elements common to all rows of a matrix
- Print a given matrix in spiral form
- Find maximum element of each row in a matrix
- Find unique elements in a matrix
- Shift matrix elements row-wise by k
- Different Operations on Matrices
- Print a given matrix in counter-clock wise spiral form
- Swap major and minor diagonals of a square matrix
- Maximum path sum in matrix
- Squares of Matrix Diagonal Elements
- Move matrix elements in given direction and add elements with same value
- Sorting rows of matrix in ascending order followed by columns in descending order
- Sum of middle row and column in Matrix
- Row-wise vs column-wise traversal of matrix
- Rotate the matrix right by K times
- Program to check idempotent matrix
- Program to check Involutory Matrix
- Interchange elements of first and last rows in matrix
- Print matrix in zag-zag fashion
- Row wise sorting in 2D array
- Program for Markov matrix
- Program to check diagonal matrix and scalar matrix
- Sort the matrix row-wise and column-wise
- Find the number of islands
- Magic Square | Even Order
- Magic Square
- Check given matrix is magic square or not
- Check given matrix is magic square or not
- Kronecker Product of two matrices
- Count sub-matrices having sum divisible ‘k’
- Diagonally Dominant Matrix
- Minimum operations required to make each row and column of matrix equals
- Count frequency of k in a matrix of size n where matrix(i, j) = i+j
- Given 1’s, 2’s, 3’s ……k’s print them in zig zag way.
- Number of cells a queen can move with obstacles on the chessborad
- Maximum product of 4 adjacent elements in matrix
- Minimum flip required to make Binary Matrix symmetric
- Program to check if matrix is lower triangular
- Program to check if matrix is upper triangular
- Frequencies of even and odd numbers in a matrix
- Center element of matrix equals sums of half diagonals
- Program for Identity Matrix
- Program to swap upper diagonal elements with lower diagonal elements of matrix.
- Sparse Matrix Representations
- Ways of filling matrix such that product of all rows and all columns are equal to unity
- Mirror of matrix across diagonal
- Find if there is a rectangle in binary matrix with corners as 1
- Find all rectangles filled with 0
- Shortest distance between two cells in a matrix or grid
- Counting sets of 1s and 0s in a binary matrix
- Search in a row wise and column wise sorted matrix
- Create a matrix with alternating rectangles of O and X
- Zigzag (or diagonal) traversal of Matrix
- Inplace (Fixed space) M x N size matrix transpose | Updated
- Minimum cost to sort a matrix of numbers from 0 to n^2 – 1
- Unique cells in a binary matrix
- Count entries equal to x in a special matrix
- Check if a given matrix is sparse or not
- Row-wise common elements in two diagonals of a square matrix
- Check if sums of i-th row and i-th column are same in matrix
- Find row number of a binary matrix having maximum number of 1s
- Program to check if a matrix is symmetric
- Find if a 2-D array is completely traversed or not by following the cell values
- Program to Print Matrix in Z form
- Print all palindromic paths from top left to bottom right in a matrix
- Possible moves of knight
- Efficiently compute sums of diagonals of a matrix
- Boundary elements of a Matrix
- Print a matrix in a spiral form starting from a point
- Print matrix in snake pattern
- Program to Interchange Diagonals of Matrix
- Find difference between sums of two diagonals
- Construct Ancestor Matrix from a Given Binary Tree
- Construct tree from ancestor matrix
- Circular Matrix (Construct a matrix with numbers 1 to m*n in spiral way)
- Program for Sudoku Generator
- Program for Conway’s Game Of Life
- Maximum sum of hour glass in matrix
- Maximum and Minimum in a square matrix.
- Print matrix in antispiral form
- Program to find Normal and Trace of a matrix
- Sort a Matrix in all way increasing order
- Minimum operations required to set all elements of binary matrix
- Print a given matrix in reverse spiral form
- C Program To Check whether Matrix is Skew Symmetric or not
- Sum of matrix element where each elements is integer division of row and column
- Sparse Matrix and its representations
- Find number of transformation to make two Matrix Equal
- Form coils in a matrix
- Sum of matrix in which each element is absolute difference of its row and column numbers
- Check horizontal and vertical symmetry in binary matrix
- Maximum determinant of a matrix with every values either 0 or n
- Sum of both diagonals of a spiral odd-order square matrix
- Find pair of rows in a binary matrix that has maximum bit difference
- Find all permuted rows of a given row in a matrix
- Find perimeter of shapes formed with 1s in binary matrix
- Print cells with same rectangular sums in a matrix
- Print matrix in diagonal pattern
- Maximum difference of sum of elements in two rows in a matrix
- Find pairs with given sum such that elements of pair are in different rows
- Total coverage of all zeros in a binary matrix
- Replace every matrix element with maximum of GCD of row or column
- Count all sorted rows in a matrix
- Queries in a Matrix
- Maximum XOR value in matrix
- Maximum mirrors which can transfer light from bottom to right
- Direction at last square block
- Print K’th element in spiral form of matrix
- Find if given matrix is Toeplitz or not
- Count zeros in a row wise and column wise sorted matrix
- Count Negative Numbers in a Column-Wise and Row-Wise Sorted Matrix
- Find size of the largest ‘+’ formed by all ones in a binary matrix
- Return previous element in an expanding matrix
- Print n x n spiral matrix using O(1) extra space
- Shortest path in a Binary Maze
- Find orientation of a pattern in a matrix
- Find a specific pair in Matrix
- Print maximum sum square sub-matrix of given size
- Common elements in all rows of a given matrix
- In-place convert matrix in specific order
- A Boolean Matrix Question
- Given a Boolean Matrix, find k such that all elements in k’th row are 0 and k’th column are 1.
- Print unique rows in a given boolean matrix
- Find the largest rectangle of 1’s with swapping of columns allowed
- Validity of a given Tic-Tac-Toe board configuration
- Submatrix Sum Queries
- Program for Rank of Matrix
- Maximum size rectangle binary sub-matrix with all 1s
- Maximum size square sub-matrix with all 1s
- Find sum of all elements in a matrix except the elements in row and/or column of given cell?
- Count number of islands where every island is row-wise and column-wise separated
- Find a common element in all rows of a given row-wise sorted matrix
- Given a matrix of ‘O’ and ‘X’, replace ‘O’ with ‘X’ if surrounded by ‘X’
- Given a matrix of ‘O’ and ‘X’, find the largest subsquare surrounded by ‘X’
- Flood fill Algorithm – how to implement fill() in paint?
- Print all elements in sorted order from row and column wise sorted matrix
- Given an n x n square matrix, find sum of all sub-squares of size k x k
- Program to find transpose of a matrix
- C program for addition of two matrices
- C program for subtraction of matrices
- Collect maximum points in a grid using two traversals
- Collect maximum coins before hitting a dead end
- Number of paths with exactly k coins
- Find length of the longest consecutive path from a given starting character
- Find the longest path in a matrix with given constraints
- Minimum Initial Points to Reach Destination
- Divide and Conquer | Set 5 (Strassen’s Matrix Multiplication)
- Dynamic Programming | Set 27 (Maximum sum rectangle in a 2D matrix)

**Quick Links :**

If you like GeeksforGeeks and would like to contribute, you can also write an article and mail your article to review-team@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.