As an extension to Finding null space of matrix. which asked about the nullspace of the rref matrix: $$R = \begin{bmatrix} 1 & -2 & 0 & -1 & 3 \\ 0 & 0 & 1 & 2 & -2 \\ 0 & 0 & 0 & 0 & 0 \\ \end{bmatrix}$$
I wanted to generate a particular solution as well, using some $d = \begin{bmatrix} 3\\ 1\\ 0\\ \end{bmatrix}$ with $Rx = d$. The $d$ I chose was random, with the exception that the last row had to contain $0$ (or $d$ wouldn't be in the column space of $R$). I solved this system by setting all the free variables ($x_2$, $x_4$, $x_5$) to $0$ and then solving for the pivot variables ($x_1$, $x_3$), which gave me $x_1 = 3, x_3 = 1$, and thus $$x_p = \begin{bmatrix} 3\\ 0\\ 1\\ 0\\ 0\\ \end{bmatrix}$$ So the final solution seems to be the superposition of the particular part and the homogeneous part, which is:
$$x=\begin{bmatrix} x_1\\ x_2\\ x_3\\ x_4\\ x_5\\ \end{bmatrix} = \begin{bmatrix} 3\\ 0\\ 1\\ 0\\ 0\\ \end{bmatrix} + x_2 \begin{bmatrix} 2\\ 1\\ 0\\ 0\\ 0\\ \end{bmatrix} + x_4 \begin{bmatrix} 1\\ 0\\ -2\\ 1\\ 0\\ \end{bmatrix} + x_5 \begin{bmatrix} -3\\ 0\\ 2\\ 0\\ 1\\ \end{bmatrix}$$
Is this the correct thought process when coming up with a solution to a nonhomogeneous problem? Also, why is it necessary to set the free variables to 0 when solving for the pivot variables? Thanks!
Note: I have been very terse. Let me know if any facts need clarification.
– twosigma Jan 10 '21 at 14:31