Skip to main content

1. Linear Systems and Matrices

Linear Equations and Systems​

A linear equation in variables x1,…,xnx_1, \ldots, x_n has the form

a1x1+a2x2+⋯+anxn=b,a_1x_1 + a_2x_2 + \cdots + a_nx_n = b,

where the coefficients aia_i and constant bb are real numbers. Variables appear only to the first power: terms such as x2x^2, x1x2x_1x_2, or x1\sqrt{x_1} are not linear.

A linear system is a collection of linear equations in the same variables. A solution is an assignment of values to every variable that satisfies every equation simultaneously. The solution set contains all such assignments.

Two systems are equivalent when they have the same solution set.

Geometry in Two Variables​

Each linear equation in two variables represents a line. A system's solutions are the points common to all its lines:

GeometryNumber of solutions
Lines intersect onceOne solution
Distinct parallel linesNo solution
Same lineInfinitely many solutions

In higher dimensions, equations represent planes or hyperplanes, and solutions lie in their intersection.

Examples​

  1. Unique solution

    −x+y=1x+y=0⟹(x,y)=(−12,12).\begin{aligned} -x + y &= 1 \\ x + y &= 0 \end{aligned} \quad\Longrightarrow\quad (x,y)=\left(-\frac12,\frac12\right).
  2. No solution

    −x+y=1,−x+y=2-x+y=1,\qquad -x+y=2

    The equations require the same expression to equal two different values.

  3. Infinitely many solutions

    −x+y=1,2x−2y=−2-x+y=1,\qquad 2x-2y=-2

    The second equation is −2-2 times the first. The systems are equivalent, and their solution set is

    (x,y)=(t,t+1),t∈R.(x,y)=(t,t+1),\qquad t\in\mathbb R.

Theorem - a solution set of any linear system has either

  • no solutions
  • a unique solution
  • infinitely many solutions.

A system of equations is called consistent if it has one or many solutions. If it has no solutions, it is called inconsistent.

Matrix Form​

A system of mm equations in nn variables can be written as

Ax=b,A\mathbf{x}=\mathbf{b},

where A∈Rm×nA\in\mathbb R^{m\times n} is the coefficient matrix, x∈Rn\mathbf{x}\in\mathbb R^n is the unknown vector, and b∈Rm\mathbf{b}\in\mathbb R^m is the right-hand-side vector.

The augmented matrix [A∣b][A\mid\mathbf b] appends the right-hand side as a final column. For example,

x1−2x2+x3=02x2−8x3=8−4x1+5x2+9x3=−9⟷[1−21002−88−459−9].\begin{aligned} x_1-2x_2+x_3 &= 0 \\ 2x_2-8x_3 &= 8 \\ -4x_1+5x_2+9x_3 &= -9 \end{aligned} \quad\longleftrightarrow\quad \left[\begin{array}{rrr|r} 1 & -2 & 1 & 0 \\ 0 & 2 & -8 & 8 \\ -4 & 5 & 9 & -9 \end{array}\right].

Gaussian Elimination​

Gaussian elimination applies elementary row operations to an augmented matrix. Each operation produces an equivalent system and preserves its solution set.

  1. Swap two rows: Ri↔RjR_i\leftrightarrow R_j.
  2. Multiply a row by a nonzero scalar: Ri←cRiR_i\leftarrow cR_i, c≠0c\ne0.
  3. Add a multiple of one row to another: Ri←Ri+cRjR_i\leftarrow R_i+cR_j.

Elementary Matrices​

An elementary matrix is obtained by applying one elementary row operation to the identity matrix InI_n. Left multiplication by this matrix applies the same row operation to any nn-row matrix. For example, applying R2←R2+3R1R_2\leftarrow R_2+3R_1 to I3I_3 gives

E=[100310001],EA=A with row 2 replaced by row 2 plus 3 times row 1.E=\begin{bmatrix}1&0&0\\3&1&0\\0&0&1\end{bmatrix}, \qquad EA=\text{$A$ with row 2 replaced by row 2 plus 3 times row 1}.

Row swaps, scaling a row by a nonzero number, and adding a multiple of one row to another each have a corresponding elementary matrix. Every elementary matrix is invertible: its inverse performs the reverse row operation. A sequence of row operations is therefore left multiplication by a product of elementary matrices.

