A matrix $A$ such that $Ax = b$ has either 1 or infinitely many solutions, depending on $b$ How can I find a matrix like this:


  Find a matrix $A$ such that $Ax = b$ that has either 1 or infinitely many solutions depending on $b$.


Thank you.
The problem is to identify a matrix $A$ such that $Ax = b$ has infinitely many solutions for some $b$ and exactly one solution for another righthand side $b$.

There is no such square matrix $A$, as either the matrix is singular (and for some $b$ there is no solution while for other $b$ there are infinitely many solutions) or the matrix is nonsingular (and there exists a unique solution for every $b$).

Indeed the logic extends even to nonsquare matrices, that such $A$ is impossible.  Suppose for some particular $b$ there are infinitely many solutions.  Pick two distinct solutions, $x_1 \neq x_2$ such that $Ax_1 = Ax_2 = b$.  Then $A(x_1 - x_2) = 0$, so that there are infinitely many solutions to $Ax = 0$ (taking any multiple of $x_1 - x_2$).

It follows that for any righthand side $b$ the system has either infinitely many or zero solutions.  For if one solution exists, then to that any nonzero multiple of $x_1-x_2$ may be added to obtain another.
I'm assuming you're working over $\mathbb{R}$ (Over a finite field there would only be a finite number of solutions, never infinitely many).  This question can be thought of as


  Think of an $n \times m$ matrix as a function from $\mathbb{R}^m$ to $\mathbb{R}^n$.  Find an $n \times m$ matrix $A$ such the "image" of $A$ is all of $\mathbb{R}^m$, in other words find a matrix that maps (surjectively) onto $\mathbb{R}^m$ (i.e. $A$ is an onto map)


So, now that we have some big words thrown at us, what does that mean?  This means we want to have $m$ "linearly independent columns" in our matrix.  This will mean that $rank(A) = m$, and hence $\dim(Im(A)) = m$, and $Im(A) = \mathbb{R}^m$.

So choose a square nonsingular square matrix or a "fat" matrix of rank $m$, and you'll be all set.  Examples of these are $$I = \begin{pmatrix}1 &amp; 0 &amp; \ldots &amp; 0 \\ 0 &amp; 1 &amp; \ldots &amp; 0 \\ \vdots &amp; \vdots &amp; \vdots &amp; \vdots \\0 &amp; 0 &amp; \ldots &amp; 1   \end{pmatrix}$$ and for a nonsquare matrix $$I^* = \begin{pmatrix} I &amp;|&amp; * \end{pmatrix}$$
Where the second matrix is a block matrix with one block the identity and one block anything.