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 firstname.lastname@example.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.
- Maximum size square sub-matrix with all 1s
- Print a given matrix in spiral form
- Search in a row wise and column wise sorted matrix
- A Boolean Matrix Question
- Matrix Chain Multiplication | DP-8
- Find the row with maximum number of 1s
- Print unique rows in a given boolean matrix
- Inplace (Fixed space) M x N size matrix transpose | Updated
- Maximum sum rectangle in a 2D matrix | DP-27
- Zigzag (or diagonal) traversal of Matrix
- Divide and Conquer | Set 5 (Strassen's Matrix Multiplication)
- Print all possible paths from top left to bottom right of a mXn matrix
- Count all possible paths from top left to bottom right of a mXn matrix
- Printing brackets in Matrix Chain Multiplication Problem
- Create a matrix with alternating rectangles of O and X