Matrix Calculator
Add, multiply, transpose, and find the determinant of 2×2 and 3×3 matrices.
Matrix A
Matrix B
Frequently Asked Questions
Code Implementation
import numpy as np
A = np.array([[1, 2], [3, 4]])
B = np.array([[5, 6], [7, 8]])
# Addition
print("A + B =\n", A + B)
# Multiplication (dot product)
print("A @ B =\n", A @ B)
# Determinant
print("det(A) =", np.linalg.det(A)) # -2.0
# Inverse (exists only if det ≠ 0)
print("A^-1 =\n", np.linalg.inv(A))
# Transpose
print("A^T =\n", A.T)
# Eigenvalues and eigenvectors
vals, vecs = np.linalg.eig(A)
print("Eigenvalues:", vals)
print("Eigenvectors:\n", vecs)
# Solve linear system Ax = b
b = np.array([1, 2])
x = np.linalg.solve(A, b)
print("Solution x:", x) # A @ x == bComments & Feedback
Comments are powered by Giscus. Sign in with GitHub to leave a comment.