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.
- Determinant of a Matrix
- Find determinant of matrix generated by array rotation
- Maximum and Minimum Values of an Algebraic Expression
- Maximum trace possible for any sub-matrix of the given matrix
- Maximum XOR value in matrix
- Maximum path sum in matrix
- Find a sub matrix with maximum XOR
- Maximum sum of elements from each row in the matrix
- Pair with maximum sum in a Matrix
- Maximum sum rectangle in a 2D matrix | DP-27
- Find row with maximum sum in a Matrix
- Find maximum element of each row in a matrix
- Maximum sum of hour glass in matrix
- Maximum and Minimum in a square matrix.
- Maximum number of ones in a N*N matrix with given constraints