StackedML
Practice
Labs
Questions
Models
Pricing
Sign in
Questions
/
Math Foundations
/
Linear Algebra
/
Matrix multiplication
← Previous
Next →
496.
Matrix Multiplication Time Complexity
medium
Computing AB where A is n×n and B is n×n has time complexity O(n³) naively. Why?
A
Each of the n² output entries requires a dot product of length n, giving n² × n = n³ operations
B
Each of the n output rows requires n² multiplications between the row and all columns of B
C
Each of the n² input entries of A must be multiplied by each of the n² entries of B independently
D
Each matrix has n² entries and multiplication requires comparing all pairs giving n² × n² = n⁴ operations
Sign in to verify your answer
← Back to Questions