<aside> <img src="/icons/reorder_gray.svg" alt="/icons/reorder_gray.svg" width="40px" />

Table of Contents

</aside>

Definition


image.png

A matix is a two dimensional array consisting of rows($m$) and columns($n$).

Expression

For example, Here is two matrix.

$$

A = \begin{bmatrix} a_{11} & a_{12} & a_{13} \\ a_{21} & a_{22} & a_{23} \\ a_{31} & a_{32} & a_{33} \end{bmatrix}

$$

$$

B = \begin{bmatrix} b_{11} & b_{12} \\ b_{21} & b_{22} \\ b_{31} & b_{32} \end{bmatrix}

$$

It can identify a matrix element using double subscript notation.

$$

x_{mn} $$

Let’s create two matrix examples using Python.

<aside> <img src="/icons/code_gray.svg" alt="/icons/code_gray.svg" width="40px" />

Python - Numpy

행렬과 같은 다차원 배열을 사용할 때에는 파이썬의 넘파이가 적합합니다.

import numpy as np

넘파이를 통해 실습해보도록 합시다.

</aside>

A = np.array([[1,2,3],
              [4,5,6],
              [7,8,9]])
              
B = np.array([[1,2],
              [3,4], 
              [5,6]])

print(A)
print(B)

When executed, this code will output like that.

# A
[[1 2 3]
 [4 5 6]
 [7 8 9]]
 
# B
[[1 2]
 [3 4]
 [5 6]]

Special Matrix

$$

U = \begin{bmatrix} a_{1} & a_{2} & a_{3} \\ \end{bmatrix}

$$

$$

V = \begin{bmatrix} b_{1} \\ b_{2} \\ b_{3} \end{bmatrix}

$$

The matrices U, V are special matrices called row vectors and column vectors.

U = np.array([[1,2,3]])

V = np.array([[1],
              [2],
              [3]])
print(U)
print(V)

When executed, this code will output like that.

# U
[[1 2 3]]

# V
[[1]
 [2]
 [3]]