Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Aprenda Matrix Operations | Section
Python Math Module Essentials: Trigonometry, Logarithms, and Constants - 1769704232288

Matrix Operations

Deslize para mostrar o menu

Note
Definition

A matrix is a rectangular array of numbers arranged in rows and columns, used to represent and solve mathematical problems efficiently.

Before jumping into linear systems, like Ax=bA\vec{x} = \vec{b}, it's essential to understand how matrices behave and what operations we can perform on them.

Matrix Addition

You can add two matrices only if they have the same shape (same number of rows and columns).

Let:

A=[a11a12a21a22],B=[b11b12b21b22]A = \begin{bmatrix} a_{11} & a_{12} \\ a_{21} & a_{22} \end{bmatrix}, \quad B = \begin{bmatrix} b_{11} & b_{12} \\ b_{21} & b_{22} \end{bmatrix}

Then:

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

Scalar Multiplication

You can also multiply a matrix by a scalar (single number):

kA=[ka11ka12ka21ka22]k \cdot A = \begin{bmatrix} k a_{11} & k a_{12} \\ k a_{21} & k a_{22} \end{bmatrix}

Matrix Multiplication and Size Compatibility

Matrix multiplication is a row-by-column operation, not element-wise.

Rule: if matrix AA is of shape (m×n)(m \times n) and matrix BB is of shape (n×p)(n \times p), then:

  • The multiplication ABAB is valid;
  • The result will be a matrix of shape (m×p)(m \times p).

Example:

Let:

A=[1234],  B=[56]A = \begin{bmatrix} 1 & 2 \\ 3 & 4 \end{bmatrix}, \ \ B = \begin{bmatrix} 5 \\ 6 \end{bmatrix}

AA is (2×2)(2 \times 2) and BB is (2×1)(2 \times 1), then ABAB is valid and results in a (2×1)(2 \times 1) matrix:

AB=[15+2635+46]=[1739]A \cdot B = \begin{bmatrix} 1 \cdot 5 + 2 \cdot 6 \\ 3 \cdot 5 + 4 \cdot 6 \end{bmatrix} = \begin{bmatrix} 17 \\ 39 \end{bmatrix}

Transpose of a Matrix

The transpose of a matrix flips rows and columns. It is denoted as ATA^T.

Let:

A=[1234]A = \begin{bmatrix} 1 & 2 \\ 3 & 4 \end{bmatrix}

Then:

AT=[1324]A^T = \begin{bmatrix} 1 & 3 \\ 2 & 4 \end{bmatrix}

Properties:

  • (AT)T=A(A^T)^T = A;
  • (A+B)T=AT+BT(A + B)^T = A^T + B^T;
  • (AB)T=BTAT(AB)^T = B^T A^T.

Determinant of a Matrix

2×2 Matrix

For:

A=[abcd]A = \begin{bmatrix} a & b \\ c & d \end{bmatrix}

The determinant is:

det(A)=adbc\det(A) = ad - bc

3×3 Matrix

For:

A=[abcdefghi]A = \begin{bmatrix} a & b & c \\ d & e & f \\ g & h & i \end{bmatrix}

The determinant is:

det(A)=a(eifh)b(difg)+c(dheg)\det(A) = a(ei - fh) - b(di - fg) + c(dh - eg)

This method is called cofactor expansion.

  • Larger matrices (4×4 and up) can be expanded recursively.
  • The determinant is useful because it indicates whether a matrix has an inverse (non-zero determinant).

Inverse of a Matrix

The inverse of a square matrix AA is denoted as A1A^{-1}. It satisfies AA1=IA \cdot A^{-1} = I, where II is the identity matrix.

Only square matrices with non-zero determinant have an inverse.

Example:

If matrix A is:

A=[abcd]A = \begin{bmatrix} a & b \\ c & d \end{bmatrix}

Then its inverse matrix A1A^{-1} is:

A1=1det(A)[dbca]A^{-1} = \frac{1}{\det(A)} \begin{bmatrix} d & -b \\ -c & a \end{bmatrix}

Where det(A)0\det(A) \neq 0.

question mark

What is the transpose of [1234]\begin{bmatrix}1 & 2 \\3 & 4\end{bmatrix} matrix?

Selecione a resposta correta

Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

Seção 1. Capítulo 30

Pergunte à IA

expand

Pergunte à IA

ChatGPT

Pergunte o que quiser ou experimente uma das perguntas sugeridas para iniciar nosso bate-papo

Seção 1. Capítulo 30
some-alt