Challenge - 5 Problems
Matrix Determinant Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate2:00remaining
Calculate determinant of a 2x2 matrix
What is the output of this code that calculates the determinant of a 2x2 matrix using scipy?
SciPy
import numpy as np from scipy.linalg import det matrix = np.array([[4, 7], [2, 6]]) result = det(matrix) print(round(result, 2))
Attempts:
2 left
💡 Hint
Recall determinant formula for 2x2: ad - bc
✗ Incorrect
The determinant of [[4,7],[2,6]] is (4*6) - (7*2) = 24 - 14 = 10.
❓ data_output
intermediate2:00remaining
Number of matrices with zero determinant
Given these three matrices, how many have a determinant of zero?
SciPy
import numpy as np from scipy.linalg import det matrices = [ np.array([[1, 2], [2, 4]]), np.array([[3, 0], [0, 3]]), np.array([[0, 1], [1, 0]]) ] zero_det_count = sum(abs(det(m)) < 1e-10 for m in matrices) print(zero_det_count)
Attempts:
2 left
💡 Hint
Check if rows are linearly dependent for zero determinant.
✗ Incorrect
Only the first matrix has determinant zero because its rows are multiples (2*row1 = row2).
🔧 Debug
advanced2:00remaining
Identify the error in determinant calculation
What error does this code raise when trying to calculate the determinant?
SciPy
import numpy as np from scipy.linalg import det matrix = np.array([1, 2, 3, 4]) result = det(matrix) print(result)
Attempts:
2 left
💡 Hint
Check the shape of the input array.
✗ Incorrect
The input is a 1D array, not a 2D square matrix, so scipy.linalg.det raises ValueError.
🧠 Conceptual
advanced2:00remaining
Effect of row swap on determinant
If you swap two rows of a square matrix, how does the determinant change?
Attempts:
2 left
💡 Hint
Think about how row operations affect determinants.
✗ Incorrect
Swapping two rows multiplies the determinant by -1, changing its sign.
🚀 Application
expert2:00remaining
Determinant of product of matrices
Given two square matrices A and B, what is the determinant of their product AB?
Attempts:
2 left
💡 Hint
Recall properties of determinants with matrix multiplication.
✗ Incorrect
The determinant of a product is the product of determinants: det(AB) = det(A) * det(B).