# Finding a General Solution to a Nonhomogeneous Matrix Equation

I've come across a question in which I've been asked to find the general solution to the matrix equation:

$\begin{bmatrix}1 & -2 & 1\\-2 & 4 &-2\\1 & -2 & 1\end{bmatrix} \begin{bmatrix}x\\y\\z\end{bmatrix} = \begin{bmatrix}8\\-16\\8\end{bmatrix}$

by first finding a solution to a similar homogeneous equation:

$\begin{bmatrix}1 & -2 & 1\\-2 & 4 &-2\\1 & -2 & 1\end{bmatrix} \begin{bmatrix}x\\y\\z\end{bmatrix} = \begin{bmatrix}0\\0\\0\end{bmatrix}$

and then using that along with a given solution,

\begin{bmatrix}1\\-2\\3\end{bmatrix}

to find the general solution.

I've been looking around online and in textbooks for awhile and can't seem to find any information on this type of problem. Could someone provide a rundown of the methodology?

General solution = (particular solution) + (general solution of the homogeneous equation).

Notice the column structure of the target matrix: $$\mathbf{A}= % \left[ \begin{array}{rrr} 1 & -2 & 1 \\ -2 & 4 & -2 \\ 1 & -2 & 1 \\ \end{array} \right] % = % \left[ \begin{array}{rrr} c_{1} & -2 c_{1} & c_{1} \end{array} \right].$$ We have one essential column. The rank plus nullity theorem reveals there will be two vectors to span the nullspace. $$\mathcal{N}\left( \mathbf{A} \right) = \text{span } \left\{ \, \left[ \begin{array}{r} 2 \\ 1 \\ 0 \end{array} \right], \, \left[ \begin{array}{r} 1 \\ 0 \\ -1 \end{array} \right] \, \right\}$$

For the data vector $$b= \left[ \begin{array}{r} 1 \\ 0 \\ -1 \end{array} \right]$$ The general solution for $\mathbf{A}x = b$ is $$x = \left[ \begin{array}{c} 8 \\ 0 \\ 0 \end{array} \right] + \alpha \left[ \begin{array}{c} 2 \\ 1 \\ 0 \end{array} \right] + \beta \left[ \begin{array}{r} 1 \\ 0 \\ -1 \end{array} \right], \qquad \alpha, \beta \in \mathbb{C}.$$