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=[1324] and B=[5768].
A+B=[1+53+72+64+8]=[610812]
A−B=[1−53−72−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[1324]=[3(1)3(3)3(2)3(4)]=[39612]
Example: Combining Operations
Let's compute 3A−2B using the matrices above.
First, find 2B:
2B=2[5768]=[10141216]
Now, subtract 2B from 3A:
3A−2B=[39612]−[10141216]=[−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=[1324],B=[5768]
AB=[(1)(5)+(2)(7)(3)(5)+(4)(7)(1)(6)+(2)(8)(3)(6)+(4)(8)]
AB=[5+1415+286+1618+32]=[19432250]
Now, let's calculate BA:
BA=[5768][1324]
BA=[(5)(1)+(6)(3)(7)(1)+(8)(3)(5)(2)+(6)(4)(7)(2)+(8)(4)]
BA=[5+187+2410+2414+32]=[23313446]
Important Note: Notice that AB=BA. Unlike regular numbers where 2×3=3×2, matrix multiplication is not commutative.