# Section 1.2 $\quad$ Matrices

## Definitions

- A rectangular array of $m\times n$ real or complex numbers arranged in $m$ horizontal **rows** and $n$ vertical **columns**:
$$
    A =
    \left[
      \begin{array}{cccc}
          a_{11} & a_{12} & \cdots & a_{1n} \\
          a_{21} & a_{22} & \cdots & a_{2n} \\
          \vdots & \vdots & \ddots & \vdots \\
          a_{m1} & a_{m2} & \cdots & a_{mn} \\
      \end{array}
    \right]\qquad\qquad (1)
$$
    is called an $\underline{\hspace{1.5in}}$. We say that the matrix $A$ is $\underline{\hspace{1in}}$.

- The $i$**th row** and the $j$**th column** of $A$ are <br /><br /><br /><br /><br /><br /><br />

- If $m=n$, we say that $A$ is a $\underline{\hspace{2in}}$, and that the numbers $a_{11}$, $a_{22}$, $\cdots$, $a_{nn}$ form the $\underline{\hspace{1in}}$ of $A$.

- The number $a_{ij}$ is called the $\underline{\hspace{1.5in}}$ of $A$, or the $\underline{\hspace{1.5in}}$ of $A$. We can write the matrix $A$ as <br /><br /><br /><br />

- An $n\times 1$ matrix is called an $\underline{\hspace{1.5in}}$ or a $\underline{\hspace{1.5in}}$ when $n$ is understood.

- Two $m\times n$ matrices $A = [a_{ij}]$ and $B = [b_{ij}]$ are **equal** if <br /><br /><br /><br /><br /><br /><br />

### Example 1

Examples of matrices
$$
  A = \left[
     \begin{array}{ccc}
       1 & 2 & 3 \\
     -1 & 0 & 1 \\
     \end{array}
   \right],\quad
  B = \left[
     \begin{array}{cc}
       1+i & 4i \\
       2-3i & -3 \\
     \end{array}
   \right],\quad
  C = \left[
     \begin{array}{c}
       1\\
       -1\\
       2 \\
     \end{array}
   \right].
$$

### Example 2

If
$$
  \left[
    \begin{array}{cc}
      a+2b & 2a-b \\
      2c+d & c-2d \\
    \end{array}
  \right] =
  \left[
    \begin{array}{cc}
      4 & -2 \\
      4 & -3 \\
    \end{array}
  \right]
$$
find $a,b,c$, and $d$.


```python
from sympy import *

a, b, c, d = symbols('a b c d');

eq1 = a + 2*b - 4;
eq2 = 2*a - b + 2;
eq3 = 2*c + d - 4;
eq4 = c - 2*d + 3;

solve([eq1, eq2, eq3, eq4], (a, b, c, d))
```




    {a: 0, d: 2, c: 1, b: 2}



## Matrix Operations

**Addition**: If $A = [a_{ij}]$ and $B = [b_{ij}]$ are both $m\times n$ matrices, then the **sum** $A+B$ is an $m\times n$ matrix $C = [c_{ij}]$ defined by <br /><br /><br /><br />

### Example 3

Let
$$
  A =
  \left[
    \begin{array}{ccc}
      1 & -2 & 3 \\
      2 & -1 & 4 \\
    \end{array}
  \right], ~~~~
  B =
  \left[
    \begin{array}{ccc}
      0 & 2 & 1 \\
      1 & 3 & -4 \\
    \end{array}
  \right].
$$
Then
$$
  A + B = \hspace{4in}
$$


```python
from sympy import *

A = Matrix([[1, -2, 3], [2, -1, 4]]);
B = Matrix([[0, 2, 1], [1, 3, -4]]);

A + B
```




    Matrix([
    [1, 0, 4],
    [3, 2, 0]])



**Remark:** the sum of $A$ and $B$ is defined only when $\underline{\hspace{3in}}$.

## Scalar Multiplication

If $A = [a_{ij}]$ is an $m\times n$ matrix and $r$ is a real number, then the **scalar multiple** of $A$ by $r$ is an $m\times n$ matrix $C = [c_{ij}]$ where <br /><br /><br /><br />

### Example 4

Let
$$
  A =
  \left[
    \begin{array}{ccc}
      1 & -2 & 3 \\
      2 & -1 & 4 \\
    \end{array}
  \right], ~~~~
  B =
  \left[
    \begin{array}{ccc}
      0 & 2 & 1 \\
      1 & 3 & -4 \\
    \end{array}
  \right].
$$
Then
$$
  5A = \hspace{4in}
$$
$$
  A-B = \hspace{4in}                 
$$


```python
from sympy import *

A = Matrix([[1, -2, 3], [2, -1, 4]]);
B = Matrix([[0, 2, 1], [1, 3, -4]]);

5*A
```




    Matrix([
    [ 5, -10, 15],
    [10,  -5, 20]])




```python
from sympy import *

A = Matrix([[1, -2, 3], [2, -1, 4]]);
B = Matrix([[0, 2, 1], [1, 3, -4]]);

A - B
```




    Matrix([
    [1, -4, 2],
    [1, -4, 8]])



## More Definitions

- If $A_1,A_2,\cdots,A_k$ are matrices of the same dimension, and $c_1,c_2,\cdots,c_k$ are real numbers, then
$$
  c_1A_1 + c_2A_2 + \cdots + c_kA_k \qquad\qquad (2)
$$
    is called a $\underline{\hspace{2.5in}}$ of $A_1,A_2,\cdots,A_k$. <br />

    The numbers $c_1,c_2,\cdots,c_k$ are called $\underline{\hspace{1.5in}}$.

- The linear combination (2) can be expressed using summation notation: <br /><br /><br /><br />

- If $A = [a_{ij}]$ is an $m\times n$ matrix, then the $\underline{\hspace{1.5in}}$ of $A$ is an $n\times m$ matrix $A^T = [a_{ij}^T]$ defined by
$$
        a_{ij}^T = \qquad\qquad\qquad\qquad
$$

### Example 5

Let
$$
  A =
  \left[
    \begin{array}{ccc}
      1 & -2 & 3 \\
      2 & -1 & 4 \\
    \end{array}
  \right]
$$
Then
$$
  A^T = \hspace{4in}
$$  


```python
from sympy import *

A = Matrix([[1, -2, 3], [2, -1, 4]]);

A.T
```




    Matrix([
    [ 1,  2],
    [-2, -1],
    [ 3,  4]])



### Example 6

Suppose $A$ and $B$ are both $m\times n$ matrices. Then
$$
  (2A + 3B)^T = \hspace{4in}
$$
<br /><br /><br /><br />
$$
  (A^T)^T = \hspace{4in}
$$
<br /><br /><br /><br />
$$
  (A - 2B^T)^T = \hspace{4in}
$$
<br /><br /><br /><br />

ipynb
6155f54f2c9ffb55bfa251a23bd2c7dd4c096578
Jupyter Notebook
2fb7ec4e5f0771f10719cb5e4a00a7ab07c49b59
MIT
xiuquan0418/MAT341
Jupyter_Notes/Lecture02_Sec1-2_Matrices.ipynb
2fb7ec4e5f0771f10719cb5e4a00a7ab07c49b59
MIT
xiuquan0418/MAT341
Jupyter_Notes/Lecture02_Sec1-2_Matrices.ipynb
2fb7ec4e5f0771f10719cb5e4a00a7ab07c49b59
MIT
xiuquan0418/MAT341
Jupyter_Notes/Lecture02_Sec1-2_Matrices.ipynb