An n×nn\times n matrix AA is invertible exactly when it can be written as a product of elementary matrices. If Ek⋯E1A=InE_k\cdots E_1A=I_n, then A−1=Ek⋯E1A^{-1}=E_k\cdots E_1.

Continue until the matrix is in row-echelon form, then use back-substitution. Continuing to reduced row-echelon form makes the variables easier to read directly.

Example​

The two columns track the same elimination in equation form and matrix form. In each matrix, the last column is the right-hand side.

Normal algebraic eliminationGaussian elimination with the augmented matrix
Starting system
x1−2x2+x3=02x2−8x3=8−4x1+5x2+9x3=−9\begin{aligned}x_1-2x_2+x_3&=0\\2x_2-8x_3&=8\\-4x_1+5x_2+9x_3&=-9\end{aligned}
Starting augmented matrix
[1−2102−8−459|08−9]\left[\begin{array}{rrr}1&-2&1\\0&2&-8\\-4&5&9\end{array}\middle\vert\begin{array}{r}0\\8\\-9\end{array}\right]
Step 1: (3)←(3)+4(1)(3)\leftarrow(3)+4(1)
x1−2x2+x3=02x2−8x3=8−3x2+13x3=−9\begin{aligned}x_1-2x_2+x_3&=0\\2x_2-8x_3&=8\\-3x_2+13x_3&=-9\end{aligned}
Step 1: R3←R3+4R1R_3\leftarrow R_3+4R_1
[1−2102−80−313|08−9]\left[\begin{array}{rrr}1&-2&1\\0&2&-8\\0&-3&13\end{array}\middle\vert\begin{array}{r}0\\8\\-9\end{array}\right]
Step 2: (3)←(3)+32(2)(3)\leftarrow(3)+\frac32(2)
x1−2x2+x3=02x2−8x3=8x3=3\begin{aligned}x_1-2x_2+x_3&=0\\2x_2-8x_3&=8\\x_3&=3\end{aligned}
Step 2: R3←R3+32R2R_3\leftarrow R_3+\frac32R_2
[1−2102−8001|083]\left[\begin{array}{rrr}1&-2&1\\0&2&-8\\0&0&1\end{array}\middle\vert\begin{array}{r}0\\8\\3\end{array}\right]
Step 3: (2)←(2)+8(3)(2)\leftarrow(2)+8(3)
x1−2x2+x3=02x2=32x3=3\begin{aligned}x_1-2x_2+x_3&=0\\2x_2&=32\\x_3&=3\end{aligned}
Step 3: R2←R2+8R3R_2\leftarrow R_2+8R_3
[1−21020001|0323]\left[\begin{array}{rrr}1&-2&1\\0&2&0\\0&0&1\end{array}\middle\vert\begin{array}{r}0\\32\\3\end{array}\right]
Step 4: (1)←(1)−(3)(1)\leftarrow(1)-(3)
x1−2x2=−32x2=32x3=3\begin{aligned}x_1-2x_2&=-3\\2x_2&=32\\x_3&=3\end{aligned}
Step 4: R1←R1−R3R_1\leftarrow R_1-R_3
[1−20020001|−3323]\left[\begin{array}{rrr}1&-2&0\\0&2&0\\0&0&1\end{array}\middle\vert\begin{array}{r}-3\\32\\3\end{array}\right]
Step 5: (1)←(1)+(2)(1)\leftarrow(1)+(2)
x1=292x2=32x3=3\begin{aligned}x_1&=29\\2x_2&=32\\x_3&=3\end{aligned}
Step 5: R1←R1+R2R_1\leftarrow R_1+R_2
[100020001|0323]\left[\begin{array}{rrr}1&0&0\\0&2&0\\0&0&1\end{array}\middle\vert\begin{array}{r}0\\32\\3\end{array}\right]
Step 6: (2)←12(2)(2)\leftarrow\frac12(2)
x1=29x2=16x3=3\begin{aligned}x_1&=29\\x_2&=16\\x_3&=3\end{aligned}
Step 6: R2←12R2R_2\leftarrow\frac12R_2
RREF
[100010001|29163]\left[\begin{array}{rrr}1&0&0\\0&1&0\\0&0&1\end{array}\middle\vert\begin{array}{r}29\\16\\3\end{array}\right]

