Matrix Operations and Applications

Perform matrix addition, multiplication, find determinants and inverses, and solve systems using matrices.

Matrix Operations and Applications

Introduction to Matrices

A matrix is a rectangular array of numbers arranged in rows and columns.

A=[a11a12a13a21a22a23]A = \begin{bmatrix} a_{11} & a_{12} & a_{13} \\ a_{21} & a_{22} & a_{23} \end{bmatrix}

This is a 2×32 \times 3 matrix (2 rows, 3 columns).

Matrix Notation

  • Dimension: m×nm \times n (m rows, n columns)
  • Element: aija_{ij} is the element in row ii, column jj
  • Square matrix: m=nm = n (same number of rows and columns)

Matrix Addition and Subtraction

Matrices can be added or subtracted only if they have the same dimensions.

A+B=[a11a12a21a22]+[b11b12b21b22]=[a11+b11a12+b12a21+b21a22+b22]A + B = \begin{bmatrix} a_{11} & a_{12} \\ a_{21} & a_{22} \end{bmatrix} + \begin{bmatrix} b_{11} & b_{12} \\ b_{21} & b_{22} \end{bmatrix} = \begin{bmatrix} a_{11}+b_{11} & a_{12}+b_{12} \\ a_{21}+b_{21} & a_{22}+b_{22} \end{bmatrix}

Properties:

  • Commutative: A+B=B+AA + B = B + A
  • Associative: (A+B)+C=A+(B+C)(A + B) + C = A + (B + C)
  • Identity: A+O=AA + O = A (where OO is the zero matrix)

Scalar Multiplication

Multiply each element by the scalar:

cA=c[a11a12a21a22]=[ca11ca12ca21ca22]cA = c\begin{bmatrix} a_{11} & a_{12} \\ a_{21} & a_{22} \end{bmatrix} = \begin{bmatrix} ca_{11} & ca_{12} \\ ca_{21} & ca_{22} \end{bmatrix}

Matrix Multiplication

For Am×nA_{m \times n} and Bn×pB_{n \times p}, the product ABAB is an m×pm \times p matrix.

Note: The number of columns in AA must equal the number of rows in BB.

The element in row ii, column jj of ABAB is: (AB)ij=k=1naikbkj(AB)_{ij} = \sum_{k=1}^{n} a_{ik}b_{kj}

Example (2×2 matrices):

[abcd][efgh]=[ae+bgaf+bhce+dgcf+dh]\begin{bmatrix} a & b \\ c & d \end{bmatrix} \begin{bmatrix} e & f \\ g & h \end{bmatrix} = \begin{bmatrix} ae+bg & af+bh \\ ce+dg & cf+dh \end{bmatrix}

Properties:

  • NOT commutative: ABBAAB \neq BA in general
  • Associative: (AB)C=A(BC)(AB)C = A(BC)
  • Distributive: A(B+C)=AB+ACA(B + C) = AB + AC

Identity Matrix

The identity matrix InI_n is an n×nn \times n matrix with 1s on the diagonal and 0s elsewhere:

I3=[100010001]I_3 = \begin{bmatrix} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{bmatrix}

Property: AI=IA=AAI = IA = A

Determinant (2×2 matrices)

For a 2×22 \times 2 matrix: det(A)=det[abcd]=adbc\det(A) = \det\begin{bmatrix} a & b \\ c & d \end{bmatrix} = ad - bc

Determinant (3×3 matrices)

For a 3×33 \times 3 matrix, use cofactor expansion: det[abcdefghi]=a(eifh)b(difg)+c(dheg)\det\begin{bmatrix} a & b & c \\ d & e & f \\ g & h & i \end{bmatrix} = a(ei-fh) - b(di-fg) + c(dh-eg)

Properties:

  • If det(A)=0\det(A) = 0, the matrix is singular (not invertible)
  • If det(A)0\det(A) \neq 0, the matrix is invertible
  • det(AB)=det(A)det(B)\det(AB) = \det(A) \cdot \det(B)

Matrix Inverse (2×2)

For A=[abcd]A = \begin{bmatrix} a & b \\ c & d \end{bmatrix}, if det(A)=adbc0\det(A) = ad - bc \neq 0:

A1=1adbc[dbca]A^{-1} = \frac{1}{ad-bc}\begin{bmatrix} d & -b \\ -c & a \end{bmatrix}

Property: AA1=A1A=IAA^{-1} = A^{-1}A = I

Solving Systems with Matrices

A system of linear equations can be written as AX=BAX = B where:

  • AA is the coefficient matrix
  • XX is the variable matrix
  • BB is the constant matrix

Example:

