Matrix Operations
Matrix Operations
A matrix is a rectangular array of numbers arranged in rows and columns. Just like ordinary numbers, matrices can be added, subtracted, and multiplied, but they follow a specific set of rules.
Addition and Subtraction
To add or subtract two matrices, they must have the exact same dimensions (same number of rows and columns). You simply add or subtract the corresponding elements in each position.
Let A=[13โ24โ] and B=[57โ68โ].
A+B=[1+53+7โ2+64+8โ]=[610โ812โ]
AโB=[1โ53โ7โ2โ64โ8โ]=[โ4โ4โโ4โ4โ]
Scalar Multiplication
Scalar multiplication involves multiplying a matrix by a single real number (called a scalar). To do this, multiply every single element inside the matrix by that scalar.
For example, to find 3A:
3A=3[13โ24โ]=[3(1)3(3)โ3(2)3(4)โ]=[39โ612โ]
Example: Combining Operations
Let's compute 3Aโ2B using the matrices above. First, find 2B: 2B=2[57โ68โ]=[1014โ1216โ]
Now, subtract 2B from 3A: 3Aโ2B=[39โ612โ]โ[1014โ1216โ]=[โ7โ5โโ6โ4โ]
Matrix Multiplication
Multiplying two matrices is more complex. To multiply matrix A by matrix B (to get AB), the number of columns in A must equal the number of rows in B. If A is an mรn matrix and B is an nรp matrix, the resulting matrix will have dimensions mรp.
To find an element in the resulting matrix, you compute the dot product of a row from the first matrix and a column from the second matrix.
Let's calculate AB: A=[13โ24โ],B=[57โ68โ]
AB=[(1)(5)+(2)(7)(3)(5)+(4)(7)โ(1)(6)+(2)(8)(3)(6)+(4)(8)โ]
AB=[5+1415+28โ6+1618+32โ]=[1943โ2250โ]
Now, let's calculate BA:
BA=[57โ68โ][13โ24โ]
BA=[(5)(1)+(6)(3)(7)(1)+(8)(3)โ(5)(2)+(6)(4)(7)(2)+(8)(4)โ]
BA=[5+187+24โ10+2414+32โ]=[2331โ3446โ]
Important Note: Notice that AB๎ =BA. Unlike regular numbers where 2ร3=3ร2, matrix multiplication is not commutative.