Type at least 2 letters. Enter opens the first result, Esc closes.

    Linear Algebra · Lesson 1 · Start here: matrices and subspaces

    Matrices as maps, span, basis and the views of matrix multiplication

    Beginner 50 min 3 interactive figures 3 videos Colab notebook

    Before this lesson: nothing from this track; this is the first lesson. You need vectors in Rn\mathbb{R}^n (lists of nn real numbers), vector addition and multiplication by a number. Time: about 50 minutes, plus the notebook.


    Why this matters #

    A linear layer computes y=Wxy = Wx. Every output is a combination of the columns of WW, so all outputs live in the span of those columns. Independence and basis answer "how many directions are really there?": how many features carry new information, and whether coordinates are unique. The views of matrix multiplication are tools for every later lesson: the column view gives rank bounds, and the outer-product view is the language of low rank (SVD, PCA, LoRA, attention).

    1. Predict first #

    2. The picture #

    Start in the plane. Write e1=(1,0)e_1 = (1, 0) and e2=(0,1)e_2 = (0, 1) for the standard basis vectors. Every x=(x1,x2)x = (x_1, x_2) equals x1e1+x2e2x_1 e_1 + x_2 e_2. A 2×22 \times 2 matrix AA with columns a1,a2a_1, a_2 gives

    Ax=x1a1+x2a2.Ax = x_1 a_1 + x_2 a_2 .

    So Ae1=a1Ae_1 = a_1 and Ae2=a2Ae_2 = a_2: the columns are where the basis vectors land. The unit square (spanned by e1,e2e_1, e_2) goes to the parallelogram spanned by a1,a2a_1, a_2. The grid lines go to parallel, evenly spaced lines, and the origin stays fixed. This is what "linear" looks like.

    Interactive figure: loading…

    Try it. Drag the orange and blue tips: they are the columns of AA, the images of e1e_1 and e2e_2. The grey arrow xx is a test vector and AxAx is its image, built as x1a1+x2a2x_1 a_1 + x_2 a_2. Use the presets for the five cases in the table below, and make the columns parallel to see the plane flatten.

    To read a 2×22 \times 2 matrix, draw its two columns:

    Matrix Ae1Ae_1, Ae2Ae_2 What it does to the plane
    (2001/2)\begin{pmatrix} 2 & 0 \\ 0 & 1/2 \end{pmatrix} (2,0)(2, 0), (0,1/2)(0, 1/2) stretch along xx by 2, squeeze along yy by 1/2
    (cos⁡θ−sin⁡θsin⁡θcos⁡θ)\begin{pmatrix} \cos\theta & -\sin\theta \\ \sin\theta & \cos\theta \end{pmatrix} e1e_1, e2e_2 turned by θ\theta rotate by the angle θ\theta, counter-clockwise
    (1101)\begin{pmatrix} 1 & 1 \\ 0 & 1 \end{pmatrix} (1,0)(1, 0), (1,1)(1, 1) shear: (x,y)↦(x+y,y)(x, y) \mapsto (x + y, y)
    (100−1)\begin{pmatrix} 1 & 0 \\ 0 & -1 \end{pmatrix} (1,0)(1, 0), (0,−1)(0, -1) reflect across the xx-axis
    (1224)\begin{pmatrix} 1 & 2 \\ 2 & 4 \end{pmatrix} (1,2)(1, 2), (2,4)(2, 4) flatten the plane onto the line through (1,2)(1, 2)

    The last row is the warning sign: parallel columns flatten. Every output x1(1,2)+x2(2,4)=(x1+2x2)(1,2)x_1(1, 2) + x_2(2, 4) = (x_1 + 2x_2)(1, 2) lies on one line, and the input direction (2,−1)(2, -1) goes to zero.

    Span, independence and basis, as pictures. The span of some vectors is everything their combinations reach: one nonzero vector spans a line through 0, two non-parallel vectors in R3\mathbb{R}^3 span a plane through 0. A third vector inside that plane adds no new direction: the three are dependent. A basis has enough vectors to reach everything and no extra ones; its size is the dimension.

    Interactive figure: loading…

    Span in R3\mathbb{R}^3. Rotate the figure by dragging. With "v₃ in the plane", the third vector adds no new direction: the span stays a plane and the readout shows the dependency. Edit one entry of v3v_3 to lift it off the plane and the span becomes all of R3\mathbb{R}^3. The sliders move the thick dark arrow, the combination c1v1+c2v2+c3v3c_1v_1 + c_2v_2 + c_3v_3; it can never leave the span.

    Quick check

    The columns of a 2×22 \times 2 matrix AA are a1=(2,0)a_1 = (2, 0) and a2=(1,1)a_2 = (1, 1). Where does AA send x=(1,2)x = (1, 2)?

    Quick check

    Three vectors in R3\mathbb{R}^3 all lie in one plane through 00. What is their span?

    3. Definitions and main results #

    Linear maps and their matrices #

    A map T:Rn→RmT: \mathbb{R}^n \to \mathbb{R}^m is linear if T(αx+βy)=αT(x)+βT(y)T(\alpha x + \beta y) = \alpha T(x) + \beta T(y) for all vectors x,yx, y and all numbers α,β\alpha, \beta. With α=β=0\alpha = \beta = 0 this gives T(0)=0T(0) = 0. So a shift x↦x+bx \mapsto x + b with b≠0b \ne 0 is not linear; it is affine.

    Theorem (a linear map is fixed by the images of the basis vectors). Let TT be linear, and let AA be the m×nm \times n matrix whose column jj is T(ej)T(e_j). Then T(x)=AxT(x) = Ax for every xx.

    Proof.

    1. Write x=x1e1+⋯+xnenx = x_1 e_1 + \dots + x_n e_n: the entries of xx are its coordinates in the standard basis.
    2. Linearity gives T(x)=x1T(e1)+⋯+xnT(en)T(x) = x_1 T(e_1) + \dots + x_n T(e_n).
    3. The product is defined by (Ax)i=∑jAijxj(Ax)_i = \sum_j A_{ij} x_j. Read column by column, this says Ax=x1a1+⋯+xnanAx = x_1 a_1 + \dots + x_n a_n, where aja_j is column jj of AA.
    4. With aj=T(ej)a_j = T(e_j), steps 2 and 3 give the same vector. ■\blacksquare

    So once the basis is fixed, "matrix" and "linear map" are the same thing. The nn vectors T(e1),…,T(en)T(e_1), \dots, T(e_n) store everything about TT.

    Span, subspace, independence, basis, dimension #

    Let v1,…,vk∈Rmv_1, \dots, v_k \in \mathbb{R}^m, and let V=[v1  ⋯  vk]V = [v_1 \; \cdots \; v_k] be the m×km \times k matrix with these columns.

    • A linear combination is c1v1+⋯+ckvk=Vcc_1 v_1 + \dots + c_k v_k = Vc, with c=(c1,…,ck)c = (c_1, \dots, c_k).
    • The span is the set of all linear combinations: span⁡(v1,…,vk)={Vc:c∈Rk}=C(V)\operatorname{span}(v_1, \dots, v_k) = \{Vc : c \in \mathbb{R}^k\} = C(V), the column space of VV.
    • A subspace is a set that contains 0 and is closed under addition and scaling. Every span is a subspace.
    • v1,…,vkv_1, \dots, v_k are linearly independent if c1v1+⋯+ckvk=0c_1 v_1 + \dots + c_k v_k = 0 only for c=0c = 0. Otherwise they are dependent, and every vjv_j with cj≠0c_j \ne 0 is a combination of the others.
    • A basis of a subspace SS is an independent list that spans SS. The dimension dim⁡S\dim S is the number of vectors in a basis.

    Coordinates are unique. Let v1,…,vkv_1, \dots, v_k be a basis and x=∑jcjvj=∑jdjvjx = \sum_j c_j v_j = \sum_j d_j v_j. Then ∑j(cj−dj)vj=0\sum_j (c_j - d_j) v_j = 0, and independence gives cj=djc_j = d_j for every jj. The numbers cjc_j are the coordinates of xx in that basis. Lesson 04 converts between bases.

    The null-space test for independence #

    Theorem (null-space test). The columns of VV are independent   ⟺  \iff N(V)={0}N(V) = \{0\}, where N(V)={c:Vc=0}N(V) = \{c : Vc = 0\} is the null space of VV.

    Proof. Vc=c1v1+⋯+ckvkVc = c_1 v_1 + \dots + c_k v_k. A nonzero cc with Vc=0Vc = 0 is exactly a nontrivial combination that equals 0. ■\blacksquare

    How to run the test. Use elimination (lesson 02 gives the full theory): subtract multiples of rows to create zeros below each pivot. A column without a pivot is free.

    • Every column has a pivot: N(V)={0}N(V) = \{0\}, the vectors are independent.
    • Column jj is free: set cj=1c_j = 1 and the other free entries to 0, and solve for the pivot entries from the bottom row up. This gives a nonzero cc with Vc=0Vc = 0: the dependency.

    Corollary (too many vectors). More than mm vectors in Rm\mathbb{R}^m are always dependent. Each pivot needs its own row, so there are at most mm pivots. With k>mk > m columns, at least one column is free.

    Quick check

    You eliminate the matrix VV whose columns are four vectors in R3\mathbb{R}^3. What can you say before you start?

    Dimension is well defined #

    Lemma. If w1,…,wnw_1, \dots, w_n span a subspace SS, then any m>nm > n vectors v1,…,vmv_1, \dots, v_m in SS are dependent.

    Proof.

    1. Each vjv_j lies in S=span⁡(w1,…,wn)S = \operatorname{span}(w_1, \dots, w_n), so vj=∑icijwiv_j = \sum_i c_{ij} w_i. In matrix form, V=WCV = WC with W=[w1  ⋯  wn]W = [w_1 \; \cdots \; w_n] and CC of size n×mn \times m.
    2. CC is wide (m>nm > n), so by the corollary it has a vector x≠0x \ne 0 with Cx=0Cx = 0.
    3. Then Vx=W(Cx)=0Vx = W(Cx) = 0 with x≠0x \ne 0: the vjv_j are dependent. ■\blacksquare

    Theorem (every basis has the same size). If v1,…,vmv_1, \dots, v_m and w1,…,wnw_1, \dots, w_n are both bases of SS, then m=nm = n.

    Proof. The ww's span SS and the vv's are independent, so the lemma rules out m>nm > n. Hence m≤nm \le n. Swap the roles of the two bases: n≤mn \le m. ■\blacksquare

    Two more consequences of the lemma (Axler 2.38 and 2.42): nn independent vectors in Rn\mathbb{R}^n also span it, and nn vectors that span Rn\mathbb{R}^n are also independent. So to decide whether nn vectors form a basis of Rn\mathbb{R}^n, check one thing only: independence (N(V)={0}N(V) = \{0\}, or det⁡V≠0\det V \ne 0 from lesson 03).

    Four views of matrix multiplication #

    Let AA be m×pm \times p, with columns a1,…,apa_1, \dots, a_p and rows α1⊤,…,αm⊤\alpha_1^\top, \dots, \alpha_m^\top. Let BB be p×np \times n, with columns b1,…,bnb_1, \dots, b_n and rows β1⊤,…,βp⊤\beta_1^\top, \dots, \beta_p^\top. The product ABAB is m×nm \times n.

    View Formula What it says
    entry (AB)ij=αi⊤bj=∑kAikBkj(AB)_{ij} = \alpha_i^\top b_j = \sum_k A_{ik} B_{kj} row ii of AA times column jj of BB
    column AB=[Ab1  ⋯  Abn]AB = [Ab_1 \; \cdots \; Ab_n] each column of ABAB is a combination of the columns of AA
    row row ii of ABAB =αi⊤B= \alpha_i^\top B each row of ABAB is a combination of the rows of BB
    outer product AB=∑k=1pakβk⊤AB = \sum_{k=1}^{p} a_k \beta_k^\top a sum of pp matrices of rank at most 1

    Why they agree. All four compute the same numbers ∑kAikBkj\sum_k A_{ik} B_{kj}; only the order of the loops changes. For the outer-product view: the (i,j)(i, j) entry of akβk⊤a_k \beta_k^\top is AikBkjA_{ik} B_{kj}, and the sum over kk gives (AB)ij(AB)_{ij}.

    Interactive figure: loading…

    One product, four readings. Switch the view and press Next part to step through the columns, rows, entries or rank-1 terms of ABAB for A=(2113)A = \begin{pmatrix} 2 & 1 \\ 1 & 3 \end{pmatrix}, B=(1−121)B = \begin{pmatrix} 1 & -1 \\ 2 & 1 \end{pmatrix}. In the column view, each column of ABAB is a walk along the columns a1a_1 and a2a_2 of AA, so it stays in C(A)C(A).

    Why the product is defined this way. ABAB is the matrix of the composition "first BB, then AA": (AB)x=A(Bx)(AB)x = A(Bx). Its column jj is A(Bej)=AbjA(Be_j) = Ab_j (the column view), and the columns fix the map. Composition is associative, so (AB)C=A(BC)(AB)C = A(BC), but not commutative: "rotate, then shear" differs from "shear, then rotate".

    Two consequences you will use all the time.

    • Rank bound. By the column view, C(AB)⊆C(A)C(AB) \subseteq C(A). By the row view, the row space of ABAB lies inside the row space of BB. So rank⁡(AB)≤min⁡(rank⁡A,rank⁡B)\operatorname{rank}(AB) \le \min(\operatorname{rank} A, \operatorname{rank} B) (lesson 02 defines rank and shows row rank = column rank).
    • Low rank. An outer product uv⊤uv^\top with u,v≠0u, v \ne 0 has rank 1: column jj is vjuv_j u. A sum of kk outer products ∑i=1kuivi⊤\sum_{i=1}^k u_i v_i^\top equals UV⊤UV^\top, where UU has columns u1,…,uku_1, \dots, u_k and VV has columns v1,…,vkv_1, \dots, v_k. Its rank is at most kk.

    Cost. Every view needs mpnmpn multiplications and about as many additions; the views differ only in the loop order and the memory access. Blocked GEMM kernels on CPUs and GPUs use the outer-product order: they add up products of thin column blocks of AA and row blocks of BB.

    Answers to section 1. (1) No. Three vectors in R2\mathbb{R}^2 are more than m=2m = 2, so they are dependent (corollary). (2) One. Column jj of uv⊤uv^\top is vjuv_j u, a multiple of uu, so all columns lie on one line: rank 1 when u,v≠0u, v \ne 0.

    Quick check

    u∈R5u \in \mathbb{R}^5 and v∈R4v \in \mathbb{R}^4 are nonzero. What is the rank of the 5×45 \times 4 matrix uv⊤uv^\top?

    4. Worked example #

    (a) A matrix as a map. A=(1102)A = \begin{pmatrix} 1 & 1 \\ 0 & 2 \end{pmatrix} sends e1↦(1,0)e_1 \mapsto (1, 0) and e2↦(1,2)e_2 \mapsto (1, 2). Without row-times-column:

    A(21)=2(10)+1(12)=(32).A\begin{pmatrix}2\\1\end{pmatrix} = 2\begin{pmatrix}1\\0\end{pmatrix} + 1\begin{pmatrix}1\\2\end{pmatrix} = \begin{pmatrix}3\\2\end{pmatrix}.

    The unit square goes to the parallelogram with corners (0,0)(0,0), (1,0)(1,0), (2,2)(2,2), (1,2)(1,2). The map is (x,y)↦(x+y,2y)(x, y) \mapsto (x + y, 2y): the shear (x,y)↦(x+y,y)(x, y) \mapsto (x + y, y), then a vertical stretch by 2. The area becomes 2 (lesson 03: area scale =∣det⁡A∣= |\det A|).

    (b) Independence and basis. Do v1=(1,2,0)v_1 = (1, 2, 0), v2=(0,1,1)v_2 = (0, 1, 1), v3=(2,5,1)v_3 = (2, 5, 1) form a basis of R3\mathbb{R}^3? Put them as columns and eliminate:

    V=(102215011)→R2−2R1(102011011)→R3−R2(102011000).V = \begin{pmatrix} 1 & 0 & 2 \\ 2 & 1 & 5 \\ 0 & 1 & 1 \end{pmatrix} \xrightarrow{R_2 - 2R_1} \begin{pmatrix} 1 & 0 & 2 \\ 0 & 1 & 1 \\ 0 & 1 & 1 \end{pmatrix} \xrightarrow{R_3 - R_2} \begin{pmatrix} 1 & 0 & 2 \\ 0 & 1 & 1 \\ 0 & 0 & 0 \end{pmatrix}.

    Pivots are in columns 1 and 2; column 3 is free. Set c3=1c_3 = 1. Row 2 gives c2+1=0c_2 + 1 = 0, so c2=−1c_2 = -1. Row 1 gives c1+2=0c_1 + 2 = 0, so c1=−2c_1 = -2. So c=(−2,−1,1)∈N(V)c = (-2, -1, 1) \in N(V), and

    −2v1−v2+v3=0,that is,v3=2v1+v2.-2v_1 - v_2 + v_3 = 0, \qquad\text{that is,}\qquad v_3 = 2v_1 + v_2 .

    Not a basis. The span is a plane with basis {v1,v2}\{v_1, v_2\}, dimension 2. A normal vector of the plane is v1×v2=(2,−1,1)v_1 \times v_2 = (2, -1, 1), so the plane is 2x−y+z=02x - y + z = 0. Check v3v_3: 4−5+1=04 - 5 + 1 = 0 ✓.

    Now replace v3v_3 by w=(0,0,1)w = (0, 0, 1): 2⋅0−0+1=1≠02 \cdot 0 - 0 + 1 = 1 \ne 0, so ww is outside the plane, and v1,v2,wv_1, v_2, w are three independent vectors in R3\mathbb{R}^3: a basis.

    (c) Four views of one product.

    A=(102103),B=(121−1),AB=(12333−3).A = \begin{pmatrix} 1 & 0 \\ 2 & 1 \\ 0 & 3 \end{pmatrix}, \qquad B = \begin{pmatrix} 1 & 2 \\ 1 & -1 \end{pmatrix}, \qquad AB = \begin{pmatrix} 1 & 2 \\ 3 & 3 \\ 3 & -3 \end{pmatrix}.
    • Entry: (AB)21=(2,1)⋅(1,1)=3(AB)_{21} = (2, 1) \cdot (1, 1) = 3.
    • Column: column 1 of ABAB is A(1,1)=1⋅(1,2,0)+1⋅(0,1,3)=(1,3,3)A(1, 1) = 1 \cdot (1, 2, 0) + 1 \cdot (0, 1, 3) = (1, 3, 3), and column 2 is A(2,−1)=2⋅(1,2,0)−(0,1,3)=(2,3,−3)A(2, -1) = 2 \cdot (1, 2, 0) - (0, 1, 3) = (2, 3, -3).
    • Row: row 2 of ABAB is 2⋅(1,2)+1⋅(1,−1)=(3,3)2 \cdot (1, 2) + 1 \cdot (1, -1) = (3, 3).
    • Outer products (column kk of AA times row kk of BB):
    (120)(12)+(013)(1−1)=(122400)+(001−13−3)=(12333−3).\begin{pmatrix}1\\2\\0\end{pmatrix}\begin{pmatrix}1 & 2\end{pmatrix} + \begin{pmatrix}0\\1\\3\end{pmatrix}\begin{pmatrix}1 & -1\end{pmatrix} = \begin{pmatrix}1&2\\2&4\\0&0\end{pmatrix} + \begin{pmatrix}0&0\\1&-1\\3&-3\end{pmatrix} = \begin{pmatrix}1&2\\3&3\\3&-3\end{pmatrix}.

    5. In code #

    NumPy checks the hand computations above. The notebook for this lesson has these cells and the exercises.

    import numpy as np
    from scipy.linalg import null_space
    
    # (a) the columns are the images of e1 and e2
    A = np.array([[1., 1.], [0., 2.]])
    print(A @ np.array([1., 0.]), A @ np.array([0., 1.]))   # [1. 0.] [1. 2.]
    print(A @ np.array([2., 1.]))                            # [3. 2.]
    
    # (b) independence through the null space
    V = np.array([[1., 0., 2.],
                  [2., 1., 5.],
                  [0., 1., 1.]])        # columns v1, v2, v3
    c = null_space(V)[:, 0]             # unit length, any sign
    print(np.linalg.matrix_rank(V), c / c[2])   # 2 [-2. -1.  1.]
    
    # (c) the outer-product view adds up to the product
    A3 = np.array([[1., 0.], [2., 1.], [0., 3.]])
    B = np.array([[1., 2.], [1., -1.]])
    outer_sum = sum(np.outer(A3[:, k], B[k, :]) for k in range(2))
    print(np.array_equal(outer_sum, A3 @ B))    # True
    print((A3 @ B).tolist())                    # [[1.0, 2.0], [3.0, 3.0], [3.0, -3.0]]
    

    null_space returns a unit vector with an arbitrary sign; dividing by its last entry gives the hand scaling. With floats, libraries decide independence with a tolerance on the singular values (lessons 08 and 13).

    6. Where it shows up #

    • Neural networks. A linear layer y=Wxy = Wx outputs a combination of the columns of WW, weighted by the input. With a bias, y=Wx+by = Wx + b is affine, not linear. A one-hot input eje_j selects column jj of WW; an embedding lookup is this product, done without the multiplication.
    • Low rank. LoRA writes a weight update as ΔW=BA\Delta W = BA, with BB of size d×rd \times r and AA of size r×kr \times k. By the outer-product view, ΔW\Delta W is a sum of rr rank-1 matrices, so rank⁡(ΔW)≤r\operatorname{rank}(\Delta W) \le r, with r(d+k)r(d + k) parameters instead of dkdk. The attention score matrix QK⊤QK^\top has rank at most the head dimension dkd_k. Truncated SVD and PCA (lessons 08–09) keep the largest outer products.
    • ML for science. A basis is a choice of coordinates for a field: empirical orthogonal functions (EOFs, the PCA basis) or spherical harmonics in climate science, Fourier modes in spectral solvers and Fourier neural operators. Keeping a few basis vectors means working in a subspace. Independence is identifiability: the effects of dependent predictors in a regression cannot be separated (lesson 02).

    7. Common mistakes #

    • Rows instead of columns. AejAe_j is column jj of AA, not row jj.
    • Checking independence pair by pair. (1,0)(1, 0), (0,1)(0, 1), (1,1)(1, 1) are pairwise non-parallel, but they are dependent. Independence is about all combinations at once.
    • Spanning set vs basis. A spanning set may contain extra vectors; a basis contains none. The dimension counts the vectors of a basis, not of any spanning set.
    • AB=BAAB = BA. False in general, even for square matrices; for non-square shapes BABA may not even exist.
    • Forgetting the origin. A line that misses 0 is not a subspace, and x↦Wx+bx \mapsto Wx + b with b≠0b \ne 0 is not a linear map.

    8. Check yourself #

    1. Which 2×22 \times 2 matrix rotates the plane by 90°90° counter-clockwise? Find it from the images of e1e_1 and e2e_2.
      Answere1↦(0,1)e_1 \mapsto (0, 1) and e2↦(−1,0)e_2 \mapsto (-1, 0), so the columns give A=(0−110)A = \begin{pmatrix} 0 & -1 \\ 1 & 0 \end{pmatrix}.
    2. Do (1,1,0)(1, 1, 0), (1,0,1)(1, 0, 1), (0,1,1)(0, 1, 1) form a basis of R3\mathbb{R}^3?
      AnswerYes. With the vectors as columns, R2−R1=(0,−1,1)R_2 - R_1 = (0, -1, 1), then R3+R2=(0,0,2)R_3 + R_2 = (0, 0, 2): three pivots, so N(V)={0}N(V) = \{0\} and the vectors are independent. Three independent vectors in R3\mathbb{R}^3 also span it. (Also det⁡V=−2≠0\det V = -2 \ne 0.)
    3. M=(1224)M = \begin{pmatrix} 1 & 2 \\ 2 & 4 \end{pmatrix}. Give its column space and its null space, and say what it does to the plane.
      AnswerC(M)C(M) is the line through (1,2)(1, 2). N(M)N(M) is the line through (2,−1)(2, -1), because 2⋅(1,2)−1⋅(2,4)=02 \cdot (1, 2) - 1 \cdot (2, 4) = 0. The plane is flattened onto the line through (1,2)(1, 2), and the direction (2,−1)(2, -1) goes to 0.
    4. Compute u1v1⊤+u2v2⊤u_1 v_1^\top + u_2 v_2^\top for u1=(1,1)u_1 = (1, 1), v1=(1,2)v_1 = (1, 2), u2=(1,−1)u_2 = (1, -1), v2=(3,0)v_2 = (3, 0), and write it as one matrix product.
      Answer(1212)+(30−30)=(42−22)=UV⊤\begin{pmatrix} 1 & 2 \\ 1 & 2 \end{pmatrix} + \begin{pmatrix} 3 & 0 \\ -3 & 0 \end{pmatrix} = \begin{pmatrix} 4 & 2 \\ -2 & 2 \end{pmatrix} = UV^\top with U=(111−1)U = \begin{pmatrix} 1 & 1 \\ 1 & -1 \end{pmatrix} (columns u1,u2u_1, u_2) and V⊤=(1230)V^\top = \begin{pmatrix} 1 & 2 \\ 3 & 0 \end{pmatrix} (rows v1⊤,v2⊤v_1^\top, v_2^\top).
    5. Why is the map x↦Axx \mapsto Ax never one-to-one when AA is 2×32 \times 3?
      AnswerIts three columns are vectors in R2\mathbb{R}^2, so they are dependent: some c≠0c \ne 0 has Ac=0Ac = 0. Then A(x+c)=AxA(x + c) = Ax for every xx, so two different inputs give the same output.
    Recall cardsAnswer in your head first, then reveal. Add the cards to your review deck to see them again just before you would forget.
    1. What is column jj of a matrix AA, as a map?

    2. Write AxAx as a combination of columns.

    3. What does a 2×22 \times 2 matrix with parallel columns do to the plane?

    4. Define linearly independent.

    5. How do you test whether given vectors are independent?

    6. Why are 4 vectors in R3\mathbb{R}^3 always dependent?

    7. What is a basis, and what is the dimension?

    8. Name the four views of the product ABAB.

    9. What is the rank of uv⊤uv^\top for nonzero u,vu, v?

    Open the review →

    9. Interview angle #

    • "What does a matrix do, geometrically?" — It sends the basis vectors to its columns; linearity fixes the rest. Know the 2×22 \times 2 cases: stretch, rotation, shear, reflection, flattening.
    • "Give the ways to compute ABAB, and when each is useful." — Entry (dot products); column (outputs live in C(A)C(A)); row; outer product (low-rank sums, GEMM accumulation, LoRA, SVD).
    • "How do you check if vectors are independent? And with floats?" — Null space or rank by elimination in exact arithmetic; with floats, compare the smallest singular value with the largest.
    • "Why does every basis have the same size?" — If nn vectors span, any n+1n + 1 vectors are dependent, because a wide coefficient matrix has a nonzero null vector.

    10. Practice #

    The notebook for this lesson runs in Colab. It has four short exercises, each with a check cell and a folded solution:

    1. Build the 90°90° rotation and a shear from the images of e1e_1 and e2e_2 (a helper in the notebook draws what a matrix does to a grid).
    2. Write matmul_columns, matmul_rows and matmul_outer with loops, and check all of them against A @ B.
    3. Decide independence and find a dependency with the null space (scipy.linalg.null_space).
    4. Is bb reachable? Test whether a vector lies in the column space of a 3×23 \times 2 matrix.

    11. Watch and read #

    Open on YouTube · the player loads from youtube-nocookie.com when you press play
    Open on YouTube · the player loads from youtube-nocookie.com when you press play
    Open on YouTube · the player loads from youtube-nocookie.com when you press play