{2x+3y=74xy=5\begin{cases} 2x + 3y = 7 \\ 4x - y = 5 \end{cases}

Can be written as: [2341][xy]=[75]\begin{bmatrix} 2 & 3 \\ 4 & -1 \end{bmatrix} \begin{bmatrix} x \\ y \end{bmatrix} = \begin{bmatrix} 7 \\ 5 \end{bmatrix}

Solution: X=A1BX = A^{-1}B (if AA is invertible)

Applications

  1. Systems of equations: Solve AX=BAX = B
  2. Transformations: Represent rotations, reflections, scaling
  3. Cryptography: Encode and decode messages
  4. Economics: Input-output models
  5. Computer graphics: 3D transformations

📚 Practice Problems

1Problem 1easy

Question:

Given A=[2134]A = \begin{bmatrix} 2 & -1 \\ 3 & 4 \end{bmatrix} and B=[1523]B = \begin{bmatrix} 1 & 5 \\ -2 & 3 \end{bmatrix}, find ABAB.

💡 Show Solution

Solution:

Given: A=[2134],B=[1523]A = \begin{bmatrix} 2 & -1 \\ 3 & 4 \end{bmatrix}, \quad B = \begin{bmatrix} 1 & 5 \\ -2 & 3 \end{bmatrix}

Matrix multiplication formula: For element (i,j)(i,j) in ABAB: multiply row ii of AA by column jj of BB.

Calculate each element:

First row, first column: (2)(1)+(1)(2)=2+2=4(2)(1) + (-1)(-2) = 2 + 2 = 4

First row, second column: (2)(5)+(1)(3)=103=7(2)(5) + (-1)(3) = 10 - 3 = 7

Second row, first column: (3)(1)+(4)(2)=38=5(3)(1) + (4)(-2) = 3 - 8 = -5

Second row, second column: (3)(5)+(4)(3)=15+12=27(3)(5) + (4)(3) = 15 + 12 = 27

Answer: AB=[47527]AB = \begin{bmatrix} 4 & 7 \\ -5 & 27 \end{bmatrix}

Note: Matrix multiplication is not commutative. BABA would give a different result!

2Problem 2medium

Question:

Find the inverse of A=[3254]A = \begin{bmatrix} 3 & 2 \\ 5 & 4 \end{bmatrix}.

💡 Show Solution

Solution:

Given: A=[3254]A = \begin{bmatrix} 3 & 2 \\ 5 & 4 \end{bmatrix}

Step 1: Calculate the determinant det(A)=(3)(4)(2)(5)=1210=2\det(A) = (3)(4) - (2)(5) = 12 - 10 = 2

Since det(A)=20\det(A) = 2 \neq 0, the matrix is invertible.

Step 2: Use the inverse formula for 2×2 matrices

For A=[abcd]A = \begin{bmatrix} a & b \\ c & d \end{bmatrix}: A1=1adbc[dbca]A^{-1} = \frac{1}{ad-bc}\begin{bmatrix} d & -b \\ -c & a \end{bmatrix}

Step 3: Apply the formula A1=12[4253]=[215232]A^{-1} = \frac{1}{2}\begin{bmatrix} 4 & -2 \\ -5 & 3 \end{bmatrix} = \begin{bmatrix} 2 & -1 \\ -\frac{5}{2} & \frac{3}{2} \end{bmatrix}

Answer: A1=[215232]A^{-1} = \begin{bmatrix} 2 & -1 \\ -\frac{5}{2} & \frac{3}{2} \end{bmatrix}

Verification: Check that AA1=IAA^{-1} = I [3254][215232]=[653+310105+6]=[1001]\begin{bmatrix} 3 & 2 \\ 5 & 4 \end{bmatrix} \begin{bmatrix} 2 & -1 \\ -\frac{5}{2} & \frac{3}{2} \end{bmatrix} = \begin{bmatrix} 6-5 & -3+3 \\ 10-10 & -5+6 \end{bmatrix} = \begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix}

3Problem 3hard

Question:

Use matrices to solve the system: {2x+y=53x2y=4\begin{cases} 2x + y = 5 \\ 3x - 2y = 4 \end{cases}

💡 Show Solution

Solution:

Step 1: Write in matrix form AX=BAX = B

[2132][xy]=[54]\begin{bmatrix} 2 & 1 \\ 3 & -2 \end{bmatrix} \begin{bmatrix} x \\ y \end{bmatrix} = \begin{bmatrix} 5 \\ 4 \end{bmatrix}

Where A=[2132]A = \begin{bmatrix} 2 & 1 \\ 3 & -2 \end{bmatrix}, X=[xy]X = \begin{bmatrix} x \\ y \end{bmatrix}, B=[54]B = \begin{bmatrix} 5 \\ 4 \end{bmatrix}

Step 2: Find A1A^{-1}

Calculate determinant: det(A)=(2)(2)(1)(3)=43=7\det(A) = (2)(-2) - (1)(3) = -4 - 3 = -7

Since det(A)0\det(A) \neq 0, AA is invertible.

A1=17[2132]=[27173727]A^{-1} = \frac{1}{-7}\begin{bmatrix} -2 & -1 \\ -3 & 2 \end{bmatrix} = \begin{bmatrix} \frac{2}{7} & \frac{1}{7} \\ \frac{3}{7} & -\frac{2}{7} \end{bmatrix}

Step 3: Solve X=A1BX = A^{-1}B

X=[27173727][54]X = \begin{bmatrix} \frac{2}{7} & \frac{1}{7} \\ \frac{3}{7} & -\frac{2}{7} \end{bmatrix} \begin{bmatrix} 5 \\ 4 \end{bmatrix}

X=[107+4715787]=[14777]=[21]X = \begin{bmatrix} \frac{10}{7} + \frac{4}{7} \\ \frac{15}{7} - \frac{8}{7} \end{bmatrix} = \begin{bmatrix} \frac{14}{7} \\ \frac{7}{7} \end{bmatrix} = \begin{bmatrix} 2 \\ 1 \end{bmatrix}

Answer: x=2x = 2, y=1y = 1

Verification:

  • 2(2)+1=52(2) + 1 = 5
  • 3(2)2(1)=62=43(2) - 2(1) = 6 - 2 = 4