Strassen's matrix multiplication

hip-hop, educational

Listen on 93

Lyrics

[Verse 1]
Regular multiplication takes cubic time to compute
Eight subproblems multiplying, but there's a better route
Strassen found the secret hiding in recursive splits
Seven products do the magic, complexity it shifts

[Chorus]
Seven products, not eight - that's the Strassen way
Cut the matrix into quarters, let recursion play
A through H we calculate, combine them at the end
O of n log seven - efficiency we bend

[Verse 2]
Partition both your matrices into equal quadrants clean
Top left, top right, bottom left, bottom right - four pieces seen
Each submatrix holds the key to faster computation
Seven clever formulas unlock optimization

[Chorus]
Seven products, not eight - that's the Strassen way
Cut the matrix into quarters, let recursion play
A through H we calculate, combine them at the end
O of n log seven - efficiency we bend

[Bridge]
Product A equals M plus N minus O plus R
Product B gets N plus O, keep the pattern par
Product C takes M plus L, Product D needs G plus H
Subtracting, adding products, mathematics paves the way

[Verse 3]
Base case hits when matrices shrink to tiny size
Switch to standard multiplication, no need to subdivide
Memory overhead's the cost for algorithmic gain
Cache misses multiply when recursion breaks the chain

[Chorus]
Seven products, not eight - that's the Strassen way
Cut the matrix into quarters, let recursion play
A through H we calculate, combine them at the end
O of n log seven - efficiency we bend

[Outro]
Theoretical breakthrough, practical trade-offs weigh
Strassen's legacy endures in matrices today

← Bloom filters | Karatsuba multiplication →