Vector spaces — guided practice with colours: independence, change of basis, original vectors and the exam’s subspaces exercise (and the basis that did not come out of rref)
In MATLAB assignment 3 I got a 5, and two of the mistakes were in the questions asking for a basis “with original vectors”. It is the question where it is easiest to trip: rref shows you the reduced form, the reduced form has very clean vectors and it looks like that is the basis. It is not. The pivots only tell you which vectors to choose; the vectors have to be copied from the starting matrix.
In this practice we do by hand what you saw in the vector spaces theory, with screen colours and with , which is where the exam lives: three colours that stop being a basis for one value of a parameter, a change between two non-standard bases, a basis with original vectors (the one from the assignment), the implicit equations and the basis of a subspace of with fractions, and finally the whole subspaces exercise from the exam, with its marks. Each problem is checked in MATLAB, as in Assignment 3.
Table of Contents
Before you start
Make sure you are clear on:
- How to row-reduce a matrix and compute its rank (topics 1 and 2).
- How to solve a homogeneous system by Gauss-Jordan and write the solution with parameters (topic 2).
- What linear independence, a basis, the dimension and coordinates are.
- That a subspace is described by a basis, by parametric or by implicit equations, and that no. of implicit equations .
If any of them sounds shaky, review the theory before going on.
The usual colours are red , green , blue , yellow , cyan , magenta and white . In we use the exam’s letters, .
How to solve a subspaces problem on paper
- Data: write the vectors in a matrix. As rows if you only want the rank or any basis; as columns if you are asked for original vectors or the coefficients of a combination.
- Rank: row-reduce and count the steps. The rank is the dimension of the spanned subspace and decides independence, spanning and basis.
- Solve: if there are equations (implicit ones, or a combination to find), it is a system; if parameters have to be eliminated, require the rank not to grow when you add .
- Check: every basis vector satisfies the implicit equations, and the dimensions agree with Grassmann.
Problem 1: three colours with a parameter
Statement. A designer works with three colours: , and , with .
a) For which values of do they form a basis of ?
b) For the value of where they do not, write the dependence relation.
c) With , compute the coordinates of the colour in that basis.
The idea
Three vectors of are a basis if and only if they are independent, and with three vectors that is a non-zero determinant. For b), the value that makes the determinant zero leaves one vector that can be mixed from the others: you have to find the recipe. And c) is a system with the vectors as columns.
Expand the determinant along the first row: it has a 0 and saves you one product.
Step by step
a) With the vectors as rows:
It is zero only at . So they are a basis of for every , and for they are dependent (their rank is 2, because and are not proportional).
b) With , . I look for :
The first and third components give and , and the second confirms it: . So , or in the form of the definition:
c) With , I look for . Component by component:
From the bottom up: ; ; . The coordinates are .
Notice that here the vectors go as columns: the first column of the augmented matrix is , and each row is one component of the colour.
Check
. And the determinant with is , non-zero: it was a basis.
Check you’ve got it: what would happen if you used k = 5 in c)?
The colour would have no coordinates: there is no way to mix it from those three vectors. Step by step: with you already know from b) that , so the third vector adds nothing and the three together only reach what and reach. So look for : the first component gives , the third gives , and the second would have to be , not 4. It does not work.
The augmented matrix of c) shows the same: with the same two operations, and , the last row becomes : it asks for , and the system is inconsistent.
And a colour that is within reach would have infinitely many recipes: itself is or , among others. That is why we only talk about coordinates in a basis: they have to exist and be unique, and a non-zero determinant guarantees exactly that.
Check it in MATLAB
format rat syms k det([1 2 0; 0 1 1; 2 k 1]) % the determinant as a function of k A = [1 2 0; 0 1 1; 2 0 1]; % the vectors with k = 0, as rows A' \ [3; 4; 3] % coordinates: the vectors as columns
Output:
ans =
5 - k
ans =
1
2
1
A' puts the vectors as columns, which is how the coordinates system has to be set up. If you write A \ [3; 4; 3], with the vectors as rows, MATLAB solves a different system and gives different numbers without complaining.
Questions you might ask
Can I decide a) by row-reducing instead of with the determinant? Yes, but with inside you would have to separate the case where a pivot is 0. With three vectors of , the determinant is fastest.
Why is “they are dependent” not enough in b)? Because you are asked for the relation: some scalars, not all zero, that give . The way to find them is the same as for coordinates.
Saying that for “no vector is a combination of the others” because none is a multiple of another. Dependence does not require proportionality: is a mix of two vectors, not a multiple of one.
Try it yourself
- With , compute the coordinates of . (You get .)
- For which are , and a basis? (For .)
Problem 2: from one colour basis to another
Statement. In consider the bases (yellow, cyan, magenta) and (white, yellow, red).
a) Compute the change-of-basis matrix .
b) A colour has coordinates in . Compute its coordinates in .
The idea
Neither is the standard basis, so it is rule 3 from the theory: go from to the standard basis (columns of ) and from the standard basis to (inverse of the columns of ). Or, which is the same and sometimes shorter, write each vector of in : each one gives a column.
is a “staircase”: white has the three lights, yellow two and red one. To write a colour in , the component tells you how much white you need, and you go down from there.
Step by step
a) I write each vector of in . For yellow, :
- Third component: .
- Second: .
- First: .
Coordinates : yellow is a vector of , of course. For cyan, : , , . For magenta, : , , . Each result is a column:
Rule 3 gives the same: , with the columns of and those of . Writing each vector in the other basis avoids computing an inverse by hand.
The three columns, without skipping anything. The order in which you solve the components is not the usual one: you start with the third, because in only white has a third component, and from there you climb the staircase.
| Colour of | Third: | Second: | First: | Column | Why |
|---|---|---|---|---|---|
| Yellow | It is the second vector of : no white and no red. | ||||
| Cyan | Cyan needs blue, and only white gives it; but white brings extra red, and red with takes it away. | ||||
| Magenta | White again, for the blue. The green is extra: yellow with removes it, but takes the red too, and red with gives it back. |
Each result goes in its own column, in the order of : yellow, cyan, magenta. That is how to read the matrix: column holds the coordinates in of vector of .
Writing those coordinates as rows. You get the transpose, and multiplying it by gives , which in is the colour , not . The check at the end gives it away.
b) I multiply the matrix by the coordinates in :
Check
The coordinates in are the colour from the theory. In : . The same colour.
Check it in MATLAB
P = [1 0 1; 1 1 0; 0 1 1]; % columns: yellow, cyan, magenta (B') Q = [1 1 1; 1 1 0; 1 0 0]; % columns: white, yellow, red (B'') C = inv(Q) * P % from B' to B'' C * [2; 3; 1]
Output:
C =
0 1 1
1 0 -1
0 -1 1
ans =
4
1
-2
inv(Q) * P is rule 3 as it is. In MATLAB it is more accurate to write Q \ P, which solves the systems without computing the inverse, but with numbers this small it makes no difference.
Questions you might ask
And if I am asked for ? It is the inverse of the one you have just computed: .
Why the order and not ? Because acts first (from to the standard basis) and then (from the standard basis to ). In a product of matrices, what acts first goes on the right.
Writing . That is the matrix of the way back, from to . Always check with a vector, as in the check above.
Try it yourself
- Compute the coordinates of cyan, , in without using the matrix. (They must match its column: .)
- Compute and check that times it gives .
Problem 3: a basis with original vectors
Statement. In consider with , , , and .
a) Compute the dimension of .
b) Give a basis of made of vectors of .
c) Write the vectors of that are not in the basis as combinations of those in the basis.
The idea
You are asked for original vectors and also for combinations: it is method 2, the vectors as columns and Gauss-Jordan down to the reduced form. The pivot columns say which vectors to choose; the columns without a pivot say, with their numbers, how to write the spare ones.
Before row-reducing, try whether is a simple mix of and . Look at the second component.
Step by step
a) and b) The five vectors as columns:
(In the last step, first , which leaves , and with that new row .) Three steps: . The pivots are in columns 1, 2 and 4, so a basis with vectors of is
copied from , not from the reduced form.
The reduction above, operation by operation. Every step looks for the same thing: making zeros below the pivot of the column you are in and, at the end, above it too.
| Step | Operation | Resulting row | Why |
|---|---|---|---|
| 1 | The 2 in column 1 has to become 0, and starts with 1: subtract it twice. | ||
| 2 | The same with the 1 in . Column 1 now only has its pivot. | ||
| 3 | The pivot of column 2 is the 1 in and below it there is a : add. Column 3 is cleared with it. | ||
| 4 | The same in , the same addition. Column 3 is left with nothing below : it will have no step. | ||
| 5 | The next pivot is the 1 in , in column 4, and below it there is a 3. The whole row goes: three steps remain. | ||
| 6 | Now upwards: the 1 of in column 4 has to become 0. | ||
| 7 | With the new , the 2 of in column 2 goes. In column 4, already had a 0. |
And why can you read the recipe in the reduced form if the original vectors are not there? Because row operations do not change the relations between columns. If in the reduced form column 3 is twice column 1 minus column 2, exactly the same holds in the starting matrix. The reduced form just makes that relation visible at a glance.
c) The columns without a pivot are read in the reduced form. Column 3, in the pivot rows, says . Column 5, , says .
Check
. And .
Check it in MATLAB
S = [1 0 2 1; 2 1 3 1; 0 -1 1 1; 0 1 0 2; 1 1 2 3]; % as rows, as they are read rank(S) [R, piv] = rref(S') % S' puts them as columns S(piv, :) % the basis: rows piv of S, the original vectors
Output:
ans =
3
R =
1 0 2 0 1
0 1 -1 0 0
0 0 0 1 1
0 0 0 0 0
piv =
1 2 4
ans =
1 0 2 1
2 1 3 1
0 1 0 2
S(piv, :) takes from the rows whose number is in piv: that way you copy the originals without typing them, which is exactly what the assignment asked for.
Questions you might ask
Is there another basis with original vectors? Yes: for example is one too. Method 2 gives you one, the one you get by choosing the pivots from left to right.
Why does method 1 not work here? The rows of the echelon form are mixes of the vectors, not the vectors. They work as a basis, but they are not “from “.
Giving as the basis columns 1, 2 and 4 of the reduced form, , and . They are not even vectors of : the reduced form changes the vectors, it only keeps the relations between columns.
Try it yourself
- Remove from . Does the dimension change? (No: it is still 3, with basis , because brings the direction that gave.)
- Check that is a basis of : its rank must be 3.
Problem 4: implicit equations and a basis in , with fractions
Statement. In :
a) Compute some implicit equations of the subspace .
b) Compute a basis and the dimension of , first with fractions and then without them.
The idea
a) goes from a basis to implicit equations: (the two vectors are not proportional), so there will be equations. I get them from the parametric equations, eliminating the parameters. b) goes from implicit equations to a basis: solve the homogeneous system. With two independent equations in , .
In a), the parameters are already isolated in two of the parametric equations: look at and .
Step by step
a) The parametric equations of :
As and , I substitute in the other two:
Two equations, as expected. (Via the rank you get the same: row-reducing the matrix with the row leaves two positions without a pivot, and , which must be 0.)
b) Gauss-Jordan on the coefficients (in a homogeneous system the column of zeros is not needed). I put the second equation first, which starts with 1:
The free ones are and : , . Splitting:
Basis with fractions: , . Multiplying each vector by 3 (a non-zero multiple does not change what it spans): .
Check
a) The two basis vectors of satisfy both equations: gives and ; gives and .
b) in : and .
Check it in MATLAB
null([1 1 -1 0; 2 -1 0 -1], 'r') % a) the implicit equations of U give back its basis null([2 1 -1 3; 1 -1 2 -1], 'r') % b) the basis of W, with fractions
Output:
ans =
1/3 1/3
2/3 -1/3
1 0
0 1
ans =
-1/3 -2/3
5/3 -5/3
1 0
0 1
The first command checks a) backwards: if the implicit equations are right, their basis has to span the same as and . Other vectors come out, and , but they span the same thing: the first of ours is , and the second, the first minus the second. A subspace has many bases.
Questions you might ask
Can I give the basis without fractions if the statement says nothing? Yes, on paper any basis is fine. But in the MATLAB assignment, if you are asked for the basis “with format rat“, you have to write exactly what comes out, fractions included: the box compares numbers.
Why does null(..., 'r') put a 1 and a 0 in the last components? Because it chooses the unknowns without a pivot as parameters and gives them the values 1 and 0, as we did by hand.
Miscounting the implicit equations. If you write three equations for and they are independent, they no longer describe a plane of but a line. Before writing any, work out how many are due: .
Try it yourself
- Implicit equations of . (For example, and .)
- Basis of in . How many vectors does it have? (Three.)
Problem 5: how the exam asks it
Exam-style exercise. [10 points] In consider the subspaces and . a) (4 points) Compute a basis, the dimension and some parametric equations of , and a basis, the dimension and some implicit equations of . b) (4 points) Compute a basis, the dimension and some implicit equations of , and a basis, the dimension and some parametric equations of . c) (2 points) Justify whether the vector belongs to and/or to , and whether and are complementary.
The idea
It is exercise 1 of every exam in recent years, with the subspaces changed. The order of work is always the same: each subspace in its three portraits; the sum with bases; the intersection with implicit equations; Grassmann to check; and membership by substituting into implicit equations.
In , check whether the third and fourth vectors are simple mixes of the first two before row-reducing. And for the intersection, add the equations of to the one of : something very simple comes out.
Step by step
a) . Two independent equations in : . They are already in echelon form (the first starts with , the second with ), so the free ones are and . From the second, ; from the first, :
a) . The third vector is the sum of the first two: . The fourth is not a combination of the first two (its fourth component would force ), so I row-reduce vectors 1, 2 and 4 as rows, with the row at the end to get the implicit equation at the same time:
The third row: , , , . Three steps: and . Now the last row: gives , and clears the fourth position. What is left is
For the rank to stay 3, that position must be 0:
One equation, , as expected.
The last row, without skipping anything. You treat as one more row and keep making zeros in it with the pivots above; whatever cannot be cleared is the condition.
| Operation | Row 4 afterwards | Why |
|---|---|---|
| (start) | Any vector of : we want to know when it is in . | |
| The pivot of is a 1 in the first column: subtracting times removes the . As , is also subtracted in the third and fourth positions. | ||
| The pivot of is a 1 in the second column. has another 1 in the third position: that is why is subtracted there too. | ||
| has its pivot in the fourth column. Adding it times, the fourth position becomes . |
The third position has no pivot above it to clear it: none of the three rows above starts there. If , that row would be a fourth step, the rank would go up to 4 and would not be a combination of the vectors of . That is why the condition is , which is the same equation as with the sign changed.
b) Sum. I merge the bases: . It is enough to see whether some vector of falls outside : in the implicit equation of gives . So adding it to the basis of raises the rank to 4: , . A basis is the standard one (or plus ), and it has no implicit equations: , there is no condition at all.
b) Intersection. I put the three implicit equations together:
Adding the first and the third, , so . Then the third gives , and the second, . With :
Grassmann confirms it: and .
c) , because contains every vector. For the intersection it would have to satisfy the three implicit equations, and the first already fails: . It is not in , so it is not in (it is in : ). And they are not complementary: although , the intersection is not , so the sum is not direct. Every vector of can be split in infinitely many ways into a piece of and a piece of .
Check it in MATLAB
U1 = [1 -1 1 0; 0 1 1 -1]; % implicit equations of U1 S2 = [1 0 1 1; 0 1 1 0; 1 1 2 1; 2 1 3 1]; % spanning vectors of U2 B1 = null(U1, 'r')' % basis of U1 (as rows) [R2, p2] = rref(S2'); B2 = S2(p2, :) % basis of U2 with original vectors rank([B1; B2]) % dim(U1 + U2) null([U1; 1 1 -1 0], 'r')' % basis of the intersection
Output:
B1 =
-2 -1 1 0
1 1 0 1
B2 =
1 0 1 1
0 1 1 0
2 1 3 1
ans =
4
ans =
0 1/2 1/2 1
null(U1, 'r')' has an apostrophe at the end to get the basis as rows, the way we write it on paper. The intersection comes out as : it is our divided by 2, the same subspace.
Check and how it is marked
The bases satisfy their implicit equations: in gives and ; satisfies the three equations (, , ).
Indicative split of the 10 points (mine, not the official one):
| Part | What is assessed | Points |
|---|---|---|
| a) | Basis, dimension and parametric equations of | 2 |
| a) | Basis, dimension and implicit equations of | 2 |
| b) | Basis and dimension of the sum, and saying it has no implicit equations | 2 |
| b) | Basis, dimension and parametric equations of the intersection | 2 |
| c) | Membership of the sum and of the intersection, justified | 1 |
| c) | Complementary: checking both conditions | 1 |
Questions you might ask
Do I have to row-reduce the whole sum? No: it is enough to see that the dimension reaches 4 (here, a vector of that does not satisfy the implicit equation of ). If it did not, you would have to row-reduce and get the implicit equations of the sum.
And if the sum comes out with an implicit equation and ? There is a mistake: a subspace of dimension 4 in is the whole space and has no conditions.
Concluding “complementary” because . The other condition is missing, , which does not hold here. With Grassmann you see it instantly: , so the intersection cannot be just .
Try it yourself
- Change to and redo b). (Now and : they are complementary.)
- Check your previous result with Grassmann: .
Common mistakes in this practice
- Putting the vectors as rows when coordinates or original vectors are asked for (they go as columns).
- Copying the reduced form instead of the original vectors the pivots point to.
- Writing more or fewer implicit equations than due: they are .
- Computing the intersection by merging bases (that is the sum) or the sum by merging equations (that is the intersection).
- Calling two subspaces complementary because their sum is the whole space without looking at the intersection.
- In MATLAB, forgetting
format rator writing the basis fromnullas rows when the box wants it as it comes out.
Try it in the MATLAB playground
In the website’s MATLAB playground you can redo problem 5 with your own subspaces:
format rat U1 = [1 -1 1 0; 0 1 1 -1]; % implicit equations of U1 (one row per equation) S2 = [1 0 1 1; 0 1 1 0; 1 1 2 1; 2 1 3 1]; % spanning vectors of U2 (one per row) B1 = null(U1, 'r')'; [R2, p2] = rref(S2'); B2 = S2(p2, :); E2 = null(B2, 'r')' % implicit equations of U2: one row per equation dim_sum = rank([B1; B2]) dim_int = size(B1, 1) + size(B2, 1) - dim_sum % Grassmann
Things to look at:
null(B2, 'r')'gives the implicit equations of : the vectors perpendicular to every basis vector are exactly the coefficients of its equations. In topic 4 you will see why.- Change
S2to the spanning vectors of the first “Try it yourself” and watchdim_intbecome 0. - If you want to follow each row operation, put
S2'into the Gauss-Jordan step-by-step simulator: it marks the pivots and the rank.
Summary
- Three vectors of are a basis if and only if their determinant is not 0; with a parameter, the value that makes it zero is the one that makes them dependent.
- For coordinates, combinations and original vectors, the vectors go as columns.
- Between two non-standard bases, , or write each vector of in .
- There are implicit equations; you get them by eliminating parameters or requiring the rank not to grow.
- In the exam exercise: sum with bases, intersection with implicit equations, Grassmann to check, and complementary only if sum and intersection .
Checklist: have you practised it?
- Can you decide with a determinant for which value of a parameter three vectors stop being a basis?
- Can you write the dependence relation and not just say “they are dependent”?
- Have you computed the change-of-basis matrix between two non-standard bases and checked it with a vector?
- Do you give the basis with original vectors by copying them from and not from the reduced form?
- Do you count how many implicit equations are due before writing them?
- Have you done problem 5 entirely without looking and checked that Grassmann agrees?
- Have you run the MATLAB blocks and checked the outputs?
If you answered yes to almost everything, you are ready for the vector spaces exercises, where I no longer give you the step by step and there is a 20-question quiz like the Campus ones.
Next step: exercisesVector spaces — exam-style exercises with colours and subspaces of R⁴: bases, implicit equations, Grassmann and a Campus-style quiz (and the parameter I got wrong)Did this article help you? Here is how you can support SergioLearns →