The RREF directly gives x1=29x_1=29, x2=16x_2=16, and x3=3x_3=3. Thus the unique solution is

(x1,x2,x3)=(29,16,3).(x_1,x_2,x_3)=(29,16,3).
  • Operations do not change the solution set of the Original system of equations. They do change the system of equations, but the changed system also has the same solution set as the original system.
  • A row operation can be applied to any matrix, not just one derived from a system of equations. Matrices obtained by applying row operations to another matrix are called row‑equivalent.
  • Note that all three row operations are reversible.

Echelon Forms, Pivots, and Variables​

The first nonzero entry of a nonzero row is its leading entry, or pivot. The table compares row-echelon form with reduced row-echelon form.

Row-echelon form (REF)Reduced row-echelon form (RREF)
Conditions
- All-zero rows, if any, are below the nonzero rows.

- Each row's pivot is to the right of the pivot in the row above it.

- Entries below each pivot are zero.

- Pivots do not have to equal 11; entries above a pivot may be nonzero.

- A matrix can have more than one REF.
Conditions
- The matrix must first satisfy all REF conditions.

-Every pivot equals 11.

- Each pivot is the only nonzero entry in its column, so entries both above and below it are zero.

- Every matrix has exactly one RREF.
example

[1−2102−8001|083]\left[\begin{array}{rrr}1&-2&1\\0&2&-8\\0&0&1\end{array}\middle\vert\begin{array}{r}0\\8\\3\end{array}\right]
example

[100010001|29163]\left[\begin{array}{rrr}1&0&0\\0&1&0\\0&0&1\end{array}\middle\vert\begin{array}{r}29\\16\\3\end{array}\right]

The two example matrices are row-equivalent: continuing elimination from the REF on the left produces the RREF on the right. A matrix may be upper triangular without being in REF; REF also requires the pivots to step to the right as you move down the rows.

Every finite matrix can be transformed using elementary row operations into row-echelon form and then into reduced row-echelon form.

  • Variables in pivot columns are basic (pivot) variables.
  • Variables in non-pivot columns are free variables.

Choose arbitrary values for the free variables, then solve for the basic variables. Writing all variables in terms of parameters gives a parametric form of the solution set.

Consistency and Number of Solutions​

A system is consistent if it has at least one solution. Otherwise it is inconsistent.

In an augmented REF or RREF, a row of the form

[00⋯0∣c],c≠0,[0\quad 0\quad\cdots\quad 0\mid c],\qquad c\ne0,

means 0=c0=c, so the system is inconsistent. If no such row appears, the system is consistent.

  • Inconsistent systems have no solutions.
  • A consistent system with no free variables has a unique solution.
  • A consistent system with one or more free variables has infinitely many solutions.
Aside

Claim: If a linear system has more variables than equations, a solution always exists.

False. For example, this system has five variables and two equations:

[111113000001]\left[\begin{array}{ccccc|c} 1&1&1&1&1&3\\ 0&0&0&0&0&1 \end{array}\right]

The second row says 0=10=1, so the system is inconsistent and has no solution. Having more variables than equations may give free variables, but it does not guarantee that the system is consistent.

Reading Solutions from RREF​

For example,

[10−5101140000]\left[\begin{array}{rrr|r} 1 & 0 & -5 & 1 \\ 0 & 1 & 1 & 4 \\ 0 & 0 & 0 & 0 \end{array}\right]

represents x1−5x3=1x_1-5x_3=1 and x2+x3=4x_2+x_3=4. Let the free variable x3=tx_3=t. Then

x=[1+5t4−tt]=[140]+t[5−11],t∈R.\mathbf{x}= \begin{bmatrix}1+5t\\4-t\\t\end{bmatrix} = \begin{bmatrix}1\\4\\0\end{bmatrix} +t\begin{bmatrix}5\\-1\\1\end{bmatrix}, \qquad t\in\mathbb R.

By contrast,

[10−43001000001]\left[\begin{array}{rrr|r} 1 & 0 & -\frac43 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 1 \end{array}\right]

contains 0=10=1 and is inconsistent.

Homogeneous Systems and Null Space​

A system is homogeneous when it has the form

Ax=0.A\mathbf{x}=\mathbf{0}.

It is always consistent because x=0\mathbf{x}=\mathbf{0} is a solution (the trivial solution). A nonzero solution is a non-trivial solution. A homogeneous system has a non-trivial solution exactly when it has at least one free variable.

