Rectangular kernel and solution-fibre example (source code)

= Rectangular kernel and solution-fibre example

Consider the <linear map> $A:\mathbb R^3\to\mathbb R^2$ represented by the rectangular <matrix>
$$
A=\begin{pmatrix}1&2&0\\0&1&1\end{pmatrix},\qquad
A\begin{pmatrix}x\\y\\z\end{pmatrix}=\begin{pmatrix}x+2y\\y+z\end{pmatrix}.
$$
To compute its <kernel>, solve the <homogeneous linear system> $x+2y=0$, $y+z=0$. Taking $y=t$ gives $x=-2t$, $z=-t$, so
$$
\ker A=\left\{t\begin{pmatrix}-2\\1\\-1\end{pmatrix}:t\in\mathbb R\right\},\qquad
v=\begin{pmatrix}-2\\1\\-1\end{pmatrix},\qquad Av=\begin{pmatrix}-2+2\\1-1\end{pmatrix}=0.
$$
Thus $v$ represents a <null direction of a linear map>: decreasing the first input by two, increasing the second by one, and decreasing the third by one changes neither output. Solving the <homogeneous linear system> is the concrete computation behind a <kernel>; the <column space> instead decides which outputs are attainable.<Linear Algebra, MIT 18.06, Spring 2010/Lecture 6: Column space and nullspace>[Gilbert Strang, Lecture 6: Column space and nullspace, opening lecture description: the distinct roles of Ax=0 and Ax=b]{ref}

Now prescribe the nonzero output $b=(3,2)^T$. The <linear system> $Au=b$ becomes $x+2y=3$, $y+z=2$. Again take $y=t$:
$$
u=\begin{pmatrix}3-2t\\t\\2-t\end{pmatrix}
=\underbrace{\begin{pmatrix}3\\0\\2\end{pmatrix}}_{u_0}
+t\underbrace{\begin{pmatrix}-2\\1\\-1\end{pmatrix}}_{v},\qquad t\in\mathbb R.
$$
Direct substitution gives $Au_0=(3,2)^T$, and $A(u_0+tv)=Au_0+tAv=b$. Conversely, the two <linear equations> force exactly this form, so no solutions have been omitted. This <fiber> is an <affine subspace> of <dimension> one in the three-dimensional input <vector space>. It is parallel to the <kernel>, but does not pass through the origin. For instance, $u_0=(3,0,2)^T$ and $u_1=(1,1,1)^T$ both give $b$, while their difference $u_1-u_0=v$ gives zero. Adding $u_0$ and $u_1$ gives output $2b$, which is another way to see that this nonzero-output <fiber> is not a <vector subspace>.

\Image[/kernel-rectangular-input-output-ambiguity.png]
{title=Three-dimensional inputs along one null direction give the same two-dimensional output}
{description=The blue <straight line> is the <kernel> in the actual three-dimensional input <vector space>. The orange solution <straight line> is its <translation> by $u_0$. Three marked inputs map to the single orange output $(3,2)$ in the two-dimensional output <vector space>; the blue <kernel> maps to zero. Finite plotted segments represent infinite <straight lines>.}

The first and third columns of $A$ are $(1,0)^T$ and $(0,1)^T$, a <basis> of the output <vector space>. Hence $A$ has <matrix rank> two and reaches every output. The <rank-nullity theorem> predicts <nullity> $3-2=1$ before we solve any <linear system>. It provides a useful completeness check: one nonzero <kernel> <vector> already forms a <basis> here, so a second independent <null direction of a linear map> would signal a calculation error. In general, <matrix rank> $r$ for an $m\times n$ <matrix> leaves $n-r$ independent <kernel> directions, rather than $m-r$.<Interactive Linear Algebra by Dan Margalit and others/The Rank Theorem>[Margalit and Rabinoff, Interactive Linear Algebra, §2.9, Rank Theorem: column count equals rank plus nullity]{ref}