We have given a positive number n, and we have to find a 3*3 matrix which can be formed with combination of 0 or n and has maximum determinant.
Input : n = 3 Output : Maximum determinant = 54 Resultant Matrix : 3 3 0 0 3 3 3 0 3 Input : n = 13 Output : Maximum determinant = 4394 Resultant Matrix : 13 13 0 0 13 13 13 0 13
For any 3*3 matrix having elements either 0 or n, the maximum possible determinant is 2*(n^3).. Also a matrix having maximum determinant is of form:
n n 0
0 n n
n 0 0
Maximum Determinant = 6750 Resultant Matrix : 15 15 0 0 15 15 15 0 15
Exercise: Extend the above solution for a generalized k x k matrix.
This article is contributed by Shivam Pradhan (anuj_charm). If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. 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.
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- Find determinant of matrix generated by array rotation
- Determinant of a Matrix
- Check if it is possible to create a matrix such that every row has A 1s and every column has B 1s
- Color a grid such that all same color cells are connected either horizontally or vertically
- Replace every matrix element with maximum of GCD of row or column
- Maximum trace possible for any sub-matrix of the given matrix
- Count of elements of an array present in every row of NxM matrix
- Place N^2 numbers in matrix such that every row has an equal sum
- Filling diagonal to make the sum of every row, column and diagonal equal of 3x3 matrix
- Find a Square Matrix such that sum of elements in every row and column is K
- Construct a matrix such that union of ith row and ith column contains every element from 1 to 2N-1
- Final direction after visiting every cell of Matrix starting from (0, 0)
- Find the sum of Eigen Values of the given N*N matrix
- Number of rows and columns in a Matrix that contain repeated values
- Construct a Matrix of size NxN with values in range [1, N^2] as per given conditions
- Min number of moves to traverse entire Matrix through connected cells with equal values
- Maximum increase in value of Matrix to keep maximum rows and columns unchanged
- Maximum and Minimum Values of an Algebraic Expression
- Maximize sum of N X N upper left sub-matrix from given 2N X 2N matrix
- Circular Matrix (Construct a matrix with numbers 1 to m*n in spiral way)