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.
- Determinant of a Matrix
- Find determinant of matrix generated by array rotation
- Find the sum of Eigen Values of the given N*N matrix
- 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 sum of elements from each row in the matrix
- Find a sub matrix with maximum XOR
- Maximum sum rectangle in a 2D matrix | DP-27
- Find row with maximum sum in a Matrix
- Maximum path sum in matrix
- Pair with maximum sum in a Matrix
- Maximum sum path in a Matrix
- Maximum difference of indices (i, j) such that A[i][j] = 0 in the given matrix
- Maximum sum of hour glass in matrix