Solution (source code)

= Solution

For any <linear system> $Ax=c$, a solution exists exactly when $c$ belongs to the <image of a linear map> represented by $A$. If $x_0$ is one solution, all others are exactly
$$
x=x_0+v,\qquad v\in\ker A,
$$
since $A(x-x_0)=0$, and conversely adding a <kernel> <vector> preserves the equation. Thus there are no solutions if $c\notin\operatorname{im}A$, one if $c\in\operatorname{im}A$ and $\ker A=\{0\}$, and infinitely many if $c\in\operatorname{im}A$ and the <kernel> is nontrivial: every real multiple of a nonzero <kernel> <vector> gives a distinct solution. Any two solutions differ by a <kernel> <vector>. Equivalently, consistency means the augmented <matrix> and $A$ have equal <rank of a matrix>; a consistent square <linear system> is unique exactly when its <determinant> is nonzero.

For the given <matrix>, set $d=b-a$ and $s=2a+b$. Perform the <column operation> $C_1\leftarrow C_1+C_2+C_3$, then the <row operations> $R_2\leftarrow R_2-R_1$ and $R_3\leftarrow R_3-R_1$. Factoring the first column gives
$$
\det A=s\det\begin{pmatrix}1&a&b\\0&0&a-b\\0&b-a&a-b\end{pmatrix}
=\boxed{(2a+b)(b-a)^2}.
$$
These operations are determinant-preserving, and the displayed polynomial identity remains valid even when a factored expression vanishes.

To find all <kernels> and <images of a linear map>, put
$$
u=(1,1,1)^T,\qquad H=\{x:x_1+x_2+x_3=0\},\qquad P=\begin{pmatrix}0&0&1\\1&0&0\\0&1&0\end{pmatrix}.
$$
If $J$ is the all-ones <matrix>, then $A=aJ+dP$. The <direct sum> $\mathbb R^3=\mathbb Ru\oplus H$ is invariant under $A$: on $\mathbb Ru$ it acts by multiplication by $s$, and on $H$ by $dP$. Since $P^3=I$, its restriction to $H$ is invertible.

For $d\ne0$ and $s\ne0$, the <kernel> is $\{0\}$ and the <image of a linear map> is all of $\mathbb R^3$. Decompose the right-hand side as
$$
(1,c,1)^T=\frac{c+2}{3}u+\frac{c-1}{3}(-1,2,-1)^T.
$$
Applying the inverse on each invariant summand gives the unique solution
$$
\boxed{x=\frac{c+2}{3s}u+\frac{c-1}{3d}(2,-1,-1)^T.}
$$
For $d\ne0$ and $s=0$, the <kernel> is $\mathbb Ru$ and the <image of a linear map> is $H$. A solution exists exactly when $c+2=0$. For $c=-2$, all solutions are
$$
\boxed{x=-\frac1d(2,-1,-1)^T+t u,\qquad t\in\mathbb R.}
$$
For $d=0$ and $a\ne0$, so $a=b$, the <kernel> is $H$ and the <image of a linear map> is $\mathbb Ru$. A solution exists exactly when $c=1$. All such solutions are
$$
\boxed{x=(r,t,1/a-r-t)^T,\qquad r,t\in\mathbb R.}
$$
Finally, for $a=b=0$, the <kernel> is $\mathbb R^3$ and the <image of a linear map> is $\{0\}$. The right-hand side has first entry one, so \b[there is no solution for any $c$]. These four cases exhaust all parameter values.