---
# System prepended metadata

title: Linear Algebra - Matrix Operations
tags: [Linear Algebra]

---

# Linear Algebra - Matrix Operations
## Simple operations
### Matrix addition
I think most of us learnt it in high school, so let's just give an example.
:::info
what is result of $\left[ {\begin{array}{cc}
    1 & 2 & 3\\
    4 & 5 & 6 \\
  \end{array} } \right]+
  \left[ {\begin{array}{cc}
    1 & 3 & 5\\
    2 & 4 & 6 \\
  \end{array} } \right]$?
:::
:::spoiler
$\left[ {\begin{array}{cc}
    2 & 5 & 8\\
    6 & 9 & 12 \\
  \end{array} } \right]$
:::
### Scalar Multiplication
Same as previous point.
:::info
what is result of $5\left[ {\begin{array}{cc}
    1 & 2 & 3\\
    4 & 5 & 6 \\
  \end{array} } \right]$?
:::
:::spoiler
$\left[ {\begin{array}{cc}
    5 & 10 & 15\\
    20 & 25 & 30 \\
  \end{array} } \right]$
:::
### Matrix-Matrix Multiplication
Same as previous point.
:::info
what is result of $\left[ {\begin{array}{cc}
    1 & 2 & 3\\
    4 & 5 & 6 \\
  \end{array} } \right]
  \left[ {\begin{array}{cc}
    1 & 0 \\
    0 & 1 \\
    1 & 0 \\
  \end{array} } \right]$?
:::
:::spoiler
$\left[ {\begin{array}{cc}
    4 & 2\\
    10 & 5\\
  \end{array} } \right]$
:::
## Matrix Transpose
In linear algebra, the transpose of a matrix is an operator which flips a matrix over its diagonal; that is, i**t switches the row and column indices of the matrix** A by producing another matrix.
:::info
what is result of $\left[ {\begin{array}{cc}
    1 & 2 & 3\\
    4 & 5 & 6 \\
  \end{array} } \right]^T$?
:::
:::spoiler
$\left[ {\begin{array}{cc}
    1 & 4\\
    2 & 5\\
    3 & 6\\
  \end{array} } \right]$
:::
### symmetric matrix
#### Defnition
$A=A^T$, $A$ is a symmetric matrix. 
> For example:
> $\left[ {\begin{array}{cc}
    1 & 2 & 3\\
    2 & 5 & 4 \\
    3 & 4 & 6 \\
  \end{array} } \right]^T=\left[ {\begin{array}{cc}
    1 & 2 & 3\\
    2 & 5 & 4 \\
    3 & 4 & 6 \\
  \end{array} } \right]$
### skew-symmetric matrix
$-A=A^T$, $A$ is a skew-symmetric matrix. 
> For example:
> $A=\left[ {\begin{array}{cc}
    0 & -2 & 3\\
    2 & 0 & 4 \\
    -3 & -4 & 0 \\
  \end{array} } \right]$ then, $A^T=\left[ {\begin{array}{cc}
    0 & 2 & -3\\
    -2 & 0 & -4 \\
    3 & 4 & 0 \\
  \end{array} } \right]=-A$, so A is skew-symmetric matrix.

* if $A^T=A=-A^T$, $A=0$
### Express matrix in sum of symmetric matrix and skew-symmetric matrix
symmetric matrix part : $\frac{1}{2}(A+A^T)$
skew-symmetric matrix part : $\frac{1}{2}(A-A^T)$

$A=\frac{1}{2}(A+A^T)+\frac{1}{2}(A-A^T)$

## Linear Transformation
### Defnition
A linear transformation is a function that maps one vector space to another while preserving the underlying linear structure of each vector space.
> For example:
> In vector space $\mathbb{R}^2$, we can implement linear transformation to rotate $\mathbb{R}^2$ counterclockwise through $\theta$ degree with matrix.
> $\left[ {\begin{array}{cc}
    cos(\theta) & -sin(\theta) \\
    sin(\theta) & cos(\theta) \\
  \end{array} } \right]x, x\in \mathbb{R}^2$.
:::info
rotate $\left[ {\begin{array}{cc} 0\\1 \end{array} } \right]$,$\left[ {\begin{array}{cc} 1\\0 \end{array} } \right]$,$\left[ {\begin{array}{cc} 3\\4 \end{array} } \right]$ counterclockwise through 90 degree with linear transformation matrix.
:::
:::spoiler
$\left[ {\begin{array}{cc}
    cos(\frac{\pi}{2}) & -sin(\frac{\pi}{2}) \\
    sin(\frac{\pi}{2}) & cos(\frac{\pi}{2}) \\
  \end{array} } \right]=\left[ {\begin{array}{cc}
    0 & -1 \\
    1 & 0 \\
  \end{array} } \right]$
  
  $\left[ {\begin{array}{cc}
    0 & -1 \\
    1 & 0 \\
  \end{array} } \right]\left[ {\begin{array}{cc}
    0 & 1 & 3 \\
    1 & 0 & 4\\
  \end{array} } \right]=\left[ {\begin{array}{cc}
    -1 & 0 & -4 \\
    0 & 1 & 3\\
  \end{array} } \right]$
:::
### Elementary Matrix