Why does a free variable allow a non-trivial solution?

If there are no free variables, every variable is a pivot variable, and the homogeneous equations force the only solution to be x=0\mathbf{x}=\mathbf{0}. If there is a free variable, assign it a nonzero value; the pivot variables can then be chosen to satisfy the equations, producing a nonzero solution.

For example, in x+y=0x+y=0, let the free variable be y=1y=1. Then x=−1x=-1, so (−1,1)(-1,1) is a non-trivial solution.

The set of solutions to Ax=0A\mathbf{x}=\mathbf{0} is the null space of AA, written N⁡(A)\operatorname{N}(A). It is a subspace and contains the zero vector.

Homogeneous-System Examples​

Example 1: One Free Variable​

Consider the homogeneous system in reduced row-echelon form:

[10−43001000000].\left[\begin{array}{rrr|r} 1 & 0 & -\frac43 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 0 \end{array}\right].

This represents

x1−43x3=0,x2=0,0=0.x_1-\frac43x_3=0,\qquad x_2=0,\qquad 0=0.

The pivot variables are x1x_1 and x2x_2, so x3x_3 is free. Set x3=tx_3=t, where t∈Rt\in\mathbb{R}. Then

x=[43t0t]=t[4301],t∈R.\mathbf{x}= \begin{bmatrix}\frac43t\\0\\t\end{bmatrix} =t\begin{bmatrix}\frac43\\0\\1\end{bmatrix}, \qquad t\in\mathbb{R}.

The solutions are all scalar multiples of one vector, so they form a line through the origin. Every solution vector is mapped to zero by AA.

Example 2: Two Free Variables​

Consider the single homogeneous equation

10x1−3x2−2x3=0.10x_1-3x_2-2x_3=0.

Solve for the pivot variable x1x_1:

x1=310x2+15x3.x_1=\frac{3}{10}x_2+\frac15x_3.

The variables x2x_2 and x3x_3 are free. Set x2=sx_2=s and x3=tx_3=t, with s,t∈Rs,t\in\mathbb{R}. Then

x=[310s+15tst]=s[31010]+t[1501],s,t∈R.\mathbf{x}= \begin{bmatrix}\frac{3}{10}s+\frac15t\\s\\t\end{bmatrix} =s\begin{bmatrix}\frac{3}{10}\\1\\0\end{bmatrix} +t\begin{bmatrix}\frac15\\0\\1\end{bmatrix}, \qquad s,t\in\mathbb{R}.

The solutions are all linear combinations of two direction vectors, so they form a plane through the origin. Both direction vectors, and every vector in their span, belong to the null space of the coefficient matrix.

The Minus-One Trick​

For a homogeneous system in RREF, set one free variable to −1-1 and all other free variables to 00. The resulting solution gives a null-space basis vector; repeat for each free variable.

For example, consider

[13003001090001−4].\begin{bmatrix} 1&3&0&0&3\\ 0&0&1&0&9\\ 0&0&0&1&-4 \end{bmatrix}.

Here x2x_2 and x5x_5 are free. Setting (x2,x5)=(−1,0)(x_2,x_5)=(-1,0) gives [3−1000]T\begin{bmatrix}3&-1&0&0&0\end{bmatrix}^T; setting (x2,x5)=(0,−1)(x_2,x_5)=(0,-1) gives [309−4−1]T\begin{bmatrix}3&0&9&-4&-1\end{bmatrix}^T. Thus the general solution is

x=s[3−1000]+t[309−4−1],s,t∈R.\mathbf{x}=s\begin{bmatrix}3\\-1\\0\\0\\0\end{bmatrix} +t\begin{bmatrix}3\\0\\9\\-4\\-1\end{bmatrix}, \qquad s,t\in\mathbb{R}.

Geometry and Parametric Vectors​

  • A line through the origin can be written x=tv\mathbf{x}=t\mathbf{v}.
  • A plane through the origin can be written x=su+tv\mathbf{x}=s\mathbf{u}+t\mathbf{v}.
  • Such vector equations describe all linear combinations of the direction vectors.

