4.5.7 · D3 · Maths › Linear Algebra (Full) › Matrix multiplication — definition, associativity, non-commu
Intuition Yeh page kya hai
Parent note ne tumhe rule bataya tha (row-dots-column) aur teen bade facts (composition, associativity, non-commutativity). Yeh page har tarah ki matrix us rule pe throw karta hai — square, rectangular, zero, identity, non-commuting, order-reversing inverses — aur har ek ko last number tak work out karta hai. Yahan tumhe koi aisa case nahi milega jo tumne solve hote na dekha ho.
Koi symbol samajh nahi aaya? Use neeche use hone se pehle rebuild kiya gaya hai.
Definition Vocabulary, plain words mein
Matrix ek rectangular grid of numbers hai. Hum kehte hain yeh m × n hai, matlab m rows tall, n columns wide (rows pehle, hamesha).
Vector , likha jaata hai x (bold letter), bas numbers ki ek list hai jo ek single column mein stack ki gayi hoti hai — yaani ek matrix jisme ek column ho. For example x = ( 4 − 2 ) ek 2 × 1 matrix hai; iske entries hain x 1 = 4 , x 2 = − 2 . Ise origin se point ( 4 , − 2 ) tak ek arrow ki tarah picture karo.
Matrix acting on a vector , likha jaata hai A x , bas product rule hai jisme B ki jagah one-column matrix x hai: answer ka entry i hai (row i of A ) dotted with x , yaani ( A x ) i = ∑ k A ik x k . Geometrically A arrow x ko move karke ek naye arrow mein le jaata hai — yeh transformation picture hai.
A ij ka matlab hai "matrix A ke row i , column j mein jo number hai". Row index pehle, column index baad mein.
∑ k = 1 n (ek sum ) shorthand hai "jaise k 1 , 2 , … , n tak run kare, agle expression ko add karte jao". Toh ∑ k = 1 3 x k = x 1 + x 2 + x 3 . Yeh bas ek adding machine hai counter k ke saath.
Product C = A B ke entries hain C ij = ∑ k = 1 n A ik B k j — A ki row i ko B ke column j ke across slide karo, matching numbers ko multiply karo, add karo . Yeh us row aur us column ka ek Dot Product hi hai.
I (identity ) "do-nothing" matrix hai: diagonal pe 1 's, baaki jagah 0 's. I A = A I = A . Dekho Identity and Inverse Matrices .
0 (zero matrix ) woh grid hai jiske har entry 0 hai. Boldface isliye likha hai taaki plain number 0 se alag dikhe. Ise add karne se kuch nahi badlta; map ki tarah yeh har arrow ko origin pe bhej deta hai.
A ⊤ (transpose , padha jaata hai "A-transpose") woh matrix hai jo tumhe A ko uske diagonal ke across flip karke milta hai — row i column i ban jaata hai. Toh A ⊤ ke row i , column j wala entry hai A j i . Dekho Transpose .
[ A , B ] := A B − B A (commutator ) yeh measure karta hai ki order kitna matter karta hai : yeh zero matrix hota hai exactly tab jab A B = B A .
Baaki sab aate aate earn hoga.
Har product in cells mein se kisi ek mein aata hai. Neeche ke examples ko un cell(s) ke saath label kiya gaya hai jo wo cover karte hain, taaki tum check kar sako ki poora grid fill ho gaya hai.
Cell
Situation
Kya trip kar sakta hai
Example
A
Square × square (dono 2 × 2 )
row·column ki mechanics
E1
B
Rectangular, shapes align karti hain
3-term sum; result shape
E2
C
Shapes align nahi karti
product undefined hai
E3
D
Identity I se multiply karo
I kuch nahi badlta
E4
E
Zero matrix / zero divisors
A B = 0 jabki A , B = 0
E5
F
Order matters: A B = B A
composition ki geometry
E6
G
Associativity ( A B ) C = A ( B C )
bracketing free hai; cost differ karti hai
E7
H
Inverse of a product
order reverse hota hai
E8
I
Word problem (real world)
chain ko matrix ki tarah padhna
E9
J
Exam twist: ( A + B ) 2
binomial trap
E10
Sign cases (positive, negative, zero entries) puri jagah aate hain — E1, E2 aur E6 sab mein negatives hain toh koi sign na dekha reh jaaye.
2 × 2 matrices multiply karo
A = ( 2 0 − 1 3 ) , B = ( 4 − 2 5 1 ) . Find A B .
Forecast: compute karne se pehle guess karo — kya top-left entry positive hogi ya negative? (Row ( 2 , − 1 ) against column ( 4 , − 2 ) .)
Step 1 — shapes check karo. Yeh step kyun? Product tabhi exist karta hai jab inner dimensions match karein. A hai 2 × 2 , B hai 2 × 2 : inner dims 2 = 2 ✓, result hai 2 × 2 .
Step 2 — top-left ( A B ) 11 : row 1 of A · column 1 of B . Kyun? ( A B ) ij hamesha row i dotted with column j hota hai.
( A B ) 11 = 2 ⋅ 4 + ( − 1 ) ⋅ ( − 2 ) = 8 + 2 = 10.
Positive — do negatives multiply hokar + 2 bane. (Forecast check!)
Step 3 — baaki entries, same recipe.
( A B ) 12 = 2 ⋅ 5 + ( − 1 ) ⋅ 1 = 9 , ( A B ) 21 = 0 ⋅ 4 + 3 ⋅ ( − 2 ) = − 6 , ( A B ) 22 = 0 ⋅ 5 + 3 ⋅ 1 = 3.
A B = ( 10 − 6 9 3 ) .
Verify: column view — A B ka column 1, A ko vector v = ( 4 − 2 ) (B ka column 1) pe act karte hue milna chahiye: A v = ( 2 ⋅ 4 − 1 ⋅ ( − 2 ) 0 ⋅ 4 + 3 ⋅ ( − 2 ) ) = ( 10 − 6 ) ✓ column 1 se match karta hai.
2 × 3 times ek 3 × 2
A = ( 1 3 − 2 1 0 − 1 ) , B = 2 − 1 5 0 4 1 .
Forecast: A B ka shape kya hoga? (Outer dimensions.)
Step 1 — shapes. Kyun? Inner dims: A hai 2 × 3 , B hai 3 × 2 , 3 = 3 ✓. Outer dims 2 aur 2 ⟹ result hai 2 × 2 . (Forecast: 2 × 2 .)
Step 2 — har entry ab k = 1 , 2 , 3 pe sum karti hai. Teen terms kyun? Kyunki shared dimension 3 hai; sum ∑ k = 1 3 teeno pe run karta hai.
( A B ) 11 = 1 ⋅ 2 + ( − 2 ) ( − 1 ) + 0 ⋅ 5 = 2 + 2 + 0 = 4.
( A B ) 12 = 1 ⋅ 0 + ( − 2 ) ⋅ 4 + 0 ⋅ 1 = − 8.
( A B ) 21 = 3 ⋅ 2 + 1 ⋅ ( − 1 ) + ( − 1 ) ⋅ 5 = 6 − 1 − 5 = 0.
( A B ) 22 = 3 ⋅ 0 + 1 ⋅ 4 + ( − 1 ) ⋅ 1 = 3.
A B = ( 4 0 − 8 3 ) .
Verify: yahan B A defined hai (yeh 3 × 3 hai), lekin iska A B se different shape hai (jo 2 × 2 hai), toh dono kabhi equal nahi ho sakte — yeh non-commutativity ka shape-mismatch flavor hai. (E3 se contrast karo, jahan product genuinely undefined hai; yahan B A defined hai, bas different size ka.)
Worked example Jab product exist hi nahi karta
A = ( 1 3 2 4 ) ( 2 × 2 ) , B = 1 2 0 0 1 3 5 0 1 ( 3 × 3 ) . Find A B .
Forecast: kya yeh product exist bhi karta hai?
Step 1 — inner dimensions line up karo. Kyun? Rule ko chahiye (columns of A ) = (rows of B ) taaki A ki ek row aur B ka ek column dot karne ke liye same length ke hon.
A mein 2 columns hain; B mein 3 rows hain. 2 = 3 .
Step 2 — conclusion. A ki ek row mein 2 numbers hain, B ke ek column mein 3 numbers hain — missing slot ke liye koi matching term nahi hai, toh dot product undefined hai. A B exist nahi karta.
Verify: reverse, B A , ke liye columns of B (= 3 ) ko rows of A (= 2 ) ke equal chahiye: woh bhi 3 = 2 hai, toh B A bhi undefined hai. Dono directions blocked — ek genuine dead cell.
I se multiply karna
M = ( 7 2 − 3 5 ) , I = ( 1 0 0 1 ) . Find I M and M I .
Forecast: koi bhi arithmetic karne se pehle answer guess karo.
Step 1 — I M compute karo. I kyun kaam karta hai: I ki row 1 hai ( 1 , 0 ) , toh yeh exactly M ki row 1 pick karta hai aur baaki ko kill kar deta hai.
( I M ) 11 = 1 ⋅ 7 + 0 ⋅ 2 = 7 , ( I M ) 12 = 1 ⋅ ( − 3 ) + 0 ⋅ 5 = − 3 , ⋯ ⇒ I M = M .
Step 2 — M I compute karo. Yeh kyun kaam karta hai: yaad karo ek matrix vector pe act karke columns ka combination return karti hai; yahan I ka column 1 vector ( 1 0 ) hai, aur M us pe act karke M ka column 1 wapas laata hai untouched. Column 2 ke liye bhi same. Hence M I = M .
Verify: dono ( 7 2 − 3 5 ) dete hain. I "do-nothing" map hai, toh iske saath compose karne se map untouched rehta hai — dekho Identity and Inverse Matrices .
Worked example Ek nonzero matrix zero tak square karti hai
N = ( 0 0 1 0 ) . Find N 2 .
(Symbols list se 0 yaad karo: boldface zero matrix, sab entries 0 .)
Forecast: ordinary numbers ke liye, x 2 = 0 ⇒ x = 0 . Kya tumhe yahan bhi same expect hai?
Step 1 — N 2 = N N compute karo. Yeh step kyun? Kisi matrix ko "squaring" karna matlab us matrix ka apne aap se product hai, toh hum wahi row·column rule apply karte hain jisme dono factors N ke equal hain.
( N 2 ) 11 = 0 ⋅ 0 + 1 ⋅ 0 = 0 , ( N 2 ) 12 = 0 ⋅ 1 + 1 ⋅ 0 = 0 , ( N 2 ) 21 = 0 , ( N 2 ) 22 = 0.
N 2 = ( 0 0 0 0 ) = 0 .
Step 2 — interpret karo. Yeh possible kyun hai: map ki tarah, N sab kuch ek line pe collapse karta hai phir next application pe origin pe. Matrices mein hote hain zero divisors : N = 0 yet N 2 = 0 .
Verify: toh numbers se aaya instinct "A B = 0 ⇒ A = 0 or B = 0 " matrices ke liye fail karta hai — yeh single counterexample se confirm ho gaya.
Worked example Rotate-then-flip vs flip-then-rotate
R = ( 0 1 − 1 0 ) (9 0 ∘ anticlockwise rotate), F = ( 1 0 0 − 1 ) (y -axis flip). R F aur F R find karo, jahan hum vector x = ( 1 0 ) (point ( 1 , 0 ) tak arrow) track kar rahe hain.
Forecast: point ( 1 , 0 ) "F then R " ke under kahaan land karta hai vs "R then F " ke under? Predict karo, phir padhna jari rakho.
Figure — kya dekh rahe ho. Gray arrow starting point ( 1 , 0 ) hai. Blue arrow dikhata hai kahan land hota hai R F ke under (pehle flip, phir rotate): seedha upar ( 0 , 1 ) pe. Orange arrow dikhata hai F R (pehle rotate, phir flip): seedha neeche ( 0 , − 1 ) pe. Same start, do alag endpoints — blue aur orange ke beech woh gap exactly woh non-commutativity hai jo hum neeche compute karte hain.
Step 1 — R F compute karo (yeh hai "F pehle, phir R ", kyunki kisi bhi vector x pe act karne se ( R F ) x = R ( F x ) milta hai — x ke sabse nazdeek wali matrix pehle act karti hai).
R F = ( 0 1 − 1 0 ) ( 1 0 0 − 1 ) = ( 0 1 1 0 ) .
Sabse right wali matrix pehle kyun act karti hai: x pehle F se milta hai, uska output R se milta hai.
Step 2 — F R compute karo ("R pehle, phir F ").
F R = ( 1 0 0 − 1 ) ( 0 1 − 1 0 ) = ( 0 − 1 − 1 0 ) .
Step 3 — x = ( 1 0 ) track karo (figure dekho). R F ke under: ( 0 1 1 0 ) ( 1 0 ) = ( 0 1 ) (upar, blue arrow). F R ke under: ( 0 − 1 − 1 0 ) ( 1 0 ) = ( 0 − 1 ) (neeche, orange arrow). Alag landing points.
Verify: R F − F R = ( 0 2 2 0 ) = 0 , toh commutator [ R , F ] = 0 : order genuinely count karta hai. Dekho Linear Transformations .
Worked example Check karo
( A B ) C = A ( B C )
A = ( 1 0 2 1 ) , B = ( 1 3 0 1 ) , C = ( 2 1 1 0 ) .
Forecast: dono bracketings same matrix deni chahiye. Guess karo ki kya unki effort bhi same hogi.
Step 1 — left grouping. Yahan se kyun shuru karein: ( A B ) C compute karne ke liye pehle inner product A B form karna hoga, phir result ko C se multiply karna hoga. A B = ( 1 ⋅ 1 + 2 ⋅ 3 0 ⋅ 1 + 1 ⋅ 3 1 ⋅ 0 + 2 ⋅ 1 0 ⋅ 0 + 1 ⋅ 1 ) = ( 7 3 2 1 ) .
Phir ( A B ) C = ( 7 3 2 1 ) ( 2 1 1 0 ) = ( 16 7 7 3 ) .
Step 2 — right grouping. Doosre taraf grouped karke redo kyun: poora point yeh test karna hai ki bracket position answer change karta hai ya nahi, toh ab pehle inner product B C form karte hain. B C = ( 1 ⋅ 2 + 0 ⋅ 1 3 ⋅ 2 + 1 ⋅ 1 1 ⋅ 1 + 0 ⋅ 0 3 ⋅ 1 + 1 ⋅ 0 ) = ( 2 7 1 3 ) .
Phir A ( B C ) = ( 1 0 2 1 ) ( 2 7 1 3 ) = ( 16 7 7 3 ) .
Step 3 — compare karo. Identical. Guaranteed kyun: dono sides maps ko kisi bhi vector pe same order C , B , A mein apply karti hain. Entrywise, dono sides same triple sum ke equal hain
( ( A B ) C ) i ℓ = ( A ( B C ) ) i ℓ = ∑ k ∑ j A ik B k j C j ℓ ,
jahan — apna index convention yaad karo (row pehle, column baad mein ) — i final matrix ka output row hai, ℓ output column hai, jabki k aur j woh do inner indices hain jo sum mein chale jaate hain.
Verify: dono equal hain ( 16 7 7 3 ) ✓. (Note: tall/thin matrices ke liye ek bracketing kaafi sasti ho sakti hai — associativity tumhe choose karne deta hai.)
( A B ) − 1 = B − 1 A − 1
A = ( 1 0 1 1 ) , B = ( 1 2 0 1 ) . Verify karo ( A B ) − 1 = B − 1 A − 1 , aur dikhao ki A − 1 B − 1 galat hai.
Forecast: "socks then shoes" — undo karne ke liye, pehle kya utarta hai?
Step 1 — har ek ke inverses. Yeh kyun: A + 1 se shear karta hai, iska inverse − 1 se shear karta hai: A − 1 = ( 1 0 − 1 1 ) . Similarly B − 1 = ( 1 − 2 0 1 ) .
Step 2 — A B form karo. Yeh step kyun: ( A B ) − 1 ki baat karne ke liye pehle actual matrix A B chahiye taaki baad mein confirm kar sakein ki candidate inverse ise multiply karke I deta hai. A B = ( 1 0 1 1 ) ( 1 2 0 1 ) = ( 3 2 1 1 ) .
Step 3 — B − 1 A − 1 ko A B ke against test karo. Yeh order kyun: "B then A " undo karne ke liye pehle A undo karna hoga.
B − 1 A − 1 = ( 1 − 2 0 1 ) ( 1 0 − 1 1 ) = ( 1 − 2 − 1 3 ) .
Multiply karo: ( A B ) ( B − 1 A − 1 ) = ( 3 2 1 1 ) ( 1 − 2 − 1 3 ) = ( 1 0 0 1 ) = I ✓.
Step 4 — galat order. A − 1 B − 1 = ( 1 0 − 1 1 ) ( 1 − 2 0 1 ) = ( 3 − 2 − 1 1 ) , aur ( A B ) ( A − 1 B − 1 ) = ( 7 4 − 2 − 1 ) = I .
Verify: sirf B − 1 A − 1 hi I deta hai — order reverse hota hai. Transpose A ⊤ (diagonal ke across flip, symbols list mein defined) bhi same tarah reverse karta hai: ( A B ) ⊤ = B ⊤ A ⊤ . Dekho Identity and Inverse Matrices aur Transpose .
Worked example Two-stage supply chain
Ek factory raw materials ko parts mein badlti hai, aur parts ko products mein. Rows outputs hain, columns inputs hain.
Parts-per-product: P = ( 2 0 1 3 ) (rows = part A, part B; cols = product 1, product 2). Materials-per-part: M = ( 1 5 4 0 ) (rows = wood, steel; cols = part A, part B).
Question: har product ko kitna wood aur steel chahiye?
Forecast: kaun sa product, M P ya P M , "materials per product" ka jawab deta hai?
Step 1 — maps ko chain karo. M P kyun: hum chahte hain materials←parts←products, yaani pehle "products→parts" (P ) karo, phir "parts→materials" (M ). Composition order baad wale stage ko left pe rakhta hai, M P deta hai.
M P = ( 1 5 4 0 ) ( 2 0 1 3 ) = ( 1 ⋅ 2 + 4 ⋅ 0 5 ⋅ 2 + 0 ⋅ 0 1 ⋅ 1 + 4 ⋅ 3 5 ⋅ 1 + 0 ⋅ 3 ) = ( 2 10 13 5 ) .
Step 2 — read off karo (units ke saath!). Column j product j hai; row 1 wood hai, row 2 steel hai. Toh product 1 ko 2 wood aur 10 steel chahiye; product 2 ko 13 wood aur 5 steel chahiye.
Verify (sanity + units). Product 1, part A ke 2 aur part B ke 0 use karta hai. Part A akele 1 wood aur 5 steel maangta hai, toh uske 2 , 2 wood aur 10 steel maangenge — column 1 se match karta hai ✓. Har number units carry karta hai (material units)/(product), dimensionally consistent. (Note: P M ek alag sawaal ka jawab deta aur generally differ karta — order phir se count karta hai.)
Worked example Matrix square sahi se expand karo
A = ( 1 0 1 1 ) , B = ( 1 1 0 1 ) . Compute karo ( A + B ) 2 aur (galat) A 2 + 2 A B + B 2 se compare karo.
Forecast: numbers ke liye ( a + b ) 2 = a 2 + 2 ab + b 2 . Kya middle term yahan bhi 2 A B hogi?
Step 1 — honest expansion. 2 A B kyun nahi: ( A + B ) 2 = ( A + B ) ( A + B ) = A 2 + A B + B A + B 2 ; tum sirf tab A B + B A → 2 A B merge kar sakte ho agar A B = B A ho.
Step 2 — direct compute. A + B = ( 2 1 1 2 ) , toh
( A + B ) 2 = ( 2 1 1 2 ) ( 2 1 1 2 ) = ( 5 4 4 5 ) .
Step 3 — pieces. A 2 = ( 1 0 2 1 ) , B 2 = ( 1 2 0 1 ) , A B = ( 2 1 1 1 ) , B A = ( 1 1 1 2 ) .
Correct sum: A 2 + A B + B A + B 2 = ( 5 4 4 5 ) ✓.
Galat formula: A 2 + 2 A B + B 2 = ( 6 4 4 4 ) = ( A + B ) 2 .
Verify: honest expansion match karta hai; binomial shortcut off hai kyunki commutator nonzero hai:
[ A , B ] = A B − B A = ( 2 1 1 1 ) − ( 1 1 1 2 ) = ( 1 0 0 − 1 ) = 0 .
Kyunki [ A , B ] = 0 hai, matrices commute nahi karti, toh A B + B A = 2 A B aur binomial shortcut fail hona hi tha — exactly jaisa humne dekha.
Mnemonic Scenario checklist
S-Z-I-O-A : S hapes (kya inner dims match karti hain?), Z ero divisors (product vanish ho sakta hai), I dentity (kuch nahi karta), O rder counts (A B = B A , inverses reverse hote hain), A ssociativity (brackets free hain).
Row i of A against column j of B se kaun sa entry milta hai? ( A B ) ij , dot product ∑ k A ik B k j .
A hai 2 × 3 , B hai 3 × 3 — kya A B defined hai, aur kya shape hai?Haan, inner dims 3 = 3 ; result hai 2 × 3 .
A hai 2 × 2 , B hai 3 × 3 — kya A B defined hai?Nahi; A ke columns (2 ) ≠ B ke rows (3 ).
Kya ek nonzero matrix zero matrix 0 tak square ho sakti hai? Haan — e.g. ( 0 0 1 0 ) 2 = 0 (zero divisors).
"Apply B then A " undo karne ke liye, pehle kaun sa inverse act karta hai? A − 1 : ( A B ) − 1 = B − 1 A − 1 .
Generally ( A + B ) 2 = A 2 + 2 A B + B 2 kyun hai? Cross terms hain A B + B A , jo sirf tab 2 A B mein merge hote hain jab A , B commute karein.
Supply-chain problem mein, kaun sa product materials-per-product deta hai? M P — pehle products→parts (P ), phir parts→materials (M ).
Each entry is a dot product
Undefined if inner dims differ
Inverse reverses B inv A inv
Zero divisors AB can be zero