Finding a general solution to homogeneous and nonhomogeneous systems Given the nonhomogeneous system $$\cases{ax+by+cz=d\\fx+gy+hz=k}$$ with solution $(2,-3,1)$ and the homogeneous system $$\cases {ax+by+cz=0\\fx+gy+hz=0}$$ with solutions $(-1,1,1),(1,0,1)$, find the general solution of each system.
I tried plugging in the given solutions to find the relation between the variables but got confused a bit on how to finish it, plus I have no idea about the nonhomogeneous one.
Can anyone give me a clue or direct me to a more elegant way?
 A: General solution for (O).
Given $(1, 0, 1), (-1, 1, 1)$ as solutions of (O):
$\begin{cases}{a+c=0\\-a+b+c=0}\end{cases}$
So $c=-a$ and $b=2a$
As well, we get the values of $h=-f$, $g=2f$ by same operations.
Now let's arrange our system in a general form of homogeneous system $A\underline{x}=\underline{0}$:
$\begin{pmatrix}
a & 2a & -a\\
f & 2f & -f
\end{pmatrix}\begin{pmatrix}x\\y\\z\end{pmatrix}=\begin{pmatrix}0\\0\\0\end{pmatrix}$
$A=\begin{pmatrix}a & 2a & -a\\f & 2f & -f\end{pmatrix}$.
In order for the inhomogeneous system $(M)$ to have a solution $(2, -3, 1)$, at least one of the parameters $a, f$ must not equal $0$.
Assume $a\neq0$:
$\begin{pmatrix}a & 2a & -a\\f & 2f & -f\end{pmatrix}\xrightarrow{R_1=\frac{1}{a}R_1}\begin{pmatrix}1 & 2 & -1\\f & 2f & -f\end{pmatrix}\xrightarrow{R_2=R_2-fR_1}\begin{pmatrix}1 & 2 & -1\\0 & 0 & 0\end{pmatrix}$
Now we have one equation with 3 parameters, which means there are 2 free variables $y,z$
and an infinite amount of solutions. A general solution for (O) looks like: $(-2t+s, t, s)$ where $t,s\in \mathbb{R}$.
General solution for (M).
$A\underline{x}=\underline0, \ \ \ A\underline{c}=\underline{b}\ \ \ \ \rightarrow \ \ \ A\underline{x}+A\underline{c}=\underline0+\underline{b}=\underline{b} \ \ \ \ \rightarrow 
 \ \ \ A(\underline{x}+\underline{c})=\underline{b}$
Hence, the general solution for (M) is: ${\{(2, -3, 1)+(-2t+s, t, s)|t,s \in \mathbb{R}\}}$.
Another way to write the general solution:
$\begin{pmatrix}2\\-3\\1\end{pmatrix}+t\begin{pmatrix}-2\\1\\0\end{pmatrix}+s\begin{pmatrix}1\\0\\1\end{pmatrix}$, $t,s \in \mathbb{R}$.
