0
$\begingroup$

Suppose I have a system of equations whose augmented matrix is $$ \left[\begin{array}{ccc|c} 1 & 2 & 3 & 7\\ 4 & 5 & 6 & 8 \end{array}\right] $$ After converting this matrix to row reduced echelon form I got $$ \left[\begin{array}{ccc|c} 1 & 0 & -1 & -19/3 \\ 0 & 1 & 2 & 20/3 \end{array}\right] $$

Now I want a solution such that $$0 < x_1 < 9, \quad 0 < x_2 < 7, \quad 0 < x_3 < 2$$ One such solutions is $x_1 = -16/3 , x_2 = 14/3$ and $x_3 = 1$.

But how do I find one such solution in general case, suppose I have n unknowns variables ? I am only considering the case when infinite solutions exist for a linear system

$\endgroup$
  • $\begingroup$ What logic should I use in coding to get one desired solution. $\endgroup$ – Shivam Chauhan Sep 16 '18 at 12:28
0
$\begingroup$

You determined that the null space of your system is $\operatorname{span}\left\{\begin{bmatrix} 1 \\ -2 \\ 1\end{bmatrix}\right\}$ so the general solution is

$$x = \begin{bmatrix} x_1 \\ x_2 \\ x_3\end{bmatrix} = \begin{bmatrix} -\frac{19}3 \\ \frac{20}3 \\ 0\end{bmatrix} + t\begin{bmatrix} 1 \\ -2 \\ 1\end{bmatrix} = \begin{bmatrix} -\frac{19}3 + t \\ \frac{20}3-2t \\ t\end{bmatrix}$$

Therefore you can solve for $t$ independently in $$0 < -\frac{19}3 + t < 9 \implies t \in\left\langle \frac{19}3, \frac{100}3\right\rangle$$ $$0 < \frac{20}3-2t < 7 \implies t \in\left\langle -\frac16, \frac{10}3\right\rangle$$ $$0 < t < 2 \implies t \in \langle 0, 2\rangle$$

an take the intersection.

$\endgroup$
  • $\begingroup$ I am asking for general case where number of free variables are more, not just one. I can't use nested loops for every variable. $\endgroup$ – Shivam Chauhan Sep 16 '18 at 12:57
  • $\begingroup$ How should I code this if I have more than one free variable. I dont't want to use many nested loops. $\endgroup$ – Shivam Chauhan Sep 16 '18 at 13:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.