Matrix Multiplication via Bubble Tea

线性代数 Feb 24, 2024

Matrix Multiplication? Its Just Bubble Tea Recipes

Every linear algebra student has that moment: "Wait, why does column count of first have to equal row count of second? Who made this rule?" Relax. No formulas today. Just bubble tea.

Scenario: You Own a Tea Shop

Two drinks: Pearl Milk Tea, Coconut Tea. Each needs: Tea, Milk, Sugar.

Write as a matrix (just a table):

         Tea Milk Sugar
Pearl   [ 2,  3,  2 ]
Coconut [ 1,  2,  4 ]

This is a 2x3 matrix (2 drinks x 3 ingredients). Now: make 10 Pearls + 5 Coconuts. Total ingredients?

Tea   = 10x2 + 5x1 = 25 spoons
Milk  = 10x3 + 5x2 = 40 spoons
Sugar = 10x2 + 5x4 = 40 spoons

CONGRATULATIONS! You just did matrix multiplication!

[10, 5] x [2 3 2] = [25, 40, 40]
          [1 2 4]

Why Column Count = Row Count?

Because matching. Like you cant say "3 apples + 2 oranges = 5 apples." The middle dimension holds hands - must match for pairing.

Matrix Multiplication Everywhere

  • Graphics: Rotate, scale, translate = matrix multiply
  • Machine Learning: Neural networks = giant matrix multiplies
  • Recommendations: What movie you like? Matrix multiply.
  • PageRank: Google ranking? Yep, matrices.

Next time you see matrix multiplication, think "pair and sum." If you can calculate bubble tea ingredients, you can do matrix math. Drink some tea to celebrate!

Tags