2.6.12 · D3Matrices & Determinants — Introduction

Worked examples — Solving systems using matrix inversion

1,836 words8 min readBack to topic

This page is a shooting range. The parent note gave you the recipe . Here we fire that recipe at every kind of situation it can meet — clean cases, sign traps, the dreaded branches, a word problem, and an exam twist — so you never meet a scenario you have not already survived.

Before we start, three tiny reminders so no symbol arrives unearned:


The scenario matrix

Every problem this topic throws at you falls into exactly one of these cells. The last column names the worked example that clears it.

Cell What makes it special Outcome Example
C1 Clean , one unique solution Ex 1
C2 with negative / mixed-sign entries unique, sign-care Ex 2
C3 , unique Ex 3
C4 , no solution (inconsistent) Ex 4
C5 , infinitely many Ex 5
C6 (homogeneous system) trivial , or a whole line Ex 6
C7 Real-world word problem translate → solve Ex 7
C8 Exam twist: solve for several at once reuse one Ex 8

We will visit all eight.


The geometry that unifies every cell

Two equations in are two straight lines. The solution is where they cross. That single picture explains all outcomes: cross once (unique), parallel and apart (no solution), same line (infinitely many).

Figure — Solving systems using matrix inversion

Keep this picture in your head — the algebra below is just this geometry counted with numbers.


Ex 1 — Cell C1 · clean

Step 1 — pack into . Why this step? is the system repackaged; row-times-column reproduces each equation.

Step 2 — determinant first. Why this step? is the green light — an inverse exists, a unique solution exists.

Step 3 — apply the inverse rule (swap diagonal, negate off-diagonal, divide by ): Why this step? It is the closed form of for .

Step 4 — multiply, keeping on the right ():

=\frac14\begin{bmatrix}24-16\\-12+24\end{bmatrix}=\frac14\begin{bmatrix}8\\12\end{bmatrix}=\begin{bmatrix}2\\3\end{bmatrix}.$$ *Why $A^{-1}B$ and not $BA^{-1}$?* Matrices don't commute; only left-multiplying cancels the left $A$. **Verify:** $3(2)+2(3)=12$ ✓ and $1(2)+2(3)=8$ ✓. Solution $(x,y)=(2,3)$. --- ## Ex 2 — Cell C2 · negative / mixed signs > [!example] Statement > Solve $\;2x-3y=-4,\quad -x+4y=9.$ > > **Forecast:** negative coefficients don't change the *method*, only the arithmetic. Expect one solution; watch every minus sign. **Step 1 — matrices.** $$A=\begin{bmatrix}2&-3\\-1&4\end{bmatrix},\quad B=\begin{bmatrix}-4\\9\end{bmatrix}.$$ **Step 2 — determinant.** $$\det A = 2\cdot4-(-3)(-1)=8-3=5\neq0.$$ *Why this step?* Non-zero ⇒ safe to invert. Notice $(-3)(-1)=+3$, a classic sign trap. **Step 3 — inverse.** $$A^{-1}=\frac15\begin{bmatrix}4&3\\1&2\end{bmatrix}.$$ *Why this step?* Swap diagonal ($2,4\to4,2$), negate off-diagonal ($-3\to3,\ -1\to1$), divide by $5$. **Step 4 — solve.** $$X=\frac15\begin{bmatrix}4&3\\1&2\end{bmatrix}\begin{bmatrix}-4\\9\end{bmatrix} =\frac15\begin{bmatrix}-16+27\\-4+18\end{bmatrix}=\frac15\begin{bmatrix}11\\14\end{bmatrix}=\begin{bmatrix}11/5\\14/5\end{bmatrix}.$$ **Verify:** $2(11/5)-3(14/5)=\tfrac{22-42}{5}=\tfrac{-20}{5}=-4$ ✓; $-11/5+4(14/5)=\tfrac{-11+56}{5}=\tfrac{45}{5}=9$ ✓. --- ## Ex 3 — Cell C3 · clean $3\times3$ > [!example] Statement > Solve $\;x+2y+3z=9,\quad 2x-y+z=8,\quad 3x-z=3.$ > > **Forecast:** three planes in space. If they meet at one point we get a unique $(x,y,z)$. Expect small whole numbers. **Step 1 — matrices.** $$A=\begin{bmatrix}1&2&3\\2&-1&1\\3&0&-1\end{bmatrix},\quad B=\begin{bmatrix}9\\8\\3\end{bmatrix}.$$ **Step 2 — determinant, expanding along row 1.** $$\det A = 1\big[(-1)(-1)-1\cdot0\big]-2\big[2(-1)-1\cdot3\big]+3\big[2\cdot0-(-1)3\big]$$ $$=1(1)-2(-5)+3(3)=1+10+9=20\neq0.$$ *Why this step?* $\det=20\neq0$ ⇒ unique solution; also we need it to divide the adjugate. **Step 3 — adjugate** (transpose of the cofactor matrix; see [[Cofactors and Minors]]): $$\operatorname{adj}(A)=\begin{bmatrix}1&2&5\\5&-10&5\\3&6&-5\end{bmatrix}.$$ *Why the transpose?* $\operatorname{adj}(A)_{ij}=C_{ji}$; forgetting to flip is the #1 slip. **Step 4 — solve** $X=\frac{1}{20}\operatorname{adj}(A)\,B$: $$X=\frac1{20}\begin{bmatrix}1&2&5\\5&-10&5\\3&6&-5\end{bmatrix}\begin{bmatrix}9\\8\\3\end{bmatrix} =\frac1{20}\begin{bmatrix}9+16+15\\45-80+15\\27+48-15\end{bmatrix}=\frac1{20}\begin{bmatrix}40\\-20\\60\end{bmatrix}=\begin{bmatrix}2\\-1\\3\end{bmatrix}.$$ **Verify:** $1(2)+2(-1)+3(3)=2-2+9=9$ ✓; $2(2)-(-1)+3=4+1+3=8$ ✓; $3(2)-3=3$ ✓. --- ## Ex 4 — Cell C4 · $\det A=0$, no solution > [!example] Statement > Solve $\;x+2y=3,\quad 2x+4y=7.$ > > **Forecast:** the second equation is *almost* twice the first — $2x+4y$ is $2(x+2y)$, which should equal $2(3)=6$, but it equals $7$. Contradiction incoming. Expect **no solution**. **Step 1 — matrices & determinant.** $$A=\begin{bmatrix}1&2\\2&4\end{bmatrix},\quad B=\begin{bmatrix}3\\7\end{bmatrix},\qquad \det A=1\cdot4-2\cdot2=0.$$ *Why this step?* $\det A=0$ **forbids** inversion — the parent's recipe stops here and we switch to consistency analysis. Geometrically the two lines are parallel (same slope $-\tfrac12$). **Step 2 — test $(\operatorname{adj}A)B$.** For $2\times2$, $\operatorname{adj}A=\begin{bmatrix}4&-2\\-2&1\end{bmatrix}$. $$(\operatorname{adj}A)B=\begin{bmatrix}4&-2\\-2&1\end{bmatrix}\begin{bmatrix}3\\7\end{bmatrix}=\begin{bmatrix}12-14\\-6+7\end{bmatrix}=\begin{bmatrix}-2\\1\end{bmatrix}\neq O.$$ *Why this step?* Multiplying $AX=B$ by $\operatorname{adj}A$ gives $(\det A)X=(\operatorname{adj}A)B$. Since $\det A=0$, the left side is $O$; a **non-zero** right side is an impossible equation $O=(\text{nonzero})$. **Step 3 — conclude.** No $X$ can satisfy $O=\begin{bmatrix}-2\\1\end{bmatrix}$. **System is inconsistent — no solution.** See [[Consistency of Linear Systems]]. **Verify (picture-check):** lines $y=\tfrac{3-x}{2}$ and $y=\tfrac{7-2x}{4}$ have intercepts $1.5$ and $1.75$ — parallel, never meet. ✓ ![[deepdives/dd-maths-2.6.12-d3-s02.png]] --- ## Ex 5 — Cell C5 · $\det A=0$, infinitely many > [!example] Statement > Solve $\;x+2y=3,\quad 2x+4y=6.$ > > **Forecast:** now the second equation *is* exactly twice the first. Same line drawn twice — expect **infinitely many** solutions. **Step 1 — determinant.** Same $A$ as Ex 4, so $\det A=0$ again. **Step 2 — test $(\operatorname{adj}A)B$** with $B=\begin{bmatrix}3\\6\end{bmatrix}$: $$(\operatorname{adj}A)B=\begin{bmatrix}4&-2\\-2&1\end{bmatrix}\begin{bmatrix}3\\6\end{bmatrix}=\begin{bmatrix}12-12\\-6+6\end{bmatrix}=\begin{bmatrix}0\\0\end{bmatrix}=O.$$ *Why this step?* $\det A=0$ **and** $(\operatorname{adj}A)B=O$ is the "infinitely many (or none)" branch. Here the two equations are proportional, so it is genuinely infinitely many. **Step 3 — describe the solution set.** From $x+2y=3$, set $y=t$ (free parameter): $x=3-2t$. $$\boxed{(x,y)=(3-2t,\ t),\quad t\in\mathbb{R}.}$$ *Why a parameter?* One equation, two unknowns ⇒ a whole line of answers. **Verify:** pick $t=1\Rightarrow(1,1)$: $1+2=3$ ✓ and $2+4=6$ ✓. Pick $t=0\Rightarrow(3,0)$: $3=3$ ✓, $6=6$ ✓. --- ## Ex 6 — Cell C6 · homogeneous ($B=O$) > [!example] Statement > Solve $\;2x+y=0,\quad x-3y=0$ (both constants zero). > > **Forecast:** $X=O$ (all zeros) *always* works when $B=O$. The real question is whether that is the *only* solution — decided by $\det A$. **Step 1 — determinant.** $$A=\begin{bmatrix}2&1\\1&-3\end{bmatrix},\qquad \det A=2(-3)-1(1)=-7\neq0.$$ *Why this step?* If $\det A\neq0$, $X=A^{-1}B=A^{-1}O=O$ is the **unique** solution — the two lines cross only at the origin. **Step 2 — conclude.** $X=A^{-1}\begin{bmatrix}0\\0\end{bmatrix}=\begin{bmatrix}0\\0\end{bmatrix}$. Only the **trivial solution** $(0,0)$. **Contrast (degenerate homogeneous):** if instead $2x+y=0,\ 4x+2y=0$, then $\det A=2\cdot2-1\cdot4=0$; the second is twice the first, giving the line $(x,y)=(t,-2t)$ — **infinitely many** solutions through the origin. **Verify:** for the first system $(0,0)$: $0=0,\ 0=0$ ✓. For the degenerate one, $t=1\Rightarrow(1,-2)$: $2-2=0$ ✓, $4-4=0$ ✓. --- ## Ex 7 — Cell C7 · word problem > [!example] Statement > A shop sells pens and notebooks. **3 pens + 2 notebooks cost ₹80**; **2 pens + 5 notebooks cost ₹110**. Find each price. > > **Forecast:** two prices, two facts ⇒ expect a unique pair of positive rupee amounts. **Step 1 — translate.** Let $p$ = pen price, $n$ = notebook price. $$A=\begin{bmatrix}3&2\\2&5\end{bmatrix},\quad X=\begin{bmatrix}p\\n\end{bmatrix},\quad B=\begin{bmatrix}80\\110\end{bmatrix}.$$ *Why this step?* Each real sentence becomes one row of $A$ and one entry of $B$. **Step 2 — determinant.** $\det A=3\cdot5-2\cdot2=15-4=11\neq0$. Unique prices exist. **Step 3 — inverse & solve.** $A^{-1}=\frac1{11}\begin{bmatrix}5&-2\\-2&3\end{bmatrix}$. $$X=\frac1{11}\begin{bmatrix}5&-2\\-2&3\end{bmatrix}\begin{bmatrix}80\\110\end{bmatrix} =\frac1{11}\begin{bmatrix}400-220\\-160+330\end{bmatrix}=\frac1{11}\begin{bmatrix}180\\170\end{bmatrix}.$$ Hmm — that gives non-integers; let's keep them: $p=\tfrac{180}{11},\ n=\tfrac{170}{11}$… let us instead **re-verify the arithmetic**, since prices should be sensible. Recompute: $5(80)-2(110)=400-220=180$; $-2(80)+3(110)=-160+330=170$. So $p=180/11\approx16.36$, $n=170/11\approx15.45$. **Verify (units = rupees):** $3(180/11)+2(170/11)=\tfrac{540+340}{11}=\tfrac{880}{11}=80$ ✓; $2(180/11)+5(170/11)=\tfrac{360+850}{11}=\tfrac{1210}{11}=110$ ✓. Both totals match the given ₹ amounts, so the (non-round but valid) prices are $p=\tfrac{180}{11},\ n=\tfrac{170}{11}$. > [!intuition] > Real data rarely gives round answers. The *method* is unbothered — $\det A\neq0$ guarantees exactly one price pair, integer or not. --- ## Ex 8 — Cell C8 · exam twist: one $A^{-1}$, two right-hand sides > [!example] Statement > For $A=\begin{bmatrix}2&1\\1&1\end{bmatrix}$, solve $AX=B_1$ with $B_1=\begin{bmatrix}5\\3\end{bmatrix}$ **and** $AX=B_2$ with $B_2=\begin{bmatrix}0\\4\end{bmatrix}$. > > **Forecast:** the machine $A$ is the same; only the output changes. So compute $A^{-1}$ **once** and multiply twice — this is why inversion beats re-doing elimination. **Step 1 — determinant & inverse.** $\det A=2\cdot1-1\cdot1=1\neq0$, so $$A^{-1}=\frac11\begin{bmatrix}1&-1\\-1&2\end{bmatrix}=\begin{bmatrix}1&-1\\-1&2\end{bmatrix}.$$ *Why this step?* With $A^{-1}$ in hand, every new $B$ costs just one matrix-vector product. **Step 2 — first solution.** $$X_1=A^{-1}B_1=\begin{bmatrix}1&-1\\-1&2\end{bmatrix}\begin{bmatrix}5\\3\end{bmatrix}=\begin{bmatrix}5-3\\-5+6\end{bmatrix}=\begin{bmatrix}2\\1\end{bmatrix}.$$ **Step 3 — second solution (reuse $A^{-1}$).** $$X_2=A^{-1}B_2=\begin{bmatrix}1&-1\\-1&2\end{bmatrix}\begin{bmatrix}0\\4\end{bmatrix}=\begin{bmatrix}0-4\\0+8\end{bmatrix}=\begin{bmatrix}-4\\8\end{bmatrix}.$$ *Why this step?* Demonstrates the payoff — no re-elimination. Compare with [[Cramer's Rule]], which must recompute determinants for every new $B$. **Verify:** $X_1$: $2(2)+1=5$ ✓, $2+1=3$ ✓. $X_2$: $2(-4)+8=0$ ✓, $-4+8=4$ ✓. --- > [!recall]- Quick self-test on the scenario matrix > Given $\det A=0$, which branch am I in? ::: Test $(\operatorname{adj}A)B$: $\neq O$ ⇒ no solution; $=O$ ⇒ infinitely many (or none — substitute). > Why does $B=O$ always have at least one solution? ::: $X=O$ satisfies $A\cdot O=O$; the only question is uniqueness, decided by $\det A$. > Why is inversion better than Cramer for many right-hand sides? ::: Compute $A^{-1}$ once, then one multiply per $B$; Cramer recomputes determinants each time. > [!mnemonic] > **"Det first, decide the branch; only then invert."** > $\det\neq0\Rightarrow$ unique; $\det=0\Rightarrow$ test $(\operatorname{adj}A)B$ for *nothing* vs *everything*. --- ## Connections - [[Solving systems using matrix inversion]] — the parent recipe these examples exercise. - [[Determinants]] — the $\det A$ gate that chooses the branch in every example. - [[Adjoint and Inverse of a Matrix]] — how each $A^{-1}$ above was built. - [[Cofactors and Minors]] — the entries inside $\operatorname{adj}(A)$ in Ex 3–5. - [[Consistency of Linear Systems]] — Ex 4 and Ex 5 live here. - [[Cramer's Rule]] — the rival contrasted in Ex 8. - [[Gaussian Elimination]] — the large-system alternative. ## 🖼️ Scenario Map ```mermaid flowchart TD START["Compute det A"] -->|not zero| UNIQUE["Unique X = A inv B"] START -->|zero| TEST["Test adj A times B"] TEST -->|not zero| NONE["No solution Ex4"] TEST -->|equals zero| INF["Infinitely many Ex5"] UNIQUE --> C1["2x2 clean Ex1 Ex2"] UNIQUE --> C3["3x3 clean Ex3"] UNIQUE --> HOM["B is zero gives only origin Ex6"] UNIQUE --> WORD["Word problem Ex7"] UNIQUE --> MULTI["Reuse A inv for many B Ex8"] ```