# Vector Space and subspaces

### Vector  Space

![](https://846345873-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LagOeJ2nL90MQERwhxy%2F-LeRWV75IJvPXtiaJVGM%2F-LeSQUMKne83zZ06fPi5%2Fimage.png?alt=media\&token=0924eec8-aa51-4fb3-b00b-1d95b0b6fa85)

Spaces of vectors need to allow me to do certain operations. I can add them, multiply them. Every vector space has the 0 vector, the origin.&#x20;

Examples of vector spaces :&#x20;

R^2 - which is all 2 dimensional real vectors. \[3,2], \[0,0]. R^2 is basically the plane.&#x20;

R^3 - all vectors with 3 components.&#x20;

R^n - all column vectors with n real components.&#x20;

NOT a vector space: because can't multiply by -5 for example. So it's not closed by multiplication for all real numbers.&#x20;

![](https://846345873-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LagOeJ2nL90MQERwhxy%2F-Les_bNJt4mr4K_-rEub%2F-Lew-fK3IokKyki2Kt-r%2Fimage.png?alt=media\&token=989c39c8-b907-451f-8c68-366cbf90bad8)

Subspace: ex: a line within R^2.&#x20;

![](https://846345873-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LagOeJ2nL90MQERwhxy%2F-Les_bNJt4mr4K_-rEub%2F-Lew0APh8gyhl_6SII4s%2Fimage.png?alt=media\&token=be0ae55b-c724-48fc-99f1-f559d3a09d54)

The line must pass by the origin. Every subspace must do this.&#x20;

### Column space&#x20;

\= all the combinations of the columns.&#x20;

Say you have a matrix A. How do you get a subspace? This A has its columns in R^3. If you take those columns, and all of their (linear) combinations, they form a subspace called columns space C(A).&#x20;

![](https://846345873-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LagOeJ2nL90MQERwhxy%2F-Les_bNJt4mr4K_-rEub%2F-Lew1rYj-Ohs9e2Wjplw%2Fimage.png?alt=media\&token=cec812d5-7fc6-46ab-8a1b-fbddd51879bb)

You get a plane through the origin.&#x20;

Another example:

![](https://846345873-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LagOeJ2nL90MQERwhxy%2F-Les_bNJt4mr4K_-rEub%2F-Lew8hxoBnbZCqVPsbGe%2Fimage.png?alt=media\&token=12a7ca2c-e8b5-47cd-9c02-5f268a13a273)

The span of columns gives you all possible outputs.&#x20;

![](https://846345873-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LagOeJ2nL90MQERwhxy%2F-LeiKA8hJFI6eADyMb0Y%2F-LeixLZ1nEYQVlq8Hpx2%2Fimage.png?alt=media\&token=2851f96a-f23a-4202-9922-bc27856db717)

The \[0,0]  will always be in the column space

Now let's go back to our Ax = b equation. Does Ax = b have a solution for every b? NO! Why? Because for instance we have 4 equations for 3 unknowns.&#x20;

![](https://846345873-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LagOeJ2nL90MQERwhxy%2F-Les_bNJt4mr4K_-rEub%2F-LewA1XJHG5GUxpAI3Uv%2Fimage.png?alt=media\&token=a45c0974-19ec-4002-8839-7453fae5bbc7)

Which b's allow this system to be solved? One example is, aside from all b's being 0 is to take one of the columns of A. Then it's easy to find an x that satisfy's Ax=b. But these are special solutions. &#x20;

![](https://846345873-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LagOeJ2nL90MQERwhxy%2F-Les_bNJt4mr4K_-rEub%2F-LewAWjtVA-7N8GgX8vX%2Fimage.png?alt=media\&token=6cb4f054-478f-41b5-87e8-4790d7862e5d)

**I can solve Ax=b exactly when b is in the column space of A: C(A)**. Because the column space by definition contains all the combinations, it contains all the AX's.  If b is a combination of the columns, then we can find x.&#x20;

Also, because column 3 is dependant, it adds nothing new, A is a 2 dimensional subspace of R^4.&#x20;

### Null space

Same example as above. Nullspace of A = all solutions of X.

![](https://846345873-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LagOeJ2nL90MQERwhxy%2F-Les_bNJt4mr4K_-rEub%2F-LewC-V91zlw7hAcPoak%2Fimage.png?alt=media\&token=cb738c81-c7c2-4955-9161-ca44526bc676)

(the x's are in R^3).&#x20;

Now I am interested in the x's. so :&#x20;

![](https://846345873-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LagOeJ2nL90MQERwhxy%2F-Les_bNJt4mr4K_-rEub%2F-LewD6NwuYosTiDKpCIA%2Fimage.png?alt=media\&token=1dd4b187-cc7e-48ed-82b4-e328c9679d0c)

To generalize, the solution is \[c, c, -c]  or c\[1,1,-1].

![](https://846345873-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LagOeJ2nL90MQERwhxy%2F-Les_bNJt4mr4K_-rEub%2F-LewDXs89ePSdBDB5kxv%2Fimage.png?alt=media\&token=f64831b5-9651-4192-9351-8d4e3c070658)

The null space is this line in R^3 that goes through the origin.&#x20;

We can say that solutions to Ax=0 always give a subspace. That's because if we have Av = 0 and Aw=0 then we have A(v + w) = 0 and Av + Aw  = 0. also A x 12v = 0, etc. etc. Checks all criteria of being a subspace.&#x20;

**How do we compute Ax=0?**&#x20;

Let A be a matrix.&#x20;

![](https://846345873-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LagOeJ2nL90MQERwhxy%2F-LewXjyhbaSVPLYuyYqH%2F-LewcYazrDGsNMGAafr8%2Fimage.png?alt=media\&token=e97cafa7-0db6-42c8-805f-0b7316928e0a)

We apply elimination, and get this echelon form (staircase form, or upper triangle) matrix with 2 pivots.&#x20;

![](https://846345873-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LagOeJ2nL90MQERwhxy%2F-LewXjyhbaSVPLYuyYqH%2F-LewZZf96ptX3Ivjx15h%2Fimage.png?alt=media\&token=6e8ee12f-76f6-435a-af94-d25f5361e5fe)

(when doing the elimination, when there is nothing to be done on one column you just continue (column 2 had 2 0... oh well go to column 3, because you can't pivot to have a number in position 2,2.)

We say that the Rank of A = the number of pivots. In our example, Rank = 2.&#x20;

Here we have 2 pivot columns and 2 free columns. I can assign any number to the variables x2 and x4 to solve Ax=0. Then I can solve the equations for x1 and x3.

{% hint style="info" %}
**Rank** is the number of dimensions in the column space.&#x20;
{% endhint %}

![](https://846345873-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LagOeJ2nL90MQERwhxy%2F-LewXjyhbaSVPLYuyYqH%2F-Lew_PDyT0KZGjh-Dd4_%2Fimage.png?alt=media\&token=7bde5d39-fbf4-425e-afbf-8fb9c76dd02b)

Conveniently, we chose variables x1=1 and x3=0 to help us solve the problem (we can chose whatever variable we like).&#x20;

1 solution to Ax=0 (the null space) becomes: (actually I am really solving Ux=0 because of the transformation I did on A) this x below:

![](https://846345873-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LagOeJ2nL90MQERwhxy%2F-LewXjyhbaSVPLYuyYqH%2F-Lew_xrmqVxf3tjOvkxr%2Fimage.png?alt=media\&token=f281d898-a896-4437-85ee-a897a958ca91)

Here is our algorithm:

So all of our solutions for the null space are:&#x20;

![](https://846345873-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LagOeJ2nL90MQERwhxy%2F-LewXjyhbaSVPLYuyYqH%2F-LewbTYkDCd19TfsNx1N%2Fimage.png?alt=media\&token=8597e051-2de0-4361-9e42-286e106176e9)

{% hint style="info" %}
Do elimination.

Find which are the pivot columns which are the free columns. In our example, this tells us that variables 1 and 3 are pivot variables the other free variables.

Give 1 free variables the value 1 and the other 0. Then you find the solution.&#x20;

Then you do the opposite, you give the other free variable the value 0 and the other 1, then find the solution.&#x20;

All possible solutions become a combinations of those 2 solutions.
{% endhint %}

The solutions are actually all the possible combinations of those, so you'd add a plus sign in the equation above to get all possible solutions.&#x20;

**What is the number of free variables in general?**&#x20;

For a mxn matrix of rank r, we have **n-r** free variables.

#### Reduced row echelon form

Let take our U again

![](https://846345873-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LagOeJ2nL90MQERwhxy%2F-LewXjyhbaSVPLYuyYqH%2F-LewdF5DYIPrDrmKWVfK%2Fimage.png?alt=media\&token=659c6382-61cd-4bcc-ba13-e9222ee57c6e)

(BTW there is a row of 0's because row 3 is a combination of row 1 and 2. Elimination discovered that fact).&#x20;

How can we do more cleaning on this matrix? We want 0's above and below our pivots, and pivots = 1.&#x20;

![](https://846345873-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LagOeJ2nL90MQERwhxy%2F-LewXjyhbaSVPLYuyYqH%2F-LewdgT-wIrHvcBsM0Qb%2Fimage.png?alt=media\&token=20b516db-5fce-440f-886a-de8588bbc47b)

R = rref(A) = reduced row echelon form of A.&#x20;

Now, if we want to find the solutions to Rx=0, they would be the same as Ax=0 and Ux=0, they are all the same because all we did was subtract, multiply different equations which we are allowed to do.&#x20;

Notice how there is an Identity matrix I within R, and some matrix F among the free columns:

![](https://846345873-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LagOeJ2nL90MQERwhxy%2F-LewXjyhbaSVPLYuyYqH%2F-LewfSCt1X42HbdrzPXu%2Fimage.png?alt=media\&token=6d229812-a020-412b-8ef2-7dbd55799583)

So here is a typicall RREF:

![](https://846345873-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LagOeJ2nL90MQERwhxy%2F-LewXjyhbaSVPLYuyYqH%2F-LewfklIh65L4hi27aUW%2Fimage.png?alt=media\&token=a881c127-25e0-4ac8-8f6a-6f49dc6b6be6)

Therefore:&#x20;

![](https://846345873-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LagOeJ2nL90MQERwhxy%2F-LewXjyhbaSVPLYuyYqH%2F-LewgbcNel1_xKT5gFyE%2Fimage.png?alt=media\&token=7af3e89f-4bc9-404c-9910-514e976f36a9)

Another example: Let's find the null space of matrix A

![](https://846345873-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LagOeJ2nL90MQERwhxy%2F-LexBfJgZy7_W3VMh44p%2F-LexDkXDrF9H09u2uOvr%2Fimage.png?alt=media\&token=391cf9f3-6aac-454f-a19d-2653af84221a)

Now let's solve **Ax=b.** Below, this matrix is called the augmented matrix.

![](https://846345873-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LagOeJ2nL90MQERwhxy%2F-LexBfJgZy7_W3VMh44p%2F-LexFAzyNcR5oBMuInc2%2Fimage.png?alt=media\&token=54d5015f-2b9e-47ea-8b75-675f55cf27a8)

Let's do elimination..&#x20;

![](https://846345873-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LagOeJ2nL90MQERwhxy%2F-LexBfJgZy7_W3VMh44p%2F-LexFay95UbA2Pe0R6HQ%2Fimage.png?alt=media\&token=3449ff31-874d-47dd-b78e-da2e6ae979ea)

0 = b3-b2-b1 it's the condition for solvability.&#x20;

Ax=b is solvable when b is in C(A) - (column space of A).&#x20;

Another way of saying it is, if a combination of rows of A gives 0 rows, then the same combination of entries of b must give 0.&#x20;

So how do I find the solutions for the equations? Let's start by finding 1 solution, Xpartiuclar. We start by setting all free variables to 0. So we find our pivot and free columns. Then solve Ax=b for pivot variables. &#x20;

![](https://846345873-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LagOeJ2nL90MQERwhxy%2F-LexBfJgZy7_W3VMh44p%2F-LexHhmNUPRG6Ke52ynA%2Fimage.png?alt=media\&token=52c8a6cb-5435-496d-95b6-a3dc64c89841)

x2 = 0 and x4 = 0 because they were in the columns 2 and 4 which where the free variable columns.&#x20;

That's just 1 solution. How do we find them all?&#x20;

Find the nullspace, then the complete solution = the 1 particular solution +  the solutions for the nullspace.&#x20;

![](https://846345873-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LagOeJ2nL90MQERwhxy%2F-LexBfJgZy7_W3VMh44p%2F-LexIBjtBIFGWZgo6lnA%2Fimage.png?alt=media\&token=b393b15e-c241-42b8-838e-947b928d6cec)

In our example, the complete solution is (and we take the previous solution we had for Ax=0 because we're using the same matrix.&#x20;

![](https://846345873-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LagOeJ2nL90MQERwhxy%2F-LexBfJgZy7_W3VMh44p%2F-LexIntur7BFck-uQSHy%2Fimage.png?alt=media\&token=f28b282a-6021-4c5c-8107-571ec4376827)

#### 3 types of rank. Say we have m by n matrix A of rank r. (we know that r<=m and r<=n)

#### 1. Full column rank.&#x20;

This means that r = n. That also means there is a pivot in every columns. There are n pivots. And therefore, no free variables.&#x20;

So what will be in the nullspace N(A)? Only the 0 vector. There are no free variables to give other vectors.&#x20;

What about our solution to Ax=b? There is just 1 solution (Xparticular) if there is a solution. So there's either 1 or 0 solution. Example where r=n:

![](https://846345873-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LagOeJ2nL90MQERwhxy%2F-LexBfJgZy7_W3VMh44p%2F-LexQupKOGg_aVNk_6jF%2Fimage.png?alt=media\&token=740f2d6d-a275-41cf-b991-e2939c0ba845)

What's its rank? **r=n < m**. So r=2.&#x20;

Its echelon form will have the identity matrix above, and 0's below.&#x20;

![](https://846345873-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LagOeJ2nL90MQERwhxy%2F-LexBfJgZy7_W3VMh44p%2F-LexRhI3WWeRMMRnI7Bq%2Fimage.png?alt=media\&token=c82df473-3b96-430d-8445-fd68e90c3086)

It's because it is a matrix that has 2 independant rows. The other rows are combinations of the 1st two. For this matrix, what's the situation with Ax=b? We have 4 equations and only 2 x's for A. So there is absolutely not always a solutions. With a random choice, we'll have 0 solutions. We'll have a solution if it is a combination of the 2 cols. Ex: col1 + col2 = \[4,3,7,7].

#### 2. Full row rank&#x20;

This means **r = m < n**. How many pivots? m. Every row has a pivot. There are more unknown variables than equations, so there are non zero solutions to Ax=0.

I can solve Ax=b for every b if there exists one.&#x20;

We are left with n - r (or m-n) free variables. There will always be at least 1 free viable that is non 0.&#x20;

#### 3. Full rank

This means **r = m = n**. It is a square matrix and It's invertable. Also it's Row echelon = I

![](https://846345873-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LagOeJ2nL90MQERwhxy%2F-LexBfJgZy7_W3VMh44p%2F-LexOWO5T_BfIpFdVfoO%2Fimage.png?alt=media\&token=daf804cb-1a3f-4861-bd1a-053268fbdf24)

The null space for Matrix A is the 0 vector only. To solve Ax=b, what are the conditions for b (b1 and b2)? None. Because r = m like above, we can solve for every b (there is always a solution), and because r = n, there is a unique solution.&#x20;

**To summarize all 4 types of situations we can have:**&#x20;

![](https://846345873-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LagOeJ2nL90MQERwhxy%2F-LexBfJgZy7_W3VMh44p%2F-LexSLBMGh-oont6NRY4%2Fimage.png?alt=media\&token=430f1751-aa14-4872-b5c4-571e69b4e940)

The rank tells you everything about the number of solutions.&#x20;

![](https://846345873-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LagOeJ2nL90MQERwhxy%2F-Ley-mJPZdhQIXiWSA-r%2F-Ley0PSAy8x-D5b2DhMY%2Fimage.png?alt=media\&token=a5007cdd-433d-45d3-91ba-fda97e5e987d)

### Span of the set of vectors

**Definition**

![](https://846345873-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LagOeJ2nL90MQERwhxy%2F-Ley-mJPZdhQIXiWSA-r%2F-Ley3MLHPxnLtgwnExdL%2Fimage.png?alt=media\&token=d0c5639d-218b-44c2-9848-14cf7de85ed7)

![](https://846345873-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LagOeJ2nL90MQERwhxy%2F-LeRWV75IJvPXtiaJVGM%2F-LeSredEWlKfLMY_Sytw%2Fimage.png?alt=media\&token=018cab67-ed5c-4ade-b16a-c2a01a85bc3b)

### Intersection, sum and union of 2 vector spaces

![](https://846345873-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LagOeJ2nL90MQERwhxy%2F-LeWnyzBClfuB7j3Uuq2%2F-LeWotjyqv6FFkd1o6te%2Fimage.png?alt=media\&token=db10cb2a-6a32-4f89-89dc-cb15013b7d4b)

Is the intersection of 2 subspaces a subspace?  Yes. You usually get a smaller subspace but it is a subspace. The sum is in the subspace.&#x20;

**The Union is not usually a vector space - why?**

![](https://846345873-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LagOeJ2nL90MQERwhxy%2F-LeWnyzBClfuB7j3Uuq2%2F-LeWpMhbszOq1rfUvxLK%2Fimage.png?alt=media\&token=d154b626-5f57-4253-8ea7-f5ce19f12660)

Ex: Let's take 2 subspaces P and L. P is a plane, L is a line. P union L is just part of the line and part of the plane. If i add something from P and something from L, i'll be outside the union, so it can't be a subspace.&#x20;

![](https://846345873-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LagOeJ2nL90MQERwhxy%2F-Les_bNJt4mr4K_-rEub%2F-Lew6KnnNqd2nRPs6RhH%2Fimage.png?alt=media\&token=e06b2448-ffbf-44ca-af3e-fa23a9808029)

### Linear dependence

When a vector is redundant, which means they don't add anything to our span, those vectors are linearly dependent. One of the vectors can be expressed as a linear combination of the others.&#x20;

![](https://846345873-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LagOeJ2nL90MQERwhxy%2F-LeWnyzBClfuB7j3Uuq2%2F-LeWyGi8ujCr40Ns-fcY%2Fimage.png?alt=media\&token=6d723ba4-cb5e-4dbe-a25c-c2884b6a6b36)

![](https://846345873-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LagOeJ2nL90MQERwhxy%2F-LeWnyzBClfuB7j3Uuq2%2F-LeWrwqJtfSQgxKke7mG%2Fimage.png?alt=media\&token=350daae2-538c-40ec-9b25-de777e87c2e4)

**Redundant vectors**

![](https://846345873-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LagOeJ2nL90MQERwhxy%2F-LeWnyzBClfuB7j3Uuq2%2F-LeWr0qoIhK_3z8aJVV-%2Fimage.png?alt=media\&token=04cb57f5-43b5-47f8-84b2-4de38b6cce1e)

### Degrees of freedom

![](https://846345873-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LagOeJ2nL90MQERwhxy%2F-LeWnyzBClfuB7j3Uuq2%2F-LeX0RKkZEIQVkgbnqKc%2Fimage.png?alt=media\&token=d94798d0-1701-4471-aaf5-84566b62e75f)

![](https://846345873-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LagOeJ2nL90MQERwhxy%2F-LeWnyzBClfuB7j3Uuq2%2F-LeX0Uk-qrRtkDCzWN7U%2Fimage.png?alt=media\&token=32ab1ab8-4fa9-4693-9f73-0e4a5cd3c607)

###

### Linear independence&#x20;

**Definition**

![](https://846345873-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LagOeJ2nL90MQERwhxy%2F-Ley-mJPZdhQIXiWSA-r%2F-Ley1QczOHbXwbx1RmHZ%2Fimage.png?alt=media\&token=abccaf88-add0-4d89-b342-50e5dd0cf91b)

![](https://846345873-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LagOeJ2nL90MQERwhxy%2F-Ley-mJPZdhQIXiWSA-r%2F-Ley2XPonNY9lX1uNyLv%2Fimage.png?alt=media\&token=73e065dd-d835-407e-a34b-e705b4d83319)

When they are independent, rank = n, N(A) = vector 0 and there are no free variables.&#x20;

When they are dependent, rank < n and there are free variables.

If each vector really adds another dimension to the span, then they are linearly independent.&#x20;

![](https://846345873-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LagOeJ2nL90MQERwhxy%2F-LeWnyzBClfuB7j3Uuq2%2F-LeWyW-OeODtD-wVyRL6%2Fimage.png?alt=media\&token=51d756c8-d92d-4c7c-9103-68d347e3357a)

Exercises

![](https://846345873-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LagOeJ2nL90MQERwhxy%2F-LeWnyzBClfuB7j3Uuq2%2F-LeWyfiQcGPC3lvHIH0a%2Fimage.png?alt=media\&token=11e4b6bd-c07d-43e9-8222-43fac84e7173)

### Basis

**Definition**

Basis for a space is a sequence of vectors v1, v2, ... vd with 2 properties:

1. They are independent
2. They span the space.

![](https://846345873-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LagOeJ2nL90MQERwhxy%2F-Ley-mJPZdhQIXiWSA-r%2F-Ley6UvC73qSJLiAQIe0%2Fimage.png?alt=media\&token=5db19c0b-3d49-4a38-8fc6-10c0a5428e48)

Another basis: there are many many possible basis. (Actually 3, 3 , 8 doesn't work, we would need another vector because with that, row 1 and 2 are the same, so its dimension is 2, not 3, so it's not actually a basis.)&#x20;

![](https://846345873-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LagOeJ2nL90MQERwhxy%2F-Ley-mJPZdhQIXiWSA-r%2F-Ley6ZWI9yHbDkDL34c_%2Fimage.png?alt=media\&token=bf478189-8a3c-478e-8502-c0304281d62c)

{% hint style="info" %}
R^n - n vectors give basis if the nxn matrix with those col's is invertible.&#x20;

Given a space, every basis for the space has the same number of vectors.
{% endhint %}

![](https://846345873-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LagOeJ2nL90MQERwhxy%2F-LeWnyzBClfuB7j3Uuq2%2F-LeX1uf4YMt8tDY0hul7%2Fimage.png?alt=media\&token=3f5b420c-27b0-4836-9645-77307986a240)

![](https://846345873-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LagOeJ2nL90MQERwhxy%2F-LeWnyzBClfuB7j3Uuq2%2F-LeX24hpIyNPvfq_AMia%2Fimage.png?alt=media\&token=c56764a0-994b-4fca-918b-5b8b10283f19)

### Dimension

In our definition in the basis section:

{% hint style="info" %}
Given a space, every basis for the space has the same number of vectors.
{% endhint %}

The dimension is number of vectors in a basis.&#x20;

**Examples**

The space is the column space of A:

![](https://846345873-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LagOeJ2nL90MQERwhxy%2F-Ley-mJPZdhQIXiWSA-r%2F-Ley8Kjcu7-jHQA4ujFu%2Fimage.png?alt=media\&token=0936d2d2-d3d4-4381-bba7-83898a4e284e)

Do the vectors span the space of that matrix? Yes. That's by definition where they come from because the space is C(A).&#x20;

Are they a basis for the column space, are they independent? No, there is something in the null space. Let's look at the null space:  Let's find vector in the null space. Looking for solutions for Ax=0. One example is&#x20;

![](https://846345873-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LagOeJ2nL90MQERwhxy%2F-Ley-mJPZdhQIXiWSA-r%2F-Ley8wT0XGoxTdZDYeJy%2Fimage.png?alt=media\&token=1449365f-2723-4dae-bd3e-55268d5cd27e)

Because -1 x col1 + -1 x col2 + 1 x col3 + 0 x col 4 = 0.&#x20;

What is a basis for that column space? Answer= cols 1&2. Those are the pivots columns. 1 first column we put it in our basis, same for 2. 3 and 4 we can't because they are multiples of 1 or 2.&#x20;

{% hint style="info" %}
Therefore the rank of the matrix = 2. So: rank(A) = number of pivot columns = the dimension of the **C(A)**. (it's the dimension of the subspace, which is the column space of A. We're not talking about the Matrix A.&#x20;

so : dim C(A) = rank
{% endhint %}

What's the dimension of the nullspace? dimN(A) = number of free variables = n - r&#x20;

Other definition from Brilliant.org:

![](https://846345873-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LagOeJ2nL90MQERwhxy%2F-LeX3q6L15R-CyYV5Ihj%2F-LeX3vYkVy9LKvil6ag7%2Fimage.png?alt=media\&token=c79d06d1-1263-40b4-b19f-0f248aec1823)

![](https://846345873-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LagOeJ2nL90MQERwhxy%2F-LeX3q6L15R-CyYV5Ihj%2F-LeX4vOHn82y7YqWpT_S%2Fimage.png?alt=media\&token=74f8c7ef-38ac-43e3-befe-273566f2a994)

### Row space&#x20;

\= all the combinations of the rows (of A).

It's also all the combinations of the columns of the transpose of A, = C(A T).&#x20;

### Nullspace of the transpose of A

\= N(A T) = the left nullspace of A.&#x20;

### Four subspaces&#x20;

Columnspace C(A) in R^m. Its dimension is the rank, the basis are the pivot columns.&#x20;

Rowspace C(A T) in R^n. Its dimension is also the rank.&#x20;

Nullspace  N(A) in R^n . The dimension is n-r, the basis are the special solutions, there is 1 basis for each free variable, that is **= n - r**.&#x20;

Nullspace of the transpose N(A T) in R^m. The dimension is m - r.&#x20;

![](https://846345873-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LagOeJ2nL90MQERwhxy%2F-LeyQ0rkACSq8fw8o-1_%2F-LeyRHL4qzBG9k44i_6P%2Fimage.png?alt=media\&token=fb1664d4-d5d9-4401-a57c-a4f560e9cb70)

Therefore: dim rowspace + dim nullspace = number of columns and dim colspace + dim N(AT) = number of rows.

How do you get a basis for the **rowspace** of A? Let A be a matrix, and we find R:&#x20;

&#x20;

![](https://846345873-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LagOeJ2nL90MQERwhxy%2F-Lf-ympdSgiOqdG_Kl0O%2F-Lf00F-nDbJ0VWl1JuFf%2Fimage.png?alt=media\&token=fb851316-2ee7-4a50-82ea-c8cfe87ee8c4)

One thing we can say is that C(R) =/= C(A) because we did operations on rows, which preserves the rowspace, but not the column space. This means they have exactly the same vectors in them, they are just combinations of each other and they have 4 components each. Since that is true, then what is a basis for the R(R)? The 1st 2 rows, because the 3rd is independant (?), and it's also a basis for the R(**A**).&#x20;

The basis we found on R, is the most cleaned possible form of the basis we can have, so it's the best basis.&#x20;

&#x20;

![](https://846345873-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LagOeJ2nL90MQERwhxy%2F-Lf-ympdSgiOqdG_Kl0O%2F-Lf00x9st972HyKO5dQ7%2Fimage.png?alt=media\&token=e29e7805-c74d-4c36-8c11-c2e6000812f2)

Now let's look at the 4th space, N(AT). We also call this the left nullspace. Why?

![](https://846345873-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LagOeJ2nL90MQERwhxy%2F-Lf-ympdSgiOqdG_Kl0O%2F-Lf02Pt0QDfbLozVHE4C%2Fimage.png?alt=media\&token=d26e6d5a-57dd-4383-bd43-3f302e9143e3)

Putting it on the left we had to make it a row vector instead of a column vector. When we multiply by A on both sides, we have to inverse the order in which we multiply.&#x20;

How do we get a basis?&#x20;

Let's take our Gauss-Jordan method again and apply it. Here we're working with a non square matrix. We want to find the rref of A with I beside it, this gives us R, and E. E is going to contain a record of what we did.&#x20;

![](https://846345873-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LagOeJ2nL90MQERwhxy%2F-Lf-ympdSgiOqdG_Kl0O%2F-Lf03PhdxhPnwmpRpvkt%2Fimage.png?alt=media\&token=ce49f7f2-f0ee-4be2-8576-75ba2ad0e63c)

### **Matrix Space**

Let's define a new vector space: A space where each vector is a matrix! It's the space with all matrices. The same ideas work as long as you can add and scale the vector - which in this case is a matrix.&#x20;

![](https://846345873-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LagOeJ2nL90MQERwhxy%2F-Lf-ympdSgiOqdG_Kl0O%2F-Lf05Hquuj3ZOAd42vOF%2Fimage.png?alt=media\&token=33ca58a8-c580-4b5c-acb5-52bcb0460e84)

How do we find the dimension? We need to find the basis.&#x20;

![](https://846345873-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LagOeJ2nL90MQERwhxy%2F-Lf-ympdSgiOqdG_Kl0O%2F-Lf05xGqjblL5BVgo7l3%2Fimage.png?alt=media\&token=8da34d74-de81-49d2-bfd2-74682057a62a)

Say we have the above 3 matrices. Those 3 matrices are basis, they are independant, you can add them, multiply. So they form a basis. Therefore, dim = 3. However the standard basis:&#x20;

![](https://846345873-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LagOeJ2nL90MQERwhxy%2F-Lf0A-NMrH2xM_0SGMuT%2F-Lf0AorVtQGTczMLmDIm%2Fimage.png?alt=media\&token=a5e867b6-ebbc-40a6-a03f-065ee7b10ab0)

This is of dimension 9.&#x20;

The dimension of S which has all symetrical matrices = 6.&#x20;

The dimension of U which has all upper triangular matrices = 6 as well.&#x20;

2 other spaces: union of S and U, and addition of S and U:&#x20;

![](https://846345873-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LagOeJ2nL90MQERwhxy%2F-Lf0A-NMrH2xM_0SGMuT%2F-Lf0CReenQICrIAcmGpH%2Fimage.png?alt=media\&token=9cc1a672-a127-4420-b590-6705dd1e65e7)

{% hint style="info" %}
So dim S + dim U = dim (S union U) + dim (S + U).&#x20;
{% endhint %}

**Rank 1 matrix example: They are the building blocks of all matrices.**&#x20;

![](https://846345873-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LagOeJ2nL90MQERwhxy%2F-Lf0A-NMrH2xM_0SGMuT%2F-Lf0EaAj2okI-ATDpmbZ%2Fimage.png?alt=media\&token=a3093ea3-7f4b-48dc-ba2d-68d97ff1832f)

Where U is a column vector and V T is a row vector.

Example: Is the subset of rank 1 matrices a subspace of M?&#x20;

![](https://846345873-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LagOeJ2nL90MQERwhxy%2F-Lf0A-NMrH2xM_0SGMuT%2F-Lf0GFcOr5_0n-NmRKFe%2Fimage.png?alt=media\&token=35ca43fd-5296-4d7c-b8f6-4ed83be9215b)

Not, not usually, because the sum of 2 rank 1 matrices in that space will most likely be 2. (Max rank = 5 because we have 5x17 matrices.&#x20;

Other example:we have S= \[v1, v2, v3, v4] where:

![](https://846345873-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LagOeJ2nL90MQERwhxy%2F-Lf0A-NMrH2xM_0SGMuT%2F-Lf0Hc2rj6bEagiQs65q%2Fimage.png?alt=media\&token=7a9b2bee-114c-4822-b3f6-31b017cbd1da)

What's the rank? what's the dimension?&#x20;

We can write that equation in the form of Av=0, which means we're looking at the null space. This gives us:&#x20;

![](https://846345873-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LagOeJ2nL90MQERwhxy%2F-Lf0A-NMrH2xM_0SGMuT%2F-Lf0Hm2bAQwykYiiPYxY%2Fimage.png?alt=media\&token=2b28c1f6-6119-48f1-9720-66a58babf791)

Therefore, rank = 1 = r (there's just 1 column), and because we know dim N(A) = n - r , the dim of S = 4(columns) - 1(rank) = 3.&#x20;

What's a basis for the nullspace? The special solution. To find the special sol, we find the 3 variables. 1st we find the pivot of A: which is the 1st 1 in A

![](https://846345873-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LagOeJ2nL90MQERwhxy%2F-Lf0A-NMrH2xM_0SGMuT%2F-Lf0IgkaJpIegu1uV_hq%2Fimage.png?alt=media\&token=4ba37f11-5fce-41d9-959d-29220ea810d8)

The free variables are in v2, 3 and 4, we can choses whatever value.. THEREFORE, the basis for S:&#x20;

![](https://846345873-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LagOeJ2nL90MQERwhxy%2F-Lf0A-NMrH2xM_0SGMuT%2F-Lf0IuEbsxBLEWEPMVR_%2Fimage.png?alt=media\&token=aec67669-8134-4851-b9f6-056f9d6200c6)

The sum has to be 0 because Ax=0. There has to be 3 vectors because rank  = 3.&#x20;

What's the column space of A? The C(A) is a subspace of R^1 because m=1, there's just 1 component.&#x20;

So C(A) = R^1.

What's the last subspace: N(A T)? N(A T) is the 0 vector.&#x20;

**One last vector space that isn't formed of vectors:**&#x20;

![](https://846345873-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LagOeJ2nL90MQERwhxy%2F-Lf0A-NMrH2xM_0SGMuT%2F-Lf0DM5I4iiZd-VeTVAI%2Fimage.png?alt=media\&token=dde421e2-dc7d-46b1-bff5-441fec02aaab)

the y equations is a vector space. What is a basis of that space? A basis is, all the guys in the space are combinations of the basis. 1 basis is simply, cos(x) and sin(x).&#x20;

Therefore, the dimension = 2.&#x20;

Conclusion : cosx and sinx don't look like vectors they look like functions. But since we can scale and add them, they are LIKE vectors.&#x20;

### &#x20;

### Dot product

Very useful geometric tool for understanding projections and understanding whether or not vectors tend to point in the same direction. &#x20;

![](https://846345873-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LagOeJ2nL90MQERwhxy%2F-LeiKA8hJFI6eADyMb0Y%2F-LeirLflnsx9oOnZAICF%2Fimage.png?alt=media\&token=eef208da-c154-44fa-91ee-7c131f5e8368)

Geometric interpretation:

![](https://846345873-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LagOeJ2nL90MQERwhxy%2F-LeiKA8hJFI6eADyMb0Y%2F-LeirXd_UbxPGQWYaOhi%2Fimage.png?alt=media\&token=1bd6b905-a94b-4a26-af01-d741b6ba1b8a)

Project w on the line that passes the origin and the tip of v. Then multiply the length of the projection and the length of v = dot product.&#x20;

![](https://846345873-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LagOeJ2nL90MQERwhxy%2F-LeiKA8hJFI6eADyMb0Y%2F-LeiruZ3xBhU-8ZvfY0A%2Fimage.png?alt=media\&token=edb6c82d-c2fe-41a7-9e07-4d65db5c9083)

On a deeper level, doting 2 vectors together is was to translate on of them into the world of transformations. &#x20;

![](https://846345873-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LagOeJ2nL90MQERwhxy%2F-LeiKA8hJFI6eADyMb0Y%2F-Lej-Hzr8Etqe18y_h6S%2Fimage.png?alt=media\&token=babbefb2-8c3f-4d87-8726-4cc8cd451385)

It's easier for us to understand that a vector isn't just an arrow in space, but as the physical embodiement of a linear transformation. It's as if a vector is conceptual shorthand for a certain transformation.&#x20;

![](https://846345873-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LagOeJ2nL90MQERwhxy%2F-LeYY4QtuY_3sZTsfqYF%2F-LeYfsKqyLdOxQHIQLJP%2Fimage.png?alt=media\&token=3b4898ba-7f48-45bf-a292-5c1004e9d6be)

![](https://846345873-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LagOeJ2nL90MQERwhxy%2F-LeYY4QtuY_3sZTsfqYF%2F-LeYhknjQiUxy7jTjDGC%2Fimage.png?alt=media\&token=00b27101-a650-466d-a0a6-bb3faa8277ee)

![](https://846345873-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LagOeJ2nL90MQERwhxy%2F-LeYY4QtuY_3sZTsfqYF%2F-LeYhovSYzaQ3qRkJIoy%2Fimage.png?alt=media\&token=84728834-44ef-4b89-a66e-99a9122a1cec)

### Inner products

![](https://846345873-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LagOeJ2nL90MQERwhxy%2F-LeiKA8hJFI6eADyMb0Y%2F-LeiYENkvvkUuYehr1ng%2Fimage.png?alt=media\&token=67179648-7156-46f2-b650-c27c1086b78f)