An expression such as x=tv\mathbf{x}=t\mathbf{v} or x=su+tv\mathbf{x}=s\mathbf{u}+t\mathbf{v}, with real parameters, is a parametric vector equation. As the parameters vary, it describes the same line or plane as the corresponding equations. When all solutions of a linear system are written as a vector expression with parameters, that expression is the system's parametric vector form.

For example, the earlier RREF solution can be written as

x=[1+5t4−tt]=[140]+t[5−11],t∈R.\mathbf{x}= \begin{bmatrix}1+5t\\4-t\\t\end{bmatrix} = \begin{bmatrix}1\\4\\0\end{bmatrix} +t\begin{bmatrix}5\\-1\\1\end{bmatrix}, \qquad t\in\mathbb{R}.

The first vector is one particular solution; the direction vector is a solution to the corresponding homogeneous system.

More generally, if Ax=bA\mathbf{x}=\mathbf{b} is consistent, p\mathbf{p} is one particular solution, and v1,…,vk\mathbf{v}_1,\ldots,\mathbf{v}_k form a basis for the null space of AA, then every solution has parametric vector form

x=p+t1v1+⋯+tkvk,t1,…,tk∈R.\mathbf{x}=\mathbf{p}+t_1\mathbf{v}_1+\cdots+t_k\mathbf{v}_k, \qquad t_1,\ldots,t_k\in\mathbb{R}.

For a homogeneous system, p=0\mathbf{p}=\mathbf{0}, so its parametric vector form has no offset and describes a subspace through the origin. A consistent non-homogeneous system's solution set is a translate of the null space; an inconsistent system has no solutions.

Why does this give every solution?

Let p\mathbf{p} be one solution, so Ap=bA\mathbf{p}=\mathbf{b}. If x\mathbf{x} is any other solution, then

A(x−p)=Ax−Ap=b−b=0.A(\mathbf{x}-\mathbf{p})=A\mathbf{x}-A\mathbf{p}=\mathbf{b}-\mathbf{b}=\mathbf{0}.

Therefore, the difference x−p\mathbf{x}-\mathbf{p} belongs to the null space of AA. Conversely, if z\mathbf{z} is in that null space, then A(p+z)=Ap+Az=b+0=bA(\mathbf{p}+\mathbf{z})=A\mathbf{p}+A\mathbf{z}=\mathbf{b}+\mathbf{0}=\mathbf{b}, so adding any null-space vector to p\mathbf{p} gives another solution. For a homogeneous system, b=0\mathbf{b}=\mathbf{0} and we can choose p=0\mathbf{p}=\mathbf{0}; the solutions are exactly the null-space vectors.

Matrix Operations​

Equality of Matrices​

Two matrices are equal only if they have the same dimensions and all corresponding entries are equal. For A,B∈Rp×qA,B\in\mathbb{R}^{p\times q},

A=B⟺Aij=Bij for every 1≤i≤p, 1≤j≤q.A=B\quad\Longleftrightarrow\quad A_{ij}=B_{ij}\text{ for every }1\le i\le p,\ 1\le j\le q.

Addition and Scalar Multiplication​

Matrices can be added only when they have the same dimensions; add corresponding entries:

(A+B)ij=Aij+Bij.(A+B)_{ij}=A_{ij}+B_{ij}.

For a scalar cc, scalar multiplication is entrywise: (cA)ij=cAij(cA)_{ij}=cA_{ij}.

Matrix Multiplication​

If AA is p×qp\times q and BB is q×rq\times r, then ABAB is defined and has size p×rp\times r. Its entries are row-by-column dot products:

(AB)ij=∑k=1qAikBkj.(AB)_{ij}=\sum_{k=1}^{q}A_{ik}B_{kj}.

This multiplication rule represents composition of linear transformations. Let BB map Rr\mathbb{R}^r to Rq\mathbb{R}^q, and let AA map Rq\mathbb{R}^q to Rp\mathbb{R}^p. Applying BB first and then AA sends x\mathbf{x} to A(Bx)A(B\mathbf{x}). Since

A(Bx)=(AB)x,A(B\mathbf{x})=(AB)\mathbf{x},

the single matrix representing the composed transformation is ABAB. Its column jj is AA applied to column jj of BB, which gives the entry formula above.

Hadamard Product

The Hadamard product (or entrywise product) is defined for matrices AA and BB with the same dimensions. It multiplies corresponding entries:

(A⊙B)ij=AijBij.(A\odot B)_{ij}=A_{ij}B_{ij}.

