Again, Sage is useful for illustrating a theorem, in this case Theorem PSPHS. We will illustrate both “directions” of this equivalence with the system from Example ISSI.
First we will build solutions to this system. Theorem PSPHS says we need a particular solution, i.e. one solution to the system, $\vect{w}$. We can get this from Sage's .solve_right() matrix method. Then for any vector $\vect{z}$ from the null space of the coefficient matrix, the new vector $\vect{y}=\vect{w}+\vect{z}$ should be a solution. We walk through this construction in the next few cells, where we have employed a specific element of the null space, z, along with a check that it is really in the null space.
You can create solutions repeatedly via the creation of random elements of the null space. Be sure you have executed the cells above, so that coeff, n, const, nsp and w are all defined. Try executing the cell below repeatedly to test infinitely many solutions to the system. You can use the subsequent compute cell to peek at any of the solutions you create.
For the other direction, we present (and verify) two solutions to the linear system of equations. The condition that $\vect{y}=\vect{w}+\vect{z}$ can be rewritten as $\vect{y}-\vect{w}=\vect{z}$, where $\vect{z}$ is in the null space of the coefficient matrix. which of our two solutions is the “particular” solution and which is “some other” solution? It does not matter, it is all sematics at this point. What is important is that their difference is an element of the null space (in either order). So we define the solutions, along with checks that they are really solutions, then examine their difference.