0
0
SciPydata~20 mins

Matrix determinant (det) in SciPy - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Matrix Determinant Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
Predict Output
intermediate
2: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))
A14.0
B10.0
C0.0
D26.0
Attempts:
2 left
💡 Hint
Recall determinant formula for 2x2: ad - bc
data_output
intermediate
2: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)
A1
B0
C3
D2
Attempts:
2 left
💡 Hint
Check if rows are linearly dependent for zero determinant.
🔧 Debug
advanced
2: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)
AValueError: expected square matrix
BTypeError: det() argument must be a matrix
CAttributeError: 'numpy.ndarray' object has no attribute 'det'
DNo error, outputs 0
Attempts:
2 left
💡 Hint
Check the shape of the input array.
🧠 Conceptual
advanced
2:00remaining
Effect of row swap on determinant
If you swap two rows of a square matrix, how does the determinant change?
AIt becomes zero
BIt doubles
CIt changes sign (multiplied by -1)
DIt remains the same
Attempts:
2 left
💡 Hint
Think about how row operations affect determinants.
🚀 Application
expert
2:00remaining
Determinant of product of matrices
Given two square matrices A and B, what is the determinant of their product AB?
Adet(AB) = det(A) + det(B)
Bdet(AB) = det(A) / det(B)
Cdet(AB) = det(A) - det(B)
Ddet(AB) = det(A) * det(B)
Attempts:
2 left
💡 Hint
Recall properties of determinants with matrix multiplication.