For example,

[1234]⊙[5678]=[5122132].\begin{bmatrix}1&2\\3&4\end{bmatrix} \odot \begin{bmatrix}5&6\\7&8\end{bmatrix} = \begin{bmatrix}5&12\\21&32\end{bmatrix}.

Unlike the usual matrix product, it requires identical dimensions and does not use row-by-column dot products.

The inner dimensions must match. Matrix multiplication is generally not commutative: AB≠BAAB\ne BA in general. It is associative and distributive over addition.

Identity and Inverse​

The n×nn\times n identity matrix InI_n has 11s on its main diagonal and 00s elsewhere. It satisfies AIn=InA=AAI_n=I_nA=A for square AA.

A square matrix AA is invertible if there is a matrix A−1A^{-1} such that

AA−1=A−1A=In.AA^{-1}=A^{-1}A=I_n.

Not every square matrix is invertible. A non-invertible square matrix is singular. A square matrix is invertible exactly when its RREF is InI_n (equivalently, it has a pivot in every column).

To compute an inverse by Gaussian elimination, row-reduce the augmented matrix [A∣In][A\mid I_n]. If the left side reduces to InI_n, the right side becomes A−1A^{-1}:

[A∣In]  ⟶  [In∣A−1].[A\mid I_n]\;\longrightarrow\;[I_n\mid A^{-1}].
Why does this give the inverse?

Each column of InI_n is a separate right-hand side, a standard basis vector ej\mathbf{e}_j. Row-reducing [A∣In][A\mid I_n] applies the same operations to all systems Axj=ejA\mathbf{x}_j=\mathbf{e}_j at once. Once the left side is InI_n, the right-side columns are those solutions; together they form A−1A^{-1} because AA−1=InAA^{-1}=I_n.

If the left side cannot be reduced to InI_n, AA is singular and has no inverse. For solving a system Ax=bA\mathbf{x}=\mathbf{b}, elimination is usually preferred to explicitly calculating A−1A^{-1}.

Worked 3x3 Example​

Find the inverse of

A=[0121034−38].A=\begin{bmatrix}0&1&2\\1&0&3\\4&-3&8\end{bmatrix}.

Apply each row operation to the entire augmented matrix [A∣I3][A\mid I_3]:

[0121001030104−38001]→R1↔R2[1030100121004−38001]\left[\begin{array}{ccc|ccc} 0&1&2&1&0&0\\ 1&0&3&0&1&0\\ 4&-3&8&0&0&1 \end{array}\right] \xrightarrow{R_1\leftrightarrow R_2} \left[\begin{array}{ccc|ccc} 1&0&3&0&1&0\\ 0&1&2&1&0&0\\ 4&-3&8&0&0&1 \end{array}\right] →R3←R3−4R1[1030100121000−3−40−41]→R3←R3+3R2[1030100121000023−41]\xrightarrow{R_3\leftarrow R_3-4R_1} \left[\begin{array}{ccc|ccc} 1&0&3&0&1&0\\ 0&1&2&1&0&0\\ 0&-3&-4&0&-4&1 \end{array}\right] \xrightarrow{R_3\leftarrow R_3+3R_2} \left[\begin{array}{ccc|ccc} 1&0&3&0&1&0\\ 0&1&2&1&0&0\\ 0&0&2&3&-4&1 \end{array}\right] →R3←12R3[10301001210000132−212]→R1←R1−3R3[100−927−3201210000132−212]\xrightarrow{R_3\leftarrow\frac12R_3} \left[\begin{array}{ccc|ccc} 1&0&3&0&1&0\\ 0&1&2&1&0&0\\ 0&0&1&\frac32&-2&\frac12 \end{array}\right] \xrightarrow{R_1\leftarrow R_1-3R_3} \left[\begin{array}{ccc|ccc} 1&0&0&-\frac92&7&-\frac32\\ 0&1&2&1&0&0\\ 0&0&1&\frac32&-2&\frac12 \end{array}\right] →R2←R2−2R3[100−927−32010−24−100132−212]=[I3∣A−1].\xrightarrow{R_2\leftarrow R_2-2R_3} \left[\begin{array}{ccc|ccc} 1&0&0&-\frac92&7&-\frac32\\ 0&1&0&-2&4&-1\\ 0&0&1&\frac32&-2&\frac12 \end{array}\right] = [I_3\mid A^{-1}].

Therefore,

A−1=[−927−32−24−132−212].A^{-1}=\begin{bmatrix} -\frac92&7&-\frac32\\ -2&4&-1\\ \frac32&-2&\frac12 \end{bmatrix}.
Geometric Interpretation of Inverse Matrix

If an invertible matrix AA represents a linear transformation, then A−1A^{-1} represents the transformation that undoes it:

A−1(Ax)=xandA(A−1x)=x.A^{-1}(A\mathbf{x})=\mathbf{x} \quad\text{and}\quad A(A^{-1}\mathbf{x})=\mathbf{x}.

Geometrically, AA might rotate, stretch, reflect, or shear every point. Applying A−1A^{-1} reverses those changes and returns each point to its original position. For example, if AA doubles lengths, A−1A^{-1} halves them.

A matrix has no inverse if its transformation loses information, such as flattening a plane onto a line: multiple original points then map to the same point, so there's no unique way to undo it.

Inverse and Determinant​

This test applies to square matrices. For a square matrix AA, its determinant tells how its linear transformation scales area or volume:

  • If det⁡(A)≠0\det(A)\ne0, the transformation preserves the full dimension of space. No dimensions collapse, so it is reversible and AA has an inverse.
  • If det⁡(A)=0\det(A)=0, the transformation collapses space into a lower dimension, losing information. It is not reversible, so AA has no inverse.

For example,

A=[1224]⟹det⁡(A)=1⋅4−2⋅2=0.A=\begin{bmatrix}1&2\\2&4\end{bmatrix} \quad\Longrightarrow\quad \det(A)=1\cdot4-2\cdot2=0.

Its columns point in the same direction, so the transformation collapses the plane onto a line. Different inputs can produce the same output, preventing an inverse.

Transpose and Useful Properties​

The transpose ATA^T is formed by turning the columns of AA into rows: (AT)ij=Aji(A^T)_{ij}=A_{ji}. A square matrix is symmetric when AT=AA^T=A; only square matrices can be symmetric.

Transpose and inverse rules

  • (AT)T=A(A^T)^T=A.
  • (cA)T=cAT(cA)^T=cA^T.
  • (A+B)T=AT+BT(A+B)^T=A^T+B^T.
  • (AB)T=BTAT(AB)^T=B^TA^T.
  • (A−1)−1=A(A^{-1})^{-1}=A.
  • (AB)−1=B−1A−1(AB)^{-1}=B^{-1}A^{-1}.
  • (AT)−1=(A−1)T(A^T)^{-1}=(A^{-1})^T.
  • (A+B)−1≠A−1+B−1(A+B)^{-1}\ne A^{-1}+B^{-1}.

Symmetric matrices

  • A square matrix is symmetric when AT=AA^T=A.
  • The sum of symmetric matrices is symmetric: if AT=AA^T=A and BT=BB^T=B, then (A+B)T=AT+BT=A+B(A+B)^T=A^T+B^T=A+B.
  • The product of symmetric matrices need not be symmetric. For example, both A=[1000]A=\begin{bmatrix}1&0\\0&0\end{bmatrix} and B=[0110]B=\begin{bmatrix}0&1\\1&0\end{bmatrix} are symmetric, but AB=[0100]AB=\begin{bmatrix}0&1\\0&0\end{bmatrix} is not.
  • If AA is symmetric, then A−1A^{-1} is also symmetric. (given A is invertible)

Vectors​

A vector in Rm\mathbb{R}^m is an ordered sequence of mm real numbers. For example, (1,3,−2)(1,3,-2) can be written as a row or column matrix:

[13−2]orx=[13−2].\begin{bmatrix}1&3&-2\end{bmatrix} \qquad\text{or}\qquad \mathbf{x}=\begin{bmatrix}1\\3\\-2\end{bmatrix}.

We typically use column vectors. The transpose turns rows into columns and columns into rows; for example,

[123456]T=[142536].\begin{bmatrix}1&2&3\\4&5&6\end{bmatrix}^{T} = \begin{bmatrix}1&4\\2&5\\3&6\end{bmatrix}.

For a column vector x=[13−2]T\mathbf{x}=\begin{bmatrix}1&3&-2\end{bmatrix}^{T}, the product xTx\mathbf{x}^{T}\mathbf{x} is a 1×11\times1 scalar, while xxT\mathbf{x}\mathbf{x}^{T} is a 3×33\times3 matrix:

xTx=[13−2][13−2]=12+32+(−2)2=14,xxT=[13−2][13−2]=[13−239−6−2−64].\mathbf{x}^{T}\mathbf{x} =\begin{bmatrix}1&3&-2\end{bmatrix} \begin{bmatrix}1\\3\\-2\end{bmatrix} =1^2+3^2+(-2)^2=14, \qquad \mathbf{x}\mathbf{x}^{T} =\begin{bmatrix}1\\3\\-2\end{bmatrix} \begin{bmatrix}1&3&-2\end{bmatrix} =\begin{bmatrix}1&3&-2\\3&9&-6\\-2&-6&4\end{bmatrix}.

Geometric Representation​

Vectors in R2\mathbb{R}^2 can be drawn as arrows in a plane; vectors in R3\mathbb{R}^3 can be represented as arrows in three-dimensional space. A vector has a direction and a length, but its starting point can be anywhere. Drawing it from the origin is a convention that makes its coordinates easy to read.

Vector addition follows the parallelogram rule. For example, with

a=[21],b=[13],a+b=[34],\mathbf{a}=\begin{bmatrix}2\\1\end{bmatrix}, \qquad \mathbf{b}=\begin{bmatrix}1\\3\end{bmatrix}, \qquad \mathbf{a}+\mathbf{b}=\begin{bmatrix}3\\4\end{bmatrix},

place the arrows for a\mathbf{a} and b\mathbf{b} at the same starting point. Their sum is the diagonal of the parallelogram formed by those arrows.


Appendix​

  1. Linear Regression for Overconstrained Systems

    An overconstrained system has more equations than unknowns. For example,

    x=1,x=3x=1,\qquad x=3

    has no exact solution: no single value of xx satisfies both equations. Linear regression handles similar situations by choosing model parameters that minimize the sum of squared errors. For this example, minimize

    S(x)=(x−1)2+(x−3)2.S(x)=(x-1)^2+(x-3)^2.

    The minimum occurs at x=2x=2, a compromise between the two observations. It does not satisfy either equation exactly, but it minimizes their combined squared error.

    In linear regression, each equation represents an observation and the unknowns are model parameters. In matrix form, we seek x\mathbf{x} such that AxA\mathbf{x} is close to b\mathbf{b}. When exact equality is impossible, the usual least-squares objective is

    min⁡x∥Ax−b∥22.\min_{\mathbf{x}}\|A\mathbf{x}-\mathbf{b}\|_2^2.

    More equations than unknowns makes a system overdetermined, but does not by itself guarantee inconsistency. Real-world observations often make the equations inconsistent, for example because of measurement noise.

  2. The Inverse of a 2×22\times2 Matrix

    For

    A=[abcd],A=\begin{bmatrix}a&b\\c&d\end{bmatrix},

    the determinant is det⁡(A)=ad−bc\det(A)=ad-bc. If it is nonzero, then

    A−1=1ad−bc[d−b−ca].A^{-1}=\frac{1}{ad-bc} \begin{bmatrix} d&-b\\ -c&a \end{bmatrix}.

    To remember the formula, swap the diagonal entries, negate the off-diagonal entries, then divide by the determinant. The formula works because

    [abcd][d−b−ca]=[ad−bc00ad−bc]=(ad−bc)I2.\begin{bmatrix}a&b\\c&d\end{bmatrix} \begin{bmatrix}d&-b\\-c&a\end{bmatrix} = \begin{bmatrix}ad-bc&0\\0&ad-bc\end{bmatrix} =(ad-bc)I_2.

    Dividing by ad−bcad-bc gives I2I_2. If ad−bc=0ad-bc=0, the matrix has no inverse.

    For example, if

    A=[1234],A=\begin{bmatrix}1&2\\3&4\end{bmatrix},

    then det⁡(A)=4−6=−2\det(A)=4-6=-2, so

    A−1=−12[4−2−31]=[−2132−12].A^{-1}=-\frac12\begin{bmatrix}4&-2\\-3&1\end{bmatrix} =\begin{bmatrix}-2&1\\\frac32&-\frac12\end{bmatrix}.