Theory
Rupa ના 2 counters
Rupa 2 snack counters ચલાવે છે, એક campus gate પર અને એક railway station પર. બંને જગ્યાએ samosa અને tea વેચાય છે. એની January અને February ની sales (સોમાં):
Jan = ⎡ 10 6 ⎤ Feb = ⎡ 12 9 ⎤
⎣ 8 12 ⎦ ⎣ 10 14 ⎦
અહીં rows એ counters છે (Campus, Station), અને columns એ items છે (samosa, tea).
એનો accountant પૂછે છે: આખા quarter ની total sales કેટલી? દરેક item નો growth કેટલો? દરેક counter ની revenue કેટલી? 3 પ્રશ્ન, અને 3 matrix operations.
Theory
Addition: sheets ને એકબીજા પર મૂકો
January ને એક transparent sheet પર print કરો અને February ને બીજા sheet પર, પછી બંનેને એકબીજા પર મૂકી દો. દરેક cell એની જોડ સાથે બરાબર ગોઠવાઈ જશે: Campus-samosa ઉપર Campus-samosa. Matrices ને add કરવું એટલે આ જોડને add કરવું, બસ એટલું જ. એટલે જ તો બંને sheets same size ના હોવા જોઈએ: દરેક cell ને એની બરાબર એક partner જોઈએ.
Theory
Addition અને subtraction, formally
જો A અને B નો same order હોય, તો (A + B)ᵢⱼ = aᵢⱼ + bᵢⱼ. Subtraction માટે પણ એ જ. Orders જુદા હોય તો? Not defined. કોઈ exception નહીં.
Jan + Feb = ⎡ 22 15 ⎤ (total sales)
⎣ 18 26 ⎦
Feb - Jan = ⎡ 2 3 ⎤ (growth)
⎣ 2 2 ⎦
Growth matrix નો દરેક cell positive છે: એટલે બંને counters પર બંને items વધારે વેચાયા.
Quiz
A નો order 2×3 છે અને B નો order 3×2 છે. A + B શું થાય?
- Not defined, orders જુદા છે
- એક 2×2 matrix
- એક 3×3 matrix
- પહેલા B ને transpose કરો તો defined થાય
Show the answer
Not defined, orders જુદા છે
Addition માં દરેક cell એની same position વાળી જોડ સાથે pair થાય છે, એટલે orders બિલકુલ સરખા હોવા જ જોઈએ, અને અહીં 2×3 ≠ 3×2. B ને transpose કરો તો એક જુદી જ matrix બને, અને એની સાથે A નો sum એ તો બીજો જ પ્રશ્ન થઈ ગયો, આ પ્રશ્નનો ઉકેલ નહીં.
Theory
Multiplication તો સાવ જુદી વસ્તુ છે
જુઓ, February નો Campus row આ રહ્યો: 12 samosas, 9 teas (સોમાં). Prices: samosa ₹9, tea ₹7. તો એ counter ની revenue:
12·9 + 9·7 = 108 + 63 = 171
એટલે pair-wise multiply કરો, પછી add કરો. તમે તો આખી જિંદગી bill આ જ રીતે ગણ્યા છે. આ "row times column, then sum" વાળી હિલચાલ એ જ matrix multiplication નો મૂળ atom છે. આ addition જેવું cell-by-cell નથી.
Follow along
A (m×n) ને B (n×p) સાથે કેમ multiply કરવું
- અંદરના numbers મળે છે કે નહીં એ check કરો A ના columns એ B ના rows બરાબર હોવા જોઈએ. 2×2 ને 2×1 સાથે multiply થાય, કારણ કે 2 = 2. જો જુદા હોય તો ત્યાં જ અટકી જાઓ: product defined નથી.
- Answer નો order બહારના numbers પરથી વાંચી લો (m×n)·(n×p) નું result m×p આવે. 2×2 ને 2×1 સાથે ગુણો તો 2×1 આવે.
- દરેક entry cᵢⱼ માટે: row i ને column j માં નાખો A ના row i ની entries ને B ના column j ની entries સાથે એક એક pair કરીને multiply કરો, પછી બધું add કરી દો.
- Answer ના દરેક cell માટે આ જ પુનરાવર્તન કરો એક row પતાવીને પછી બીજી, એમ row by row કામ કરો જેથી ક્યાં છો એ ભૂલી ન જાઓ.
Theory
એક example કરી લઈએ: January ની revenue
Sales S (2×2) ને price column P (2×1) સાથે ગુણો. અંદરના numbers: 2 = 2, એટલે answer 2×1 આવશે.
S = ⎡ 10 6 ⎤ P = ⎡ 9 ⎤
⎣ 8 12 ⎦ ⎣ 7 ⎦
Campus row ને P માં: 10·9 + 6·7 = 90 + 42 = 132
Station row ને P માં: 8·9 + 12·7 = 72 + 84 = 156
S·P = ⎡ 132 ⎤
⎣ 156 ⎦
એક જ multiplication, અને Rupa ને દરેક counter ની revenue મળી ગઈ.
Think first
હવે તમારો વારો: February ની revenue
February ની sales rows છે (12 9) અને (10 14), prices હજી પણ ₹9 અને ₹7 જ છે.
કાગળ પર Feb·P ગણો: 2 row-into-column sums.
Show the answer
Campus: 12·9 + 9·7 = 108 + 63 = 171
Station: 10·9 + 14·7 = 90 + 98 = 188
Feb·P = ⎡ 171 ⎤
⎣ 188 ⎦
બંને counters એ January (132, 156) કરતાં વધારે કમાયા, અને આ પેલી all-positive growth matrix સાથે બરાબર બંધ બેસે છે.
Quiz
A એ 2×3 છે અને B એ 3×4 છે. AB નો order શું થાય?
- 2×4
- 3×3
- 2×3
- Not defined
Show the answer
2×4
અંદરના numbers 3 અને 3 મળે છે, એટલે product exist કરે છે. Answer બહારના numbers લે છે: 2×4. જો તમે "not defined" પસંદ કર્યું હોય તો તમે ખોટી pair સરખાવી, (2×3)·(3×4) એમ લખો અને વચ્ચે અડોઅડ આવતા numbers જુઓ.
Watch out
2 classic traps
Trap 1: addition ની જેમ cell-by-cell multiply કરી નાખવું. લાગે તો natural, પણ સાવ ખોટું છે: multiplication એ row into column છે.
Trap 2: એમ માની લેવું કે AB = BA. મોટે ભાગે ખોટું, અને ઘણી વાર તો BA exist જ નથી કરતું: અહીં P·S કરવા માટે (2×1)·(2×2) જોઈએ, અંદરના numbers 1 ≠ 2. એટલે multiplication નો order બહુ મહત્વનો છે.
Theory
આ તમને ફરી ક્યાં મળશે
Excel નું SUMPRODUCT એ બરાબર એક row-into-column જ છે. Computer graphics દરેક pixel ને matrix products થી ખસેડે છે. Machine learning તો મોટે ભાગે તોતિંગ matrix multiplication જ છે. અને તમારા આગળના 2 topics, inverse અને Cramer's rule, એ ધારીને ચાલે છે કે આ page તમને પાણી પીવા જેવો સહેલો છે.
Summary
Key takeaways
- Addition અને subtraction માટે orders સરખા હોવા જોઈએ અને એ cell by cell થાય.
- Multiplication (m×n)·(n×p) માટે અંદરના numbers સરખા હોવા જોઈએ અને answer m×p આવે.
- દરેક product entry એટલે A નો એક row ને B ના એક column માં નાખવો: pairs ને multiply કરો, પછી add કરો.
- સામાન્ય રીતે AB ≠ BA; ક્યારેક તો BA defined પણ નથી હોતું.
- Sales matrix × price column = revenue, એટલે એક bill પોતે જ એક matrix product છે.
- યાદ રાખવાની trick: add કરવા same order, multiply કરવા inner match, અને row into column.