# Linear Algebra - Systems of Linear Equations
> We gonna expalin Linear Equations and its extentions, such as ker(),row(), pivot, leading variables & free variables
## Linear Equations
In mathematics, a linear equation is an equation that may be put in the form $c_1x_1+c_2x_2...c_nx_n=a$, and $c_1,c_2...c_n$ are the coefficients, which are often real numbers.
When there are a lot of equetions to slove we simply list them down.
$$\begin{cases}
c_{11}x_1+c_{12}x_2...c_{1n}x_n=a_1 \\
c_{21}x_1+c_{22}x_2...c_{2n}x_n=a_2 \\
\vdots\\
c_{n1}x_1+c_{n2}x_2...c_{nn}x_n=a_n \\
\end{cases}$$
Or more easily, wirte as a matrix A times a vector $\vec{x}$ equals $\vec{a}$.
$$A\vec{x}=\vec{a}\rightarrow\left[ {\begin{array}{cc}
c_{11} & c_{12} & ... & c_{1n}\\
c_{21} & c_{22} & ... & c_{2n}\\
\vdots & \vdots & \ddots & \vdots\\
c_{n1} & c_{n2} & ... & c_{nn}\\
\end{array} } \right]\left[ {\begin{array}{cc} x_1\\ x_2\\ \vdots\\ x_n
\end{array} } \right]=\left[ {\begin{array}{cc} a_1\\ a_2\\ \vdots\\ a_n
\end{array} } \right] \rightarrow \left[ {\begin{array}{cc}
c_{11} & c_{12} & ... & c_{1n} & a_1\\
c_{21} & c_{22} & ... & c_{2n} & a_2\\
\vdots & \vdots & \ddots & \vdots\\
c_{n1} & c_{n2} & ... & c_{nn} & a_n\\
\end{array} } \right]$$
## Row echelon form
:::success
* echelon : 階梯
:::
Then...How to solve a system of linear equations completely? Of course, We will use Gaussian Method(Which also a knowledge in high school), then we can get an row echelon form.
### Definition
* All rows having only zero entries are at the bottom.
* The leading entry (that is, the left-most nonzero entry) of every nonzero row, called the pivot, is on the right of the leading entry of every row above.
for example:
$$\left[ {\begin{array}{cc}
1 & a_0 & a_1 & a_2 & a_3\\
0 & 0 & 2 & a_4 & a_5\\
0 & 0 & 0 & 1 & a_6\\
0 & 0 & 0 & 0 & 0\\
\end{array} } \right]$$
### reduced row echelon form
#### Definition
* It is in row echelon form.
* The leading entry in each nonzero row is 1 (called a leading one).
* Each column containing a leading 1 has zeros in all its other entries.
for example:
$$\left[ {\begin{array}{cc}
1 & 0 & a_1 & 0 & b_1\\
0 & 1 & a_2 & 0 & b_2\\
0 & 0 & 0 & 1 & b_3\\
\end{array} } \right]$$
## Ker
### Definition
Given a matrix A, $ker(A)=\{\vec{x}\mid A\vec{x}=\vec{0}\}$
### How to find ker(A)
:::info
Given matrix $A=\left[ {\begin{array}{cc}
4 & 1 & 24 & 19 & 1\\
1 & 1 & 9 & 10 & 0\\
2 & 0 & 10 & 6 & 1\\
\end{array} } \right]$, find $ker(A)$
:::
:::spoiler
We know that $ker(A)=\{\vec{x}\mid A\vec{x}=\vec{0}\}$, let $\vec{x}=\left[ {\begin{array}{cc}x_1\\ x_2\\ x_3\\ x_4\\ x_5\end{array} }\right]$. We can list a linear equestion as:
$$\begin{cases}
4\times x_1+1\times x_2+24\times x_3+19\times x_4+1\times x_5=0 \\
1\times x_1+1\times x_2+9\times x_3+10\times x_4+0\times x_5=0 \\
2\times x_1+0\times x_2+10\times x_3+6\times x_4+1\times x_5=0 \\
\end{cases}
$$
$$\left[ {\begin{array}{cc}
4 & 1 & 24 & 19 & 1 & 0\\
1 & 1 & 9 & 10 & 0 & 0\\
2 & 0 & 10 & 6 & 1 & 0\\
\end{array} } \right] \rightarrow\left[ {\begin{array}{cc}
1 & 0 & 5 & 3 & 0 & 0\\
0 & 1 & 4 & 7 & 0 & 0\\
0 & 0 & 0 & 0 & 1 & 0\\
\end{array} } \right]
\rightarrow\begin{cases}
x_1=5(-x_3)+3(-x_4)\\x_2=4(-x_3)+7(-x_4)\\x_5=0
\end{cases}, x_3,x_4\in\mathbb{R}$$
$$ker(A)=\{\left[ {\begin{array}{cc}
5a+3b\\4a+7b\\a\\b\\0
\end{array} } \right]\mid a.b\in \mathbb{R}\}$$
:::
## Row
### Definition
Given a matrix $A=\left[ {\begin{array}{cc}
\leftharpoonup r_1\rightharpoonup\\
\leftharpoonup r_2\rightharpoonup\\
\vdots\\
\leftharpoonup r_n\rightharpoonup\\
\end{array} } \right]$, $r_i$ is the row of matrix , $Row(A)=Span(\{r_1,r_2...r_n\})$
## Col
Given a matrix $A=\left[ {\begin{array}{} |&|&...&|\\u_1 & u_2 & ... & u_d\\|&|&...&| \end{array} } \right]$, $u_i$ is the volumn of matrix , $Col(A)=Span(\{u_1,u_2...u_n\})$
## pivot, leading variables & free variables
* **pivot**: the leading entry (that is, the left-most nonzero entry) of every nonzero row
* **pivot position**: the position of the leading entry (that is, the left-most nonzero entry) of every nonzero row
* **pivot column**: the column of the leading entry (that is, the left-most nonzero entry) of every nonzero row
* **leading variables** : same as pivot column
* **free variables** : the column that does not contain any pivot

### rank
#### Definition
Given a matrix A, $rank(A)$ is the number of free variables
### null
#### Definition
Given a matrix A, $null(A)$ is the number of leading variables