# Visualizing the Nullspace

There is a comment on quora (https://www.quora.com/What-is-a-null-space-in-linear-algebra) about how we can intuitively grasp the meaning of the nullspace of a matrix. I am trying to generalize the example but I got stuck. Can someone help?

The example is as follows. Use a ball to cast a shadow on your desk. You can move the ball in 3 directions, but its shadow can only move in 2 directions. You're projecting a shadow onto the desk. When you move the ball within the null space (which here is just 1-dimensional), the transformed (shadow) ball won't move. In matrix notation, let $\left( \begin{array}{c} x_{1} \\ x_{2} \\ x_{3}% \end{array}% \right)$ be the position of a ball and consider a projection by $A=\left( \begin{array}{ccc} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 0% \end{array}% \right)$. The shadow vector is then $\left( \begin{array}{c} x_{1} \\ x_{2} \\ 0% \end{array}% \right)$ and the nullspace given by $\left( \begin{array}{c} 0 \\ 0 \\ x_{3}% \end{array}% \right)$. (end of example)

Here is a simple illustration.

Rather than a projection straight down, consider the projection $B=\left( \begin{array}{ccc} 1 & 0 & 0 \\ 1 & 1 & 0 \\ 0 & 0 & 0% \end{array}% \right)$. Assuming that the ball's position is again $\left( \begin{array}{c} x_{1} \\ x_{2} \\ x_{3}% \end{array}% \right)$, the position of the shadow is

$\left( \begin{array}{ccc} 1 & 0 & 0 \\ 1 & 1 & 0 \\ 0 & 0 & 0% \end{array}% \right) \left( \begin{array}{c} x_{1} \\ x_{2} \\ x_{3}% \end{array}% \right) =\left( \begin{array}{c} x_{1} \\ x_{1}+x_{2} \\ 0% \end{array}% \right)$. However, the nullspace of $B$ is again $\left( \begin{array}{c} 0 \\ 0 \\ x_{3}% \end{array}% \right)$. I expected the nullspace to correspond to the tilted line between the ball and its shadow. Where am I making a mistake?

Trusting your illustration, I think you've got the wrong matrix. Suppose the origin of $\mathbb R^3$ is on the table, the table corresponds to the space spanned by the unit vectors $\mathbf e_x$ and $\mathbf e_y$ and the lamp is directly above the origin, shining light that is everywhere perpendicular to the table. Then your $B$ fixes $\mathbf e_y$, crushes $\mathbf e_z$ to the origin, while sliding $\mathbf e_x$ up to $(1,1,0)$ (the first column of $B$).
The matrix you need is one that crushes the diagonal vector $(1,0,1)$ toward the origin, so that its kernel is a diagonal line, as you expect. To construct it, think in physical terms. Suppose that the light shines uniformly at $45^\circ$ to the table, like in your illustration. If you place a ball at position $(0,0,1)$, i.e. on the unit vector $\mathbf e_z$, its shadow appears at the point $(-1,0,0)$. If you place it on the table, of course the shadow will "coincide" with the ball, i.e. $\mathbf e_x$ and $\mathbf e_y$ will be fixed, as before. So the matrix you are looking for is $$C = \begin{pmatrix} 1 & 0 & -1 \\ 0 & 1 & 0 \\ 0 & 0 & 0 \end{pmatrix}$$ and you may check that the null-space of $C$ is spanned by $(x,0,x)$, i.e. it is a diagonal line.
This kinds of matrices represent linear operators called projectors, i.e. such that if you apply them twice you get the same result ($PP = P$: this identity is evident in the vertical-shadow example – try multiplying matrix $A$ by